changeset 2255:98be82eb3db8

Namespace and fqname support for global history view.
author Ashutosh Singla <ashu1461@gmail.com>
date Thu, 05 Sep 2013 03:49:19 +0530
parents 1ba1a9c6c3b2
children e66f66689305
files MoinMoin/apps/frontend/views.py MoinMoin/templates/global_history.html
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon Sep 02 17:46:59 2013 +0530
+++ b/MoinMoin/apps/frontend/views.py	Thu Sep 05 03:49:19 2013 +0530
@@ -1000,11 +1000,14 @@
     )
 
 
-@frontend.route('/+history')
-def global_history():
+@frontend.route('/<namespace>/+history')
+@frontend.route('/+history', defaults=dict(namespace=NAMESPACE_DEFAULT), methods=['GET'])
+def global_history(namespace):
     all_revs = bool(request.values.get('all'))
     idx_name = ALL_REVS if all_revs else LATEST_REVS
     query = Term(WIKINAME, app.cfg.interwikiname)
+    if namespace != NAMESPACE_ALL:
+        query = And([query, Term(NAMESPACE, namespace)])
     bookmark_time = flaskg.user.bookmark
     if bookmark_time is not None:
         query = And([query, DateRange(MTIME, start=datetime.utcfromtimestamp(bookmark_time), end=None)])
--- a/MoinMoin/templates/global_history.html	Mon Sep 02 17:46:59 2013 +0530
+++ b/MoinMoin/templates/global_history.html	Thu Sep 05 03:49:19 2013 +0530
@@ -28,13 +28,13 @@
                                 <span class="moin-history-{{ meta.action|lower }}"></span>
                             </td>
                             <td class="moin-history-links">
-                                <a href="{{ url_for('frontend.history', item_name=meta.name[0], bookmark=bookmark_time) }}">HIST</a>
+                                <a href="{{ url_for('frontend.history', item_name=rev.fqname, bookmark=bookmark_time) }}">HIST</a>
                                 {% if bookmark_time -%}
-                                    <a href="{{ url_for('frontend.diff', item_name=meta.name[0], bookmark=bookmark_time) }}">DIFF</a>
+                                    <a href="{{ url_for('frontend.diff', item_name=rev.fqname, bookmark=bookmark_time) }}">DIFF</a>
                                 {%- endif %}
                             </td>
                             <td class="moin-history-time">{{ meta.mtime|timeformat }}</td>
-                            <td class="moin-history-item"><a class="{{ meta.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=meta.name[0]) }}" title="{{ meta.contenttype }}">{{ meta.name|join(' | ') }}</a></td>
+                            <td class="moin-history-item"><a class="{{ meta.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=rev.fqname) }}" title="{{ meta.contenttype }}">{{ meta.name|join(' | ') }}</a></td>
                         </tr>
                     {% endfor %}
                     </table>