Split off updates to another template. List sources.
authorEevee <git@veekun.com>
Mon, 26 Jul 2010 05:18:17 +0000 (22:18 -0700)
committerEevee <git@veekun.com>
Mon, 26 Jul 2010 05:18:17 +0000 (22:18 -0700)
splinext/frontpage/controllers/frontpage.py
splinext/frontpage/templates/front_page/updates.mako [new file with mode: 0644]
splinext/frontpage/templates/index.mako

index 764b292..0990e81 100644 (file)
@@ -52,7 +52,8 @@ class FrontPageController(BaseController):
         global_max_age = max_age_to_datetime(
             config['spline-frontpage.max_age'])
 
-        for source in config['spline-frontpage.sources']:
+        c.sources = config['spline-frontpage.sources']
+        for source in c.sources:
             new_updates = source.poll(global_limit, global_max_age)
             updates.extend(new_updates)
 
diff --git a/splinext/frontpage/templates/front_page/updates.mako b/splinext/frontpage/templates/front_page/updates.mako
new file mode 100644 (file)
index 0000000..9a6f584
--- /dev/null
@@ -0,0 +1,13 @@
+% for update in c.updates:
+<%include file="${update.source.template}" args="update=update" />
+% endfor
+% if not c.updates:
+<p>No updates.</p>
+% endif
+
+<p>Sources:</p>
+<ul class="classic-list">
+    % for source in c.sources:
+    <li><a href="${source.link}"><img src="${h.static_uri('spline', "icons/{0}.png".format(source.icon))}" alt=""> ${source.title}</a></li>
+    % endfor
+</ul>
index 677c58c..b7a3b5c 100644 (file)
@@ -1,8 +1,6 @@
 <%inherit file="base.mako" />
 
-<%def name="title()">Home</%def>
+<%def name="title()">Updates</%def>
 
 <h1>Updates</h1>
-% for update in c.updates:
-<%include file="${update.source.template}" args="update=update" />
-% endfor
+<%include file="/front_page/updates.mako" />