diff MoinMoin/templates/global_history.html @ 918:764f209d1eae storage-ng

simplify global history (and make it faster), bookmark changes for diff and history global history was much too slow. even with a relatively small wiki with 5000 revisions total, it needed >60s on my machine to render. it was because the code needed all these revisions to be created (including ACL checks, etc.). i changed this to a much simpler global history that just uses the latest-revs index now and ONLY displays the latest change for every item, so we never need to access the usually 10x bigger all-revs index. i also removed display of editors / commit comments, because we could only display the editor and comment of the latest edit, but not of any previous edit, so we better do not display any of this data. users interested in details are expected to klick on the diff and history links provided. they both use the bookmark (if the user has one) and show the diff or history until the bookmark. put diff and diffsince into one view, just different url args. removed paging support from global history. the way it worked, it was much too slow anyway. users are encouraged to use the bookmark functionality to limit the amount of information displayed on global history. to avoid the worst case of getting an extremely big global history for new users without bookmark, there is a internal limit of 1000 entries.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 03 Oct 2011 00:08:56 +0200
parents 51475954290f
children a974190eaeda f2d8c602dbb6
line wrap: on
line diff
--- a/MoinMoin/templates/global_history.html	Sun Oct 02 17:08:23 2011 +0200
+++ b/MoinMoin/templates/global_history.html	Mon Oct 03 00:08:56 2011 +0200
@@ -3,75 +3,47 @@
 
 {% block head %}
 {{ super() }}
-<link rel="alternate" title="Global changes" href="{{ url_for('feed.atom') }}" type="application/atom+xml" />
+<link rel="alternate" title="Global History" href="{{ url_for('feed.atom') }}" type="application/atom+xml" />
 {% endblock %}
 
 {% block content %}
-<div class='moin-offset-links'>
-    {% if previous_offset >= 0 %}
-        <a href="{{ url_for('frontend.global_history', offset=previous_offset) }}" title="{{ _("Previous") }}">&laquo;</a>
-    {% endif %}
-    {% if offset %}
-        <a href="{{ url_for('frontend.global_history', offset=offset) }}" title="{{ _("Next") }}">&raquo;</a>
-    {% endif %}
-</div>
 <h1>{{ _("Global History") }}</h1>
 <div class='moin-clr'></div>
     <div id="moin-global-history">
-        {% for rev_date, revs in history %}
-           {% set  latest_rev = revs[0] %}
-           {% set  latest_timestamp = latest_rev.timestamp %}
+        {% for day, revs in history %}
+           {% set latest_timestamp = revs[0].meta['mtime'] %}
             <div class="moin-history-container"> 
                 <div class="moin-history-container-header">
                     <span>
-                        <h2>{{ rev_date }}</h2>
+                        <h2>{{ day }}</h2>
                         {% if user.valid %}
-                        <a class="bookmark-link" href="{{ url_for('frontend.bookmark', time=utctimestamp(latest_timestamp)) }}">{{ _("Set bookmark") }}</a>
+                        <a class="bookmark-link" href="{{ url_for('frontend.bookmark', time=latest_timestamp+1) }}">{{ _("Set bookmark") }}</a>
                         {% endif %}
                    </span>
                 </div>
                 <div class="moin-history-container-body">
                     <table>
                     {% for rev in revs %}
+                        {% set meta = rev.meta %}
                         <tr>
-                            {% set item_latest_revid = rev.revids[0] %}
-                            <td class="moin-action" title="{{ _("DIFF") }}">                                
-                                <a href="{{ url_for('frontend.diff', item_name=rev.item_name, rev1=item_latest_revid, rev2=rev.revids[-1]) }}" class="moin-history-{{ rev.action|lower }}">  </a>
+                            <td class="moin-action">
+                                <span class="moin-history-{{ meta.action|lower }}"></span>
                             </td>
-                            <td class="moin-history-item"><a class="{{ rev.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=rev.item_name) }}" title="{{ rev.contenttype }}">{{ rev.item_name }}</a></td>
-                            <td class="moin-history-time">{{ rev.timestamp|timeformat }}</td>
                             <td class="moin-history-links">
-                                {% for revid in rev.revids %}
-                                    {% set position = rev.revids.index(revid) %}
-                                    {% if position > 0 %}
-                                        <a href="{{ url_for('frontend.diff', item_name=rev.item_name, rev1=revid, rev2=item_latest_revid) }}">[{{ position }}]</a>
-                                    {% else %}
-                                        <span>[0]</span>
-                                    {% endif %}
-                                {% endfor %}
+                                <a href="{{ url_for('frontend.history', item_name=meta.name, bookmark=bookmark_time) }}">HIST</a>
+                                {% if bookmark_time -%}
+                                    <a href="{{ url_for('frontend.diff', item_name=meta.name, bookmark=bookmark_time) }}">DIFF</a>
+                                {%- endif %}
                             </td>
-                            <td class="moin-wordbreak moin-history-editorinfo">
-                                {% for info, position in rev.editors %}
-                                    <span class="moin-history-editortext">
-                                    {{ utils.show_editor_info(info) }}
-                                    {% if position %}
-                                        [{{ position }}]
-                                    {% endif %}
-                                    </span>
-                                {% endfor %}
-                            </td>
-                            <td class="moin-wordbreak moin-history-comment">
-                               {% for comment in rev.comments %}
-                                   <span>{{ comment }}</span>
-                               {% endfor %}
-                            </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) }}" title="{{ meta.contenttype }}">{{ meta.name }}</a></td>
                         </tr>
                     {% endfor %}
                     </table>
                 </div>
             </div>
         {% endfor %}
-        {% if user.valid and bookmark_time %}
+        {% if bookmark_time %}
         <div class="moin-history-container"> 
             <div class="moin-history-container-header">
                 <span>