diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index ab805bc..2daf8c1 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -80,6 +80,37 @@ on every page on the site. Usage: {% set site_title = "Pagure" %} +`projectstring(Bool:plural)` macro +############################# + +A macro that returns a string used to refer to Projects in Pagure +The plural parameter informs if the string to be returned is the +plural form. +This macro is optional. +Usage: + +:: + + {% macro projectstring(plural=False) -%} + {% if plural %} + Repositories + {% else %} + Repository + {% endif %} + {% endmacro -%} + + +`projecticon` variable +############################# + +A string containing the name of the fontawesome icon to use for +Projects. This variable is optional. Usage: + +:: + + {% set projecticon = "Package" %} + + `head_imports()` macro ###################### diff --git a/pagure/templates/_browseheader.html b/pagure/templates/_browseheader.html index a984238..30d95fb 100644 --- a/pagure/templates/_browseheader.html +++ b/pagure/templates/_browseheader.html @@ -1,4 +1,5 @@ {% import "theme.html" as theme with context %} +{% from "_projectstring.html" import projectstring, projecticon %} {% macro browse_header(select) -%} @@ -8,7 +9,7 @@
  • - +
  • @@ -29,8 +30,8 @@ - - Projects  + + {{projectstring(plural=True)}} 
    @@ -145,7 +146,7 @@ $('#userdash-search').selectize({ render: { option: function(item, escape) { return '
    ' + - (item.is_fork == "True" ? '' : ' ') + + (item.is_fork == "True" ? '' : ' ') + '' + escape(item.repo_displayname) + '' + '
    '; } diff --git a/pagure/templates/userdash_projects.html b/pagure/templates/userdash_projects.html index 1a420e7..5382658 100644 --- a/pagure/templates/userdash_projects.html +++ b/pagure/templates/userdash_projects.html @@ -4,6 +4,7 @@ {% set tag = "projects" %} {% from "_browseheader.html" import browse_header %} {% from "_render_repo.html" import pagination_link %} +{% from "_projectstring.html" import projectstring, projecticon %} {% from "_render_repo.html" import render_repos_as_card %} @@ -14,8 +15,8 @@
    -

    My Projects

    - {{ userdash_counts['repos_length'] }} projects +

    My {{projectstring(plural=True)}}

    + {{ userdash_counts['repos_length'] }} {{projectstring(plural=True)}}
    @@ -29,7 +30,7 @@
    - {{filtered_repos_count}} Projects + {{filtered_repos_count}} {{projectstring(plural=True)}} @@ -42,7 +43,7 @@ 'ui_ns.view_repo', repo=repo.name, namespace=repo.namespace) }}">
    - +  {{ repo.namespace + '/' if repo.namespace }}{{ repo.name }} diff --git a/pagure/templates/userprofile_forks.html b/pagure/templates/userprofile_forks.html index e9196d9..839f828 100644 --- a/pagure/templates/userprofile_forks.html +++ b/pagure/templates/userprofile_forks.html @@ -4,6 +4,8 @@ {% from "_render_repo.html" import pagination_link %} {% from "userprofile_macros.html" import render_repo_listing %} +{% from "_projectstring.html" import projectstring, projecticon %} + {% block userprofile_content %} @@ -11,7 +13,7 @@

    Forks

    - {{ forks_length }} projects + {{ forks_length }} {{projectstring(plural=True)}}
    {% if forks %} {{ render_repo_listing(forks)}} diff --git a/pagure/templates/userprofile_macros.html b/pagure/templates/userprofile_macros.html index 6da5c45..79b345b 100644 --- a/pagure/templates/userprofile_macros.html +++ b/pagure/templates/userprofile_macros.html @@ -1,3 +1,5 @@ +{% from "_projectstring.html" import projectstring, projecticon %} + {% macro render_repo_listing(repos) %}
    {% for repo in repos %} @@ -17,7 +19,7 @@
    {% else %}
    - +
    {% endif %}
    diff --git a/pagure/templates/userprofile_master.html b/pagure/templates/userprofile_master.html index a0cd093..4bdb9c0 100644 --- a/pagure/templates/userprofile_master.html +++ b/pagure/templates/userprofile_master.html @@ -1,4 +1,5 @@ {% extends "master.html" %} +{% from "_projectstring.html" import projectstring, projecticon %} {% block title %}User {{username}}{% endblock %} @@ -43,7 +44,7 @@ - + Projects 
    diff --git a/pagure/templates/userprofile_overview.html b/pagure/templates/userprofile_overview.html index 9edf44c..de7d345 100644 --- a/pagure/templates/userprofile_overview.html +++ b/pagure/templates/userprofile_overview.html @@ -3,12 +3,13 @@ {% block title %}{{user.username}} - overview{% endblock %} {% from "_render_repo.html" import render_activity_graph %} +{% from "_projectstring.html" import projectstring, projecticon %} {% block userprofile_content %}
    {% if owned_repos %} -

    Top Projects

    +

    Top {{projectstring(plural=True)}}

    {% for repo in owned_repos %} {% endif %} diff --git a/pagure/templates/userprofile_projects.html b/pagure/templates/userprofile_projects.html index bb3154a..e501860 100644 --- a/pagure/templates/userprofile_projects.html +++ b/pagure/templates/userprofile_projects.html @@ -4,14 +4,15 @@ {% from "_render_repo.html" import pagination_link %} {% from "userprofile_macros.html" import render_repo_listing %} +{% from "_projectstring.html" import projectstring, projecticon %} {% block userprofile_content %}
    -

    Projects

    - {{ repos_length }} projects +

    {{projectstring(plural=True)}}

    + {{ repos_length }} {{projectstring(plural=True)}}
    {% if repos %} {{ render_repo_listing(repos)}} @@ -20,7 +21,7 @@ {% endif %} {% else %}
    -

    No projects

    +

    No {{projectstring(plural=True)}}

    {% endif %}
    diff --git a/pagure/templates/userprofile_starred.html b/pagure/templates/userprofile_starred.html index a1c99f0..c0b0f15 100644 --- a/pagure/templates/userprofile_starred.html +++ b/pagure/templates/userprofile_starred.html @@ -1,6 +1,7 @@ {% extends "userprofile_master.html" %} {% from "userprofile_macros.html" import render_repo_listing %} +{% from "_projectstring.html" import projectstring, projecticon %} {% block title %}{{user.username}} - starred{% endblock %} @@ -8,14 +9,14 @@
    -

    Starred Projects

    - {{ user.stars | length }} projects +

    Starred {{projectstring}}s

    + {{ user.stars | length }} {{projectstring}}s
    {% if repos %} {{ render_repo_listing(repos)}} {% else %}
    -

    No starred projects or forks

    +

    No starred {{projectstring}}s or forks

    {% endif %}
    diff --git a/pagure/themes/srcfpo/templates/theme.html b/pagure/themes/srcfpo/templates/theme.html index 5bc3749..a6ec5a1 100644 --- a/pagure/themes/srcfpo/templates/theme.html +++ b/pagure/themes/srcfpo/templates/theme.html @@ -4,6 +4,17 @@ {# site title that shows in the head html element at the end #} {% set site_title = "src.fedoraproject.org" %} +{% macro projectstring(plural=False) -%} + {% if plural %} + Packages + {% else %} + Package + {% endif %} +{% endmacro -%} + +{% set projecticon = "fa-archive" %} + + {% macro head_imports() %} diff --git a/pagure/themes/srcfpo/templates/userprofile_master.html b/pagure/themes/srcfpo/templates/userprofile_master.html index c2ff8ae..e46ac9b 100644 --- a/pagure/themes/srcfpo/templates/userprofile_master.html +++ b/pagure/themes/srcfpo/templates/userprofile_master.html @@ -9,6 +9,7 @@ {% from "_render_repo.html" import render_repos_as_card, render_activity_graph %} +{% from "_projectstring.html" import projectstring, projecticon %} {% block content %} @@ -46,8 +47,8 @@ - - Projects  + + {{projectstring(plural=True)}}