changeset 2944:afe523052a7f

rework global history styling for modernized and basic themes, add user and comment fields, partial fix #471
author RogerHaase <haaserd@gmail.com>
date Sun, 10 May 2015 13:51:39 -0700
parents 39d57a15fdef
children 72c5a7d688b5
files MoinMoin/static/css/common.css MoinMoin/templates/global_history.html MoinMoin/themes/__init__.py MoinMoin/themes/basic/static/css/theme.css MoinMoin/themes/basic/static/custom-less/theme.less MoinMoin/themes/modernized/static/css/stylus/theme.styl MoinMoin/themes/modernized/static/css/theme.css
diffstat 7 files changed, 59 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/static/css/common.css	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/static/css/common.css	Sun May 10 13:51:39 2015 -0700
@@ -347,7 +347,8 @@
 .moin-tabs .moin-tab-titles a{ color: #00008b; }
 .moin-tab-titles{ margin: 0; padding: -10px 0 0; list-style: none; border-bottom: 3px solid #4e7da9; }
 .moin-tab-titles li { display: inline-block; *display: inline; zoom: 1; margin: 10px 0 -3px; padding: 0 5px; border-bottom: 3px solid #4e7da9; }
-.moin-tab-titles a { display: inline-block; padding: 4px; background-color: #eef1f6; border-width: 1px 1px 0; border-style: solid; border-color: #4e7da9; color: #00008b; border-top-left-radius: 7px; border-top-right-radius: 7px; }
+.moin-tab-titles a { display: inline-block; padding: 4px; background-color: #eef1f6; border-width: 1px 1px 0; border-style: solid;
+    border-color: #4e7da9; color: #00008b; border-top-left-radius: 7px; border-top-right-radius: 7px; }
 .moin-tab-titles a: hover { background-color: #d8dfe9; text-decoration: none; }
 .moin-tab-titles a.moin-current-tab { background: #d8dfe9; padding-top: 8px; margin-top: -4px; }
 .moin-tab-titles .moin-change-indicator { font-weight: bold; color: #1f9ae0; }
@@ -367,3 +368,21 @@
 #options dt { width: 60%; max-width: 40em; }
 #subscriptions textarea { width: 80%; max-width: 40em; margin-bottom: 1em; }
 #subscriptions div.tip { width: 80%; max-width: 40em; margin: auto; }
+
+/* Global history */
+
+#moin-global-history { font-size: 75%; }
+.moin-history-date { font-size: 150%; font-weight: bold; }
+.moin-history-container { border: 1px solid #4e7da9; margin: 2em 0em; border-top-left-radius: 5px; border-top-right-radius: 5px; }
+.moin-history-container-header { background: #00417f; margin: 0; padding: 4px; color: #fff; border-bottom: 1px solid #4e7da9;
+    border-top-left-radius: 5px; border-top-right-radius: 5px; }
+.moin-history-container-header a.moin-bookmark-link { margin-left: 20px; color: #fff; }
+.moin-history-container-body { margin: 0; padding: 0; font-size: 1.2em; }
+.moin-history-container-body table { margin: 0; border: none; width: 100%; }
+.moin-history-time { width: 3em; text-align: right; }
+.moin-history-item { width: 30%; }
+.moin-history-editorinfo { width: 15%; }
+.moin-history-comment { width: 40%; }
+.moin-history-action { width: .5em; cursor: default; }
+.moin-history-action a: hover { text-decoration: none; }
+.moin-history-links { width: .5em; }
--- a/MoinMoin/templates/global_history.html	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/templates/global_history.html	Sun May 10 13:51:39 2015 -0700
@@ -22,28 +22,19 @@
            {% set latest_timestamp = revs[0].meta['mtime'] %}
             <div class="moin-history-container">
                 <div class="moin-history-container-header">
-                    <h2>{{ day }}</h2>
+                    <span class="moin-history-date">{{ day }}</span>
                     {% if user.valid %}
-                        <a class="bookmark-link btn btn-primary" href="{{ url_for('frontend.bookmark', time=latest_timestamp+1) }}">{{ _("Set bookmark") }}</a>
+                        <a class="moin-bookmark-link" href="{{ url_for('frontend.bookmark', time=latest_timestamp+1) }}">{{ _("Set bookmark") }}</a>
                     {% endif %}
                 </div>
                 <div class="moin-history-container-body">
-                    <table class="zebra table table-hover">
-                        {% for rev in revs %}
+                    <table class="zebra">
+                        {% for rev in revs|sort(attribute='fqname') %}
                             {% set meta = rev.meta %}
                             <tr>
-                                <td class="moin-action col-md-1">
-                                    <span title="{{ meta.action|title }}" class="{{ awesome_class[meta.action] }}"></span>
-                                </td>
-                                <td class="moin-history-links col-md-1">
-                                    <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=rev.fqname, bookmark=bookmark_time) }}">DIFF</a>
-                                    {%- endif %}
-                                </td>
-                                <td class="moin-history-time col-md-1">{{ meta.mtime|timeformat }}</td>
-                                <td class="moin-history-item col-md-7">
-                                    <a class="{{ meta.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=rev.fqname) }}" title="{{ meta.contenttype }}">
+                                <td class="moin-history-item moin-wordbreak">
+                                    <a class="{{ meta.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=rev.fqname) }}"
+                                            title="{{ meta.contenttype|shorten_ctype }}">
                                         {% if meta.name %}
                                             {{ meta.name|join(' | ') }}
                                         {% elif meta.summary %}
@@ -53,6 +44,24 @@
                                         {% endif %}
                                     </a>
                                 </td>
+                                <td class="moin-wordbreak moin-history-editorinfo">{{ utils.editor_info(rev.meta) }}</td>
+                                <td class="moin-history-time">{{ meta.mtime|time_hh_mm }}</td>
+                                <td class="moin-history-action">
+                                    <span title="{{ meta.action|title }}" class="{{ awesome_class[meta.action] }}"></span>
+                                </td>
+                                <td class="moin-history-links">
+                                    <a href="{{ url_for('frontend.history', item_name=rev.fqname, bookmark=bookmark_time) }}">
+                                        <span class="fa fa-clock-o" title="{{ _('History') }}"></span>
+                                    </a>
+                                </td>
+                                {% if bookmark_time -%}
+                                    <td class="moin-history-links">
+                                        <a href="{{ url_for('frontend.diff', item_name=rev.fqname, bookmark=bookmark_time) }}">
+                                            <span class="fa fa-copy" title="{{ _('Diff') }}"></span>
+                                        </a>
+                                    </td>
+                                {%- endif %}
+                                <td class="moin-wordbreak moin-history-comment">{{ rev.meta['comment'] }}</td>
                             </tr>
                         {% endfor %}
                     </table>
@@ -62,8 +71,8 @@
         {% if bookmark_time %}
             <div class="moin-history-container">
                 <div class="moin-history-container-header">
-                    <h2>{{ bookmark_time|datetimeformat }}</h2>
-                    <a class="bookmark-link btn btn-danger" href="{{ url_for('frontend.bookmark', time='del') }}">{{ _("Delete bookmark") }}</a>
+                    <span class="moin-history-date">{{ bookmark_time|datetimeformat }}</span>
+                    <a class="moin-bookmark-link" href="{{ url_for('frontend.bookmark', time='del') }}">{{ _("Delete bookmark") }}</a>
                 </div>
             </div>
         {% endif %}
--- a/MoinMoin/themes/__init__.py	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/themes/__init__.py	Sun May 10 13:51:39 2015 -0700
@@ -9,6 +9,7 @@
 
 
 import urllib
+import datetime
 
 from json import dumps
 
@@ -651,6 +652,14 @@
     return CONTENTTYPES_MAP.get(contenttype, "Unknown")
 
 
+def time_hh_mm(dt):
+    """
+    Convert a datetime object into a short string of the form HH:MM
+    where HH varies from 0 to 23.
+    """
+    return datetime.datetime.fromtimestamp(dt).strftime('%H:%M')
+
+
 def setup_jinja_env():
     app.jinja_env.filters['shorten_fqname'] = shorten_fqname
     app.jinja_env.filters['shorten_item_name'] = shorten_item_name
@@ -658,6 +667,7 @@
     app.jinja_env.filters['contenttype_to_class'] = contenttype_to_class
     app.jinja_env.filters['json_dumps'] = dumps
     app.jinja_env.filters['shorten_ctype'] = shorten_ctype
+    app.jinja_env.filters['time_hh_mm'] = time_hh_mm
     # please note that these filters are installed by flask-babel:
     # datetimeformat, dateformat, timeformat, timedeltaformat
 
--- a/MoinMoin/themes/basic/static/css/theme.css	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/themes/basic/static/css/theme.css	Sun May 10 13:51:39 2015 -0700
@@ -6795,18 +6795,6 @@
 #editor > textarea {
   width: 100%;
 }
-.moin-history-container-header {
-  margin-bottom: 5px;
-}
-.moin-history-container-header > h2 {
-  display: inline;
-}
-.moin-history-container-header > .bookmark-link {
-  margin-bottom: 15px;
-  margin-left: 20px;
-  height: 2em;
-  line-height: 1em;
-}
 img {
   vertical-align: bottom;
 }
--- a/MoinMoin/themes/basic/static/custom-less/theme.less	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/themes/basic/static/custom-less/theme.less	Sun May 10 13:51:39 2015 -0700
@@ -378,18 +378,6 @@
 #editor > textarea {
   width: 100%;
 }
-.moin-history-container-header {
-  margin-bottom: 5px;
-  > h2 {
-    display: inline;
-  }
-  > .bookmark-link {
-    margin-bottom: 15px;
-    margin-left: 20px;
-    height: 2em;
-    line-height: 1em;
-  }
-}
 
 img {
   vertical-align: bottom;  // moin std is bottom, bootstrap sets to middle
--- a/MoinMoin/themes/modernized/static/css/stylus/theme.styl	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/themes/modernized/static/css/stylus/theme.styl	Sun May 10 13:51:39 2015 -0700
@@ -251,7 +251,7 @@
 .moin-hist-rev
     margin 0
 
-#moin-global-history,
+
 #moin-page-history
     font-size 75%
 
@@ -272,68 +272,7 @@
                         &:hover
                             box-shadow 1px 1px 2px font_color
 
-.moin-history-time
-    width 10%
-    text-align right
-
-.moin-history-contenttype
-    width 18%
-
-.moin-history-editorinfo
-    width 17%
-
-.moin-history-comment
-    width 30%
-
-.moin-action
-    width 2%
-
-.moin-action a:hover
-    text-decoration none
-
-.moin-history-container
-    border border_style
-    margin 2em 2em
-    border-top-left-radius 5px
-    border-top-right-radius 5px
 
-.moin-history-container-header
-    background header_bg_color
-    margin 0px
-    padding 4px
-    color heading_color
-    border-bottom border_style
-    border-top-left-radius 5px
-    border-top-right-radius 5px
-    h2
-        display inline
-        border none
-    a.bookmark-link
-        margin-left 10px
-        color heading_color
-
-.moin-history-container-body
-    margin 0
-    padding 0
-    font-size 1.2em
-    table
-        margin 0
-        border none
-        width 100%
-
-.moin-history-links
-    width 5%
-
-.moin-history-links a
-    display block
-    margin-bottom 4px
-
-.moin-history-editortext,
-.moin-history-links span,
-.moin-history-comment span
-    color font_color
-    display block
-    margin-bottom 5px
 
 .moin-offset-links
     float right
--- a/MoinMoin/themes/modernized/static/css/theme.css	Wed May 06 13:38:38 2015 -0700
+++ b/MoinMoin/themes/modernized/static/css/theme.css	Sun May 10 13:51:39 2015 -0700
@@ -342,27 +342,12 @@
 #preview{border:1px solid #4e7da9;padding:10px 30px 20px 30px;background:url("../img/draft.png");margin-top:.5em}
 .moin-hist-rev input{float:left}
 .moin-hist-rev{margin:0}
-#moin-global-history,#moin-page-history{font-size:75%}
+#moin-page-history{font-size:75%}
 #moin-page-history table{border:1px solid #4e7da9;border-radius:5px;}
 #moin-page-history table thead{border-top-left-radius:5px;border-top-right-radius:5px;}
 #moin-page-history table thead tr th{text-align:center;}
 #moin-page-history table thead tr th input[type="Submit"]{padding:4px 10px;box-shadow:1px 1px 2px #9d9d9b;cursor:pointer;font-size:1em;}
 #moin-page-history table thead tr th input[type="Submit"]:hover{box-shadow:1px 1px 2px #000}
-.moin-history-time{width:10%;text-align:right}
-.moin-history-contenttype{width:18%}
-.moin-history-editorinfo{width:17%}
-.moin-history-comment{width:30%}
-.moin-action{width:2%}
-.moin-action a:hover{text-decoration:none}
-.moin-history-container{border:1px solid #4e7da9;margin:2em 2em;border-top-left-radius:5px;border-top-right-radius:5px}
-.moin-history-container-header{background:#00417f;margin:0;padding:4px;color:#fff;border-bottom:1px solid #4e7da9;border-top-left-radius:5px;border-top-right-radius:5px;}
-.moin-history-container-header h2{display:inline;border:none}
-.moin-history-container-header a.bookmark-link{margin-left:10px;color:#fff}
-.moin-history-container-body{margin:0;padding:0;font-size:1.2em;}
-.moin-history-container-body table{margin:0;border:none;width:100%}
-.moin-history-links{width:5%}
-.moin-history-links a{display:block;margin-bottom:4px}
-.moin-history-editortext,.moin-history-links span,.moin-history-comment span{color:#000;display:block;margin-bottom:5px}
 .moin-offset-links{float:right;margin-right:20px}
 .moin-offset-links a{margin-right:10px;padding:3px 7px;font-size:20px;background:#fff;border:1px groove #4e7da9;border-radius:5px}
 .moin-offset-links a:hover{box-shadow:0 0 12px #9d9d9b}