[#5683] Changed Allura index page to list neighborhoods instead of all projects
Signed-off-by: Cory Johns <johnsca@geek.net>
diff --git a/Allura/allura/controllers/root.py b/Allura/allura/controllers/root.py
index 19719e1..2075a55 100644
--- a/Allura/allura/controllers/root.py
+++ b/Allura/allura/controllers/root.py
@@ -79,21 +79,14 @@
def _cleanup_request(self):
pass
- @expose('jinja:allura:templates/project_list.html')
+ @expose('jinja:allura:templates/neighborhood_list.html')
@with_trailing_slash
def index(self, **kw):
"""Handle the front-page."""
- c.project_summary = W.project_summary
- projects = M.Project.query.find(
- dict(is_root=True,
- is_nbhd_project=False,
- deleted=False)).sort('shortname').all()
neighborhoods = M.Neighborhood.query.find().sort('name')
- psort = [ (n, [ p for p in projects if p.neighborhood_id==n._id ])
- for n in neighborhoods ]
categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
c.custom_sidebar_menu = [
SitemapEntry(cat.label, '/browse/'+cat.name) for cat in categories
]
- return dict(projects=psort,title="All Projects",text=None)
+ return dict(neighborhoods=neighborhoods,title="All Neighborhoods")
diff --git a/Allura/allura/templates/neighborhood_list.html b/Allura/allura/templates/neighborhood_list.html
new file mode 100644
index 0000000..3a25ab0
--- /dev/null
+++ b/Allura/allura/templates/neighborhood_list.html
@@ -0,0 +1,31 @@
+{% extends g.theme.master %}
+
+{% block title %}{{title}}{% endblock %}
+
+{% block header %}{{title}}{% endblock %}
+
+{% block extra_css %}
+ <style type="text/css">
+ .no-nbhds {
+ text-align: center;
+ font-style: italic;
+ }
+ </style>
+{% endblock %}
+
+{% block content %}
+ {{ text if text }}
+
+ <table>
+ <thead>
+ <tr><th>Neighborhood</th></tr>
+ </thead>
+ <tbody>
+ {% for nbhd in neighborhoods %}
+ <tr><td><a href="{{nbhd.url()}}">{{nbhd.name}}</a></td></tr>
+ {% else %}
+ <tr><td class="no-nbhds">No neighborhoods found</td></tr>
+ {% endfor %}
+ </tbody>
+ </table>
+{% endblock %}