From 211c6a603fdf6b091bc815fb7057a1079e7b584d Mon Sep 17 00:00:00 2001
From: Dhriti Shikhar <dhriti.shikhar.rokz@gmail.com>
Date: Oct 02 2015 12:07:54 +0000
Subject: [PATCH 1/3] Hides all projects of front page by default


---

diff --git a/pagure/templates/_render_repo.html b/pagure/templates/_render_repo.html
index a5d59f6..2460a75 100644
--- a/pagure/templates/_render_repo.html
+++ b/pagure/templates/_render_repo.html
@@ -96,7 +96,7 @@
         <strong>All repos:</strong>
             <label class="switch">
                 <input type="checkbox" class="switch-input"
-                    name="repos" id="allrepos" checked />
+                    name="repos" id="allrepos" />
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
             </label>

From ea9349966a5c0229fee4c4158889c63245789834 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Oct 02 2015 12:24:01 +0000
Subject: [PATCH 2/3] Add option to turn on/off the display of certain part of the user's page


This allows hiding by default all the projects, or the user's fork or
the user's projects. The toggle buttons will still work to change the
default but this changes the default.

---

diff --git a/pagure/default_config.py b/pagure/default_config.py
index e855ee7..e8f214f 100644
--- a/pagure/default_config.py
+++ b/pagure/default_config.py
@@ -46,6 +46,9 @@ ENABLE_DEL_PROJECTS = True
 # Enables / Disables managing access to the repos
 ENABLE_USER_MNGT = True
 
+# Enables / Disables showing all the projects by default on the front page
+SHOW_PROJECTS_INDEX = []
+
 # The URL to use to clone the git repositories.
 GIT_URL_SSH = 'ssh://git@pagure.org/'
 GIT_URL_GIT = 'git://pagure.org/'
diff --git a/pagure/templates/_render_repo.html b/pagure/templates/_render_repo.html
index 2460a75..c0dc249 100644
--- a/pagure/templates/_render_repo.html
+++ b/pagure/templates/_render_repo.html
@@ -33,7 +33,9 @@
 
 
 {% macro render_repos(list, total, page, title, count, id, username=None) %}
-    <section class="project_list" id="{{ id }}">
+    <section class="project_list" id="{{ id }}" {%
+        if id in config.get('SHOW_PROJECTS_INDEX', [])
+        %} style="display:none;" {% endif %}>
         <header>
             {% set title_lvl = 3 if username else 2 %}
             <h{{ title_lvl }}>{{ title }} ({{ count }})</h{{ title_lvl }}>
@@ -81,14 +83,18 @@
 
             <label class="switch">
                 <input type="checkbox" class="switch-input"
-                    name="{% if all %}my{% endif %}repos" checked>
+                    name="{% if all %}my{% endif %}repos" {%
+                    if 'myrepos' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
             </label>
         <strong>Forks:</strong>
             <label class="switch">
                 <input type="checkbox" class="switch-input"
-                    name="{% if all %}my{% endif %}forks" checked>
+                    name="{% if all %}my{% endif %}forks" {%
+                    if 'myforks' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
             </label>
@@ -96,7 +102,9 @@
         <strong>All repos:</strong>
             <label class="switch">
                 <input type="checkbox" class="switch-input"
-                    name="repos" id="allrepos" />
+                    name="repos" id="allrepos" {%
+                    if 'repos' not in config.get('SHOW_PROJECTS_INDEX', [])
+                    %} checked {% endif %}/>
                 <span class="switch-label" data-on="On" data-off="Off"></span>
                 <span class="switch-handle"></span>
             </label>

From f6b97d6c8c7212cd019fe8dbe59a8d2f20582cc5 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Oct 02 2015 12:57:26 +0000
Subject: [PATCH 3/3] Tests are sometime fragile, remove a space too many


---

diff --git a/pagure/templates/_render_repo.html b/pagure/templates/_render_repo.html
index c0dc249..f25f936 100644
--- a/pagure/templates/_render_repo.html
+++ b/pagure/templates/_render_repo.html
@@ -33,7 +33,7 @@
 
 
 {% macro render_repos(list, total, page, title, count, id, username=None) %}
-    <section class="project_list" id="{{ id }}" {%
+    <section class="project_list" id="{{ id }}"{%
         if id in config.get('SHOW_PROJECTS_INDEX', [])
         %} style="display:none;" {% endif %}>
         <header>

