Browse Source

Fix the user info page when we hide some section on the front page

For running pagure as front-end for pkgs.fp.o we added the option to
hide by default some sections (such as all the repos) when the user is
logged out.
This lead to the situation where we hide all the projects on the front
page but this hides the user's projects on the user's page.

With this page, we can turn off the hide feature for the user's page.
Pierre-Yves Chibon 8 years ago
parent
commit
9d1583e80d
2 changed files with 9 additions and 9 deletions
  1. 6 6
      pagure/templates/_render_repo.html
  2. 3 3
      pagure/templates/user_info.html

+ 6 - 6
pagure/templates/_render_repo.html

@@ -33,9 +33,9 @@
 
 
 {% macro render_repos(
-        list, total, pagetitle, page, title, count, id, username=None) %}
+        list, total, pagetitle, page, title, count, id, username=None, hide=True) %}
     <section class="project_list" id="{{ id }}"{%
-        if g.fas_user and id in config.get('SHOW_PROJECTS_INDEX', [])
+        if g.fas_user and id in config.get('SHOW_PROJECTS_INDEX', []) and hide
         %} style="display:none;" {% endif %}>
         <header>
             {% set title_lvl = 3 if username else 2 %}
@@ -75,7 +75,7 @@
 {% endmacro %}
 
 
-{% macro repos_switch(all = True) %}
+{% macro repos_switch(all=True, hide=True) %}
     <aside class="show_parts">
         <div class="container">
         <strong>
@@ -85,7 +85,7 @@
             <label class="switch">
                 <input type="checkbox" class="switch-input"
                     name="{% if all %}my{% endif %}repos" {%
-                    if 'myrepos' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    if 'myrepos' not in config.get('SHOW_PROJECTS_INDEX', []) and not hide
                     %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
@@ -94,7 +94,7 @@
             <label class="switch">
                 <input type="checkbox" class="switch-input"
                     name="{% if all %}my{% endif %}forks" {%
-                    if 'myforks' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    if 'myforks' not in config.get('SHOW_PROJECTS_INDEX', []) and not hide
                     %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
@@ -104,7 +104,7 @@
             <label class="switch">
                 <input type="checkbox" class="switch-input"
                     name="repos" id="allrepos" {%
-                    if 'repos' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    if 'repos' not in config.get('SHOW_PROJECTS_INDEX', []) and not hide
                     %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>

+ 3 - 3
pagure/templates/user_info.html

@@ -22,17 +22,17 @@
         {% endif %}
 
     </h2>
-    {{ repos_switch(False) }}
+    {{ repos_switch(False, hide=False) }}
     <p title="{{ user.created.strftime('%Y-%m-%d') }}">
       Joined {{ user.created | humanize }}
     </p>
 
     {{ render_repos(
             repos, total_page_repos, 'repopage', repopage,
-            'Projects', repos_length, 'repos') }}
+            'Projects', repos_length, 'repos', hide=False) }}
     {{ render_repos(
             forks, total_page_forks, 'forkpage', forkpage,
-            'Forks', forks_length, 'forks') }}
+            'Forks', forks_length, 'forks', hide=False) }}
     <section class="project_list" id="group_list">
         <header>
             <h2>Groups ({{ user.groups | length }})</h2>