changeset 454:b07dfe4ceb8d

Grouping of global history done on the date basis.
author Akash Sinha <akash2607@gmail.com>
date Tue, 31 May 2011 00:58:29 +0530
parents 7a77ae08161e
children 3ab8882c6da1
files MoinMoin/apps/frontend/views.py MoinMoin/templates/global_history.html MoinMoin/themes/modernized/static/css/common.css
diffstat 3 files changed, 57 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon May 23 00:41:18 2011 +0200
+++ b/MoinMoin/apps/frontend/views.py	Tue May 31 00:58:29 2011 +0530
@@ -15,6 +15,8 @@
 import re
 import difflib
 import time
+from babel.dates import format_date
+from datetime import datetime
 from itertools import chain
 
 from flask import request, url_for, flash, Response, redirect, session, abort, jsonify
@@ -581,10 +583,26 @@
 @frontend.route('/+history')
 def global_history():
     history = flaskg.storage.history(item_name='')
+    history_list = []
+    prev_date = '0000-00-00'
+    temp_list = []
+    for rev in history:
+        tm = datetime.utcfromtimestamp(rev.timestamp)
+        rev_date = format_date(tm)
+        if rev_date == prev_date:
+            temp_list.append(rev)
+        else:
+            history_list.append(temp_list)
+            temp_list = []
+            temp_list.append(rev_date)
+            temp_list.append(rev)
+            prev_date = rev_date
+    history_list.append(temp_list)
+    del history_list[0]  # First item will be a empty one
     item_name = request.values.get('item_name', '') # actions menu puts it into qs
     return render_template('global_history.html',
                            item_name=item_name, # XXX no item
-                           history=history,
+                           history=history_list,
                           )
 
 @frontend.route('/+wanteds')
--- a/MoinMoin/templates/global_history.html	Mon May 23 00:41:18 2011 +0200
+++ b/MoinMoin/templates/global_history.html	Tue May 31 00:58:29 2011 +0530
@@ -8,31 +8,28 @@
 
 {% block content %}
 <h1>{{ _("Global History") }}</h1>
-    <table id="moin-global-history">
-        <thead>
-            <tr>
-                <th>{{ _("Timestamp") }}</th>
-                <th>{{ _("Action") }}</th>
-                <th>{{ _("Name") }}</th>
-                <th>{{ _("Rev.") }}</th>
-                <th>{{ _("Content-Type") }}</th>
-                <th>{{ _("Editor") }}</th>
-                <th>{{ _("Comment") }}</th>
-            </tr>
-        </thead>
-        <tbody>
-        {% for rev in history %}
-        <tr>
-            <td>{{ rev.timestamp|datetimeformat }}</td>
-            <td class="moin-wordbreak">{{ rev.action }}</td>
-            <td class="moin-wordbreak"><a href="{{ url_for('frontend.show_item', item_name=rev.item.name) }}">{{ rev.item.name }}</a>
-                {% if rev.item.name != rev.name %} ({{ rev.name }}){% endif %}</td>
-            <td class="moin-integer">{{ rev.revno }}</td>
-            <td class="moin-wordbreak">{{ rev.contenttype }}</td>
-            <td class="moin-wordbreak">{{ utils.editor_info(rev) }}</td>
-            <td class="moin-wordbreak">{{ rev.comment }}</td>
-        </tr>
+    <div id="moin-global-history">
+        {% for rev_list in history %}
+            <div class="moin-history-container"> 
+                <h2 class="moin-history-container-header">{{ rev_list[0] }}</h2>
+                <div class="moin-history-container-body">
+                    {% set rev_list = rev_list[1:] %}
+                    <table>
+                    {% for rev in rev_list %}
+                     <tr>
+                         <td class="moin-action moin-history-{{ rev.action|lower }}" title="{{ rev.action }}">&nbsp;</td>
+                         <td class="moin-history-item"><a href="{{ url_for('frontend.show_item', item_name=rev.item.name) }}">{{ rev.item.name }}</a>
+                             {% if rev.item.name != rev.name %} ({{ rev.name }}){% endif %}</td>
+                         <td class="moin-history-time">{{ rev.timestamp|timeformat }}</td>
+                         <td class="moin-integer">{{ rev.revno }}</td>
+                         <td class="moin-wordbreak moin-history-contenttype">{{ rev.contenttype }}</td>
+                         <td class="moin-wordbreak moin-history-editorinfo">{{ utils.editor_info(rev) }}</td>
+                         <td class="moin-wordbreak moin-history-comment">{{ rev.comment }}</td>
+                     </tr>
+                    {% endfor %}
+                    </table>
+                </div>
+            </div>
         {% endfor %}
-        </tbody>
-    </table>
+    </div>
 {% endblock %}
--- a/MoinMoin/themes/modernized/static/css/common.css	Mon May 23 00:41:18 2011 +0200
+++ b/MoinMoin/themes/modernized/static/css/common.css	Tue May 31 00:58:29 2011 +0530
@@ -210,13 +210,25 @@
 .moin-hist-rev { margin: 0; }
 #moin-global-history,
 #moin-page-history { font-size: 75%; }
-#moin-global-history tr,
-#moin-page-history tr { border: 1px solid #4D7DA9; }
+#moin-page-history tr { border: 1px solid #4D7DA9; } 
 #moin-global-history th,
 #moin-page-history th { background-color: #81BBF2; border: 0px; font-size: 1.12em; padding: 6px .5em; text-align: left; }
-#moin-global-history td,
+#moin-global-history td {  border: 0px; vertical-align: top;text-align: left; }
 #moin-page-history td { background-color: #E6EAF0; border: 0px; vertical-align: top; }
 .moin-wordbreak { word-break: break-all;  word-wrap: break-word; } /* Firefox needs javascript assistance within tables */
+.moin-history-time { width: 10%; }
+.moin-history-contenttype { width: 18%; }
+.moin-history-editorinfo { width: 10%; }
+.moin-history-comment { width: 18%; }
+.moin-action { width: 2%; }
+.moin-history-container { border: 1px solid #4D7DA9; }
+.moin-history-container-header { background: #81BBF2; margin: 0px; padding: 3px; color: #3b3131; border-bottom: 1px solid #4D7DA9; }
+.moin-history-container-body { padding: 4px; }
+.moin-history-save:before { content: url('../img/moin-edit.png'); }
+.moin-history-trash:before { content: url('../img/moin-deleted.png'); }
+.moin-history-rename:before { content: url('../img/moin-renamed.png'); }
+.moin-history-copy:before { content: url('../img/moin-new.png'); }
+.moin-integer { width: 2%; }
 
 /* diffs */
 .moin-diff { width:99%; table-layout: fixed; }