center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
authorTero Marttila <terom@fixme.fi>
Wed, 11 Feb 2009 23:38:05 +0200
changeset 114 d4848d807fd1
parent 113 9fc0eb751b6a
child 115 751e3fcd11d2
center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
handlers.py
helpers.py
static/irclogs.css
templates/channel.tmpl
templates/channel_calendar.tmpl
templates/channel_last.tmpl
--- a/handlers.py	Wed Feb 11 23:22:13 2009 +0200
+++ b/handlers.py	Wed Feb 11 23:38:05 2009 +0200
@@ -133,7 +133,7 @@
         )
 
 @preferences.handler(prefs.formatter, prefs.timezone, prefs.count)
-def channel_link (request, channel, timestamp, formatter, timezone, count) :
+def channel_link (request, channel, timestamp, formatter, timezone, count, type=None) :
     """
         Display channel_date for specific UTC timestamp
     """
@@ -163,6 +163,10 @@
             count           = count,
             max             = max,
             lines           = lines,
+            
+            # for prev/next date
+            date_next       = channel.source.get_next_date(timestamp),
+            date_prev       = channel.source.get_prev_date(timestamp),
         )
 
 @preferences.handler(prefs.timezone)
--- a/helpers.py	Wed Feb 11 23:22:13 2009 +0200
+++ b/helpers.py	Wed Feb 11 23:38:05 2009 +0200
@@ -152,13 +152,16 @@
 
         return date.strftime(self.ctx['prefs'][preferences.date_format])
 
-    def build_url (self, url, **params) :
+    def url (self, url, **params) :
         """
             Build URL with our request object
         """
 
         return url.build(self.ctx['req'], **params)
-    
+
+    # old name
+    build_url = url
+
     def utc_timestamp (self, dtz) :
         """
             Build an UTC timestamp from the given datetime
--- a/static/irclogs.css	Wed Feb 11 23:22:13 2009 +0200
+++ b/static/irclogs.css	Wed Feb 11 23:38:05 2009 +0200
@@ -141,11 +141,17 @@
     text-align: center;
     font-size: x-large;
     font-weight: bold;
+
+    margin-bottom: 20px;
 }
 
 /* Calendar */
+div.calendar-list {
+    text-align: center;
+}
+
 table.calendar {
-    display: inline;
+    display: inline-table;
 }
 
 table.calendar th {
@@ -157,6 +163,10 @@
 
 }
 
+table.calendar tr.month-header form {
+    padding: 5px;
+}
+
 table.calendar tr.month-header a,
 table.calendar span.prev-month,
 table.calendar span.next-month {
@@ -269,8 +279,6 @@
 
 /* Search form */
 div#search {
-    margin-top: 25px;
-
     padding: 25px;
 
     text-align: center;
@@ -324,8 +332,6 @@
 div.paginate {
     height: 50px;
 
-    padding-top: 20px;
-
     text-align: center;
 }
 
--- a/templates/channel.tmpl	Wed Feb 11 23:22:13 2009 +0200
+++ b/templates/channel.tmpl	Wed Feb 11 23:38:05 2009 +0200
@@ -15,21 +15,6 @@
         </form>
     </li>
 
-<!--
-    <li>
-        <a href="${urls.channel_last.build(req, channel=channel, count=count or None)}">View last:</a>
-    </li><li class="join-left">
-        <form action="" method="GET">
-            <select name="count">
-            % for cc in (10, 20, 50, 100, 'all') :
-                <option${' selected="selected"' if cc == count else ''}>${cc}</option>
-            % endfor
-            </select>
-
-            lines: <input type="submit" value="Go &raquo;" />
-        </form>
-    </li>
--->
     <li><a href="${urls.channel_calendar.build(req, channel=channel)}">Browse by Date</a></li>
 
     <li>
--- a/templates/channel_calendar.tmpl	Wed Feb 11 23:22:13 2009 +0200
+++ b/templates/channel_calendar.tmpl	Wed Feb 11 23:38:05 2009 +0200
@@ -59,8 +59,11 @@
 </table>
 </%def>
 
+<div id="title">${channel.title} :: Calendar for ${h.fmt_month(month)}</div>
+
+<div class="calendar-list">
 ## three months
 ${month_table(h.prev_month(month), is_center=False  )}
 ${month_table(month,               is_center=True   )}
 ${month_table(h.next_month(month), is_center=False  )}
-
+</div>
--- a/templates/channel_last.tmpl	Wed Feb 11 23:22:13 2009 +0200
+++ b/templates/channel_last.tmpl	Wed Feb 11 23:38:05 2009 +0200
@@ -2,12 +2,17 @@
 
 <div id="title">${channel.title} :: Last ${count} lines</div>
 
-<a href="${h.build_url(urls.channel_last, channel=channel, count=count+50)}" class='more-link'>...More...</a>
+<form action="${h.url(urls.channel_last, channel=channel)}" method="GET">
+    View last <select name="count">
+        ${h.select_options(((None, cc) for cc in (10, 20, 50, 100, 200, 500, 1000)), count)}
+    </select> lines: <input type="submit" value="Go &raquo;" />
+</form>
+
 <%include file="lines.tmpl" />
 
 <div id="other-formats">
     Other formats available:<br/>
-        <a href="${h.build_url(urls.channel_last, channel=channel, count=count, type='txt')}">Plaintext</a>
-    |   <a href="${h.build_url(urls.channel_last, channel=channel, count=count, type='png')}">PNG</a>
-    |   <a href="${h.build_url(urls.channel_last, channel=channel, count=count, type='rss')}">RSS</a>
+        <a href="${h.url(urls.channel_last, channel=channel, count=count, type='txt')}">Plaintext</a>
+    |   <a href="${h.url(urls.channel_last, channel=channel, count=count, type='png')}">PNG</a>
+    |   <a href="${h.url(urls.channel_last, channel=channel, count=count, type='rss')}">RSS</a>
 </div>