changeset 2720:0365115d5699

Merged thomaswaldmann/moin-2.0 into default
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Fri, 15 Aug 2014 00:13:56 +0530
parents ae9dc67fc056 (diff) b8680cd6cf91 (current diff)
children 81dd9e00bac1
files MoinMoin/items/__init__.py MoinMoin/themes/basic/static/css/theme.css MoinMoin/themes/basic/static/custom-less/theme.less MoinMoin/themes/basic/templates/layout.html MoinMoin/themes/foobar/templates/layout.html
diffstat 15 files changed, 126 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/apps/frontend/views.py	Fri Aug 15 00:13:56 2014 +0530
@@ -53,7 +53,7 @@
                             RequiredPassword, Checkbox, InlineCheckbox, Select, Names,
                             Tags, Natural, Hidden, MultiSelect, Enum, Subscriptions,
                             validate_name, NameNotValidError)
-from MoinMoin.items import BaseChangeForm, Item, NonExistent, NameNotUniqueError, FieldNotUniqueError
+from MoinMoin.items import BaseChangeForm, Item, NonExistent, NameNotUniqueError, FieldNotUniqueError, get_itemtype_specific_tags
 from MoinMoin.items.content import content_registry
 from MoinMoin import user, util
 from MoinMoin.constants.keys import *
@@ -2298,7 +2298,7 @@
         elif time_sorting == u'old':
             sortedby.append(sorting.FieldFacet(u'mtime', reverse=False))
         results = searcher.search(q, limit=None, sortedby=sortedby)
-        tags = list(searcher.field_terms(TAGS))
+        tags = get_itemtype_specific_tags(ITEMTYPE_TICKET)
         return render_template('tickets.html',
                                results=results,
                                query=query,
--- a/MoinMoin/items/__init__.py	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/items/__init__.py	Fri Aug 15 00:13:56 2014 +0530
@@ -51,7 +51,7 @@
     CONTENTTYPE, SIZE, ACTION, ADDRESS, HOSTNAME, USERID, COMMENT, USERGROUP,
     HASH_ALGORITHM, ITEMID, REVID, DATAID, CURRENT, PARENTID, NAMESPACE, IMMUTABLE_KEYS,
     UFIELDS_TYPELIST, UFIELDS, TRASH,
-    ACTION_SAVE, ACTION_REVERT, ACTION_TRASH, ACTION_RENAME
+    ACTION_SAVE, ACTION_REVERT, ACTION_TRASH, ACTION_RENAME, TAGS, LATEST_REVS
 )
 from MoinMoin.constants.namespaces import NAMESPACE_ALL
 from MoinMoin.constants.contenttypes import CHARSET, CONTENTTYPE_NONEXISTENT
@@ -267,6 +267,18 @@
 MixedIndexEntry = namedtuple('MixedIndexEntry', 'relname fullname meta hassubitems')
 
 
+def get_itemtype_specific_tags(itemtype):
+    """
+    Returns the tags of a specific itemtype
+    """
+    with flaskg.storage.indexer.ix[LATEST_REVS].searcher() as searcher:
+        items = searcher.search(Term(ITEMTYPE, itemtype), limit=None)
+        tags = set()
+        for item in items:
+            tags.update(item[TAGS])
+        return tags
+
+
 class NameNotUniqueError(ValueError):
     """
     An item with the same name exists.
--- a/MoinMoin/items/blog.py	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/items/blog.py	Fri Aug 15 00:13:56 2014 +0530
@@ -91,6 +91,7 @@
                                blog_item=self,
                                blog_entry_items=blog_entry_items,
                                tag=tag,
+                               item=self,
                               )
 
 
@@ -127,4 +128,5 @@
                                fqname=blog_item.fqname,
                                blog_item=blog_item,
                                blog_entry_item=self,
+                               item=self,
                               )
--- a/MoinMoin/items/ticket.py	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/items/ticket.py	Fri Aug 15 00:13:56 2014 +0530
@@ -25,9 +25,8 @@
 from MoinMoin.constants.keys import (ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT,
                                      SUPERSEDED_BY, SUBSCRIPTIONS, DEPENDS_ON, NAME, SUMMARY)
 from MoinMoin.constants.contenttypes import CONTENTTYPE_USER
-from MoinMoin.items import Item, Contentful, register, BaseModifyForm
+from MoinMoin.items import Item, Contentful, register, BaseModifyForm, get_itemtype_specific_tags
 from MoinMoin.items.content import NonExistentContent
-from MoinMoin.constants.keys import LATEST_REVS, TAGS
 
 
 ITEMTYPE_TICKET = u'ticket'
@@ -190,19 +189,19 @@
                 except AccessDenied:
                     abort(403)
                 else:
-                    return redirect(url_for('.show_item', item_name=self.name))
+                    return redirect(url_for('.show_item', item_name=self.fqname))
 
         # XXX When creating new item, suppress the "foo doesn't exist. Create it?" dummy content
         data_rendered = None if is_new else Markup(self.content._render_data())
-        with flaskg.storage.indexer.ix[LATEST_REVS].searcher() as searcher:
-            suggested_tags = list(searcher.field_terms(TAGS))
 
-            return render_template(self.submit_template if is_new else self.modify_template,
-                                   is_new=is_new,
-                                   closed=closed,
-                                   item_name=self.name,
-                                   data_rendered=data_rendered,
-                                   form=form,
-                                   suggested_tags=suggested_tags,
-                                   item=self,
-                                  )
+        suggested_tags = get_itemtype_specific_tags(ITEMTYPE_TICKET)
+
+        return render_template(self.submit_template if is_new else self.modify_template,
+                               is_new=is_new,
+                               closed=closed,
+                               item_name=self.name,
+                               data_rendered=data_rendered,
+                               form=form,
+                               suggested_tags=suggested_tags,
+                               item=self,
+                              )
--- a/MoinMoin/static/css/stylus/ticket.styl	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/static/css/stylus/ticket.styl	Fri Aug 15 00:13:56 2014 +0530
@@ -1,9 +1,7 @@
 #moin-ticket-form
     dd
-        width 80%
         margin-top 0.1em
     dt
-        width 15%
         margin-top 0.1em
 
 fields = (effort difficulty severity priority)
@@ -78,7 +76,7 @@
 input[type=submit], #f_submit_update, #f_submit_update_negate_status
     margin-top 10px
     margin-bottom 20px
-    width 150px
+    width auto
     background-color #1b436d
     height 40px
     color #ffffff
@@ -98,3 +96,24 @@
     line-height 1.42857143
     border-radius 4px
     -webkit-user-select none
+
+.moin-ticket-comments
+    float right
+    width 50%
+
+.moin-ticket-metadata
+    float left
+    width 50%
+
+#f_message
+    width 100%
+    height 150px
+
+h2
+    border-bottom none
+
+dt label
+    padding-top 10px
+
+dl dd
+    padding-bottom 10px
--- a/MoinMoin/static/css/ticket.css	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/static/css/ticket.css	Fri Aug 15 00:13:56 2014 +0530
@@ -1,10 +1,16 @@
-#moin-ticket-form dd{width:80%;margin-top:.1em}
-#moin-ticket-form dt{width:15%;margin-top:.1em}
+#moin-ticket-form dd{margin-top:.1em}
+#moin-ticket-form dt{margin-top:.1em}
 #f_meta_effort_1, #f_meta_difficulty_1, #f_meta_severity_1, #f_meta_priority_1, #f_meta_effort_2, #f_meta_difficulty_2, #f_meta_severity_2, #f_meta_priority_2, #f_meta_effort_3, #f_meta_difficulty_3, #f_meta_severity_3, #f_meta_priority_3, #f_meta_effort_4, #f_meta_difficulty_4, #f_meta_severity_4, #f_meta_priority_4, #f_meta_effort_5, #f_meta_difficulty_5, #f_meta_severity_5, #f_meta_priority_5{display:none}
 #f_meta_effort_1 + label.moin-inline-label, #f_meta_difficulty_1 + label.moin-inline-label, #f_meta_severity_1 + label.moin-inline-label, #f_meta_priority_1 + label.moin-inline-label, #f_meta_effort_2 + label.moin-inline-label, #f_meta_difficulty_2 + label.moin-inline-label, #f_meta_severity_2 + label.moin-inline-label, #f_meta_priority_2 + label.moin-inline-label, #f_meta_effort_3 + label.moin-inline-label, #f_meta_difficulty_3 + label.moin-inline-label, #f_meta_severity_3 + label.moin-inline-label, #f_meta_priority_3 + label.moin-inline-label, #f_meta_effort_4 + label.moin-inline-label, #f_meta_difficulty_4 + label.moin-inline-label, #f_meta_severity_4 + label.moin-inline-label, #f_meta_priority_4 + label.moin-inline-label, #f_meta_effort_5 + label.moin-inline-label, #f_meta_difficulty_5 + label.moin-inline-label, #f_meta_severity_5 + label.moin-inline-label, #f_meta_priority_5 + label.moin-inline-label{padding-left:25px;padding-right:10px;height:20px;display:inline-block;line-height:20px;background-repeat:no-repeat;background-position:0 0;font-size:20px;vertical-align:middle;cursor:pointer}
 #f_meta_effort_1:checked + label.moin-inline-label, #f_meta_difficulty_1:checked + label.moin-inline-label, #f_meta_severity_1:checked + label.moin-inline-label, #f_meta_priority_1:checked + label.moin-inline-label, #f_meta_effort_2:checked + label.moin-inline-label, #f_meta_difficulty_2:checked + label.moin-inline-label, #f_meta_severity_2:checked + label.moin-inline-label, #f_meta_priority_2:checked + label.moin-inline-label, #f_meta_effort_3:checked + label.moin-inline-label, #f_meta_difficulty_3:checked + label.moin-inline-label, #f_meta_severity_3:checked + label.moin-inline-label, #f_meta_priority_3:checked + label.moin-inline-label, #f_meta_effort_4:checked + label.moin-inline-label, #f_meta_difficulty_4:checked + label.moin-inline-label, #f_meta_severity_4:checked + label.moin-inline-label, #f_meta_priority_4:checked + label.moin-inline-label, #f_meta_effort_5:checked + label.moin-inline-label, #f_meta_difficulty_5:checked + label.moin-inline-label, #f_meta_severity_5:checked + label.moin-inline-label, #f_meta_priority_5:checked + label.moin-inline-label{background-position:0 -20px}
 label.moin-inline-label{background-image:url("../img/radiobutton.png")}
 #f_meta_tags,#f_meta_summary{-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-ms-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;outline:none;width:200px;margin-top:20px;margin-bottom:20px;height:25px;padding:3px 0 3px 3px;margin:5px 1px 3px 0;border:1px solid #ddd}
 #f_meta_tags:focus,#f_meta_summary:focus{box-shadow:0 0 5px #51cbee;margin-top:20px;margin-bottom:20px;height:25px;padding:3px 0 3px 3px;margin:5px 1px 3px 0;border:1px solid #51cbee}
-input[type=submit],#f_submit_update,#f_submit_update_negate_status{margin-top:10px;margin-bottom:20px;width:150px;background-color:#1b436d;height:40px;color:#fff;border:2px solid}
+input[type=submit],#f_submit_update,#f_submit_update_negate_status{margin-top:10px;margin-bottom:20px;width:auto;background-color:#1b436d;height:40px;color:#fff;border:2px solid}
 select{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;cursor:pointer;border:1px solid;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none}
+.moin-ticket-comments{float:right;width:50%}
+.moin-ticket-metadata{float:left;width:50%}
+#f_message{width:100%;height:150px}
+h2{border-bottom:none}
+dt label{padding-top:10px}
+dl dd{padding-bottom:10px}
--- a/MoinMoin/static/js/tickets.js	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/static/js/tickets.js	Fri Aug 15 00:13:56 2014 +0530
@@ -12,4 +12,6 @@
     }
   });
 
+  $('.moin-loginsettings').addClass('navbar-right');
+
 });
--- a/MoinMoin/templates/ticket/base.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/templates/ticket/base.html	Fri Aug 15 00:13:56 2014 +0530
@@ -110,13 +110,15 @@
 <div class="moin-form" id="moin-ticket-form">
     {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
 
-    {% if data_rendered %}
-        <div id="moin-content-data">
+    <div id="moin-content-data" class="moin-ticket-comments">
+        {% if data_rendered %}
             {{ data_rendered }}
-        </div>
-    {% endif %}
+        {% endif %}
 
-    {% block form_controls %}
+        {% block form_controls %}
+        {% endblock %}
+    </div>
+    {% block ticket_metadata %}
     {% endblock %}
 
     {{ gen.form.close() }}
--- a/MoinMoin/templates/ticket/modify.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/templates/ticket/modify.html	Fri Aug 15 00:13:56 2014 +0530
@@ -1,32 +1,36 @@
 {% extends "ticket/base.html" %}
 
 {% block title_text %}
-    {{ _("Ticket: '%(item_name)s'", item_name=item_name) }}
+    {{ _("Ticket: %(summary)s", summary=item.meta['summary']) }}
 {% endblock %}
 
 {% block form_controls %}
     <h2>{{ _("Add comment") }}</h2>
-    <dl>
-    {{ forms.render(form['message']) }}
-    </dl>
+    <div class="form-group">
+        {{ gen.textarea(form['message'], class='form-control') }}
+    </div>
 
-    <h2>{{ _("Edit metadata") }}</h2>
-    <dl>
-    {{ forms.render_errors(form) }}
-    {{ render_meta() }}
-    </dl>
-    {{ _("Suggested Tags: ") }}
-    {% for suggested_tag in suggested_tags %}
-        {{ suggested_tag }}
-    {% endfor %}
-    <dl>
-    {{ render_selectlists() }}
-    </dl>
+{% endblock %}
 
-    {{ forms.render(form['submit']) }}
+{% block ticket_metadata %}
+    <div class="moin-ticket-metadata">
+        <h2>{{ _("Edit metadata") }}</h2>
+        <dl>
+            {{ forms.render_errors(form) }}
+            {{ render_meta() }}
+        </dl>
+            {{ _("Suggested Tags: ") }}
+            {% for suggested_tag in suggested_tags %}
+                {{ suggested_tag }}
+            {% endfor %}
+        <dl>
+            {{ render_selectlists() }}
+        </dl>
 
-    <h2>{{ _("Back references") }}</h2>
-    <dl>
-    {{ render_backref() }}
-    </dl>
+        {{ forms.render(form['submit']) }}
+        <h2>{{ _("Back references") }}</h2>
+        <dl>
+            {{ render_backref() }}
+        </dl>
+    </div>
 {% endblock %}
--- a/MoinMoin/templates/ticket/submit.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/templates/ticket/submit.html	Fri Aug 15 00:13:56 2014 +0530
@@ -1,15 +1,20 @@
 {% extends "ticket/base.html" %}
 
 {% block title_text %}
-    {{ _("Creating new ticket: '%(item_name)s'", item_name=item_name) }}
+    {{ _("Create new ticket") }}
 {% endblock %}
 
 {% block form_controls %}
     <h2>{{ _("Describe the ticket") }}</h2>
 
     <dl>
-    {{ forms.render(form['message']) }}
+        <div class="form-group">
+            {{ gen.label(form['message']) }}
+            {{ gen.textarea(form['message'], class='form-control') }}
+        </div>
     </dl>
+{% endblock %}
+{% block ticket_metadata %}
 
     <h2>{{ _("Provide metadata") }}</h2>
     <dl>
--- a/MoinMoin/templates/tickets.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/templates/tickets.html	Fri Aug 15 00:13:56 2014 +0530
@@ -27,14 +27,22 @@
     </button>
     <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
         <li role="presentation">
-            <a role="menuitem" tabindex="-1" href="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='new') }}">
-                {{_("Recently updated")}}
-            </a>
+            <form action="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='new') }}" method="post">
+                <input type="hidden" name="status" value="{{ status }}">
+                <input type="hidden" name="q" value="{{ query if query }}" >
+                <button type="submit">
+                    {{_("Recently updated")}}
+                </button>
+            </form>
         </li>
         <li role="presentation">
-            <a role="menuitem" tabindex="-1" href="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='old') }}">
-                {{_("Least recently updated")}}
-            </a>
+            <form action="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='old') }}" method="post">
+                <input type="hidden" name="status" value="{{ status }}">
+                <input type="hidden" name="q" value="{{ query if query }}" >
+                <button type="submit">
+                    {{_("Least Recently updated")}}
+                </button>
+            </form>
         </li>
     </ul>
 </div>
--- a/MoinMoin/themes/basic/static/css/theme.css	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/themes/basic/static/css/theme.css	Fri Aug 15 00:13:56 2014 +0530
@@ -6959,7 +6959,6 @@
 #ticket-list tr td,
 #ticket-list thead th {
   cursor: pointer;
-  padding-left: 20px;
 }
 #ticket-list tr td:first-child a {
   font-family: monospace;
@@ -7020,7 +7019,7 @@
 #moin-ticket-create-link {
   display: inline;
   position: absolute;
-  right: 100px;
+  right: 90px;
   top: 40px;
 }
 #moin-ticket-create-link button {
--- a/MoinMoin/themes/basic/static/custom-less/theme.less	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/themes/basic/static/custom-less/theme.less	Fri Aug 15 00:13:56 2014 +0530
@@ -684,7 +684,6 @@
 }
 #ticket-list tr td, #ticket-list thead th {
   cursor: pointer;
-  padding-left: 20px;
 }
 #ticket-list tr td:first-child a {
   font-family: monospace;
@@ -744,7 +743,7 @@
 #moin-ticket-create-link {
   display: inline;
   position: absolute;
-  right: 100px;
+  right: 90px;
   top: 40px;
 }
 #moin-ticket-create-link button {
--- a/MoinMoin/themes/basic/templates/layout.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/themes/basic/templates/layout.html	Fri Aug 15 00:13:56 2014 +0530
@@ -160,7 +160,7 @@
                             {% else %}
                                 <li>
                                     <h4 class="moin-location-breadcrumb">
-                                    {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(item_name) -%}
+                                    {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(fqname) -%}
                                         {% if loop.first %}
                                             <small>~ /</small>
                                         {% elif not loop.last %}
--- a/MoinMoin/themes/foobar/templates/layout.html	Thu Aug 14 21:45:02 2014 +0530
+++ b/MoinMoin/themes/foobar/templates/layout.html	Fri Aug 15 00:13:56 2014 +0530
@@ -39,18 +39,18 @@
         {% if trail_items %}
         <li id="moin-trail">Trail
             <ul>
-            {% for wiki_name, item_name, item_href, exists, err in trail_items %}
+            {% for wiki_name, fqname, item_href, exists, err in trail_items %}
                 <li>
                 {%- if wiki_name -%}
                     <a href="{{ item_href }}"{{ " " }}
                        title="{{ wiki_name }}"
                        class="{% if err %}moin-badinterwiki{% else %}moin-interwiki{% endif %}">
-                       {{ item_name|shorten_item_name }}
+                       {{ fqname|shorten_fqname }}
                     </a>
                 {%- else -%}
-                    <a href="{{ url_for('frontend.show_item', item_name=item_name) }}"{{ " " }}
+                    <a href="{{ url_for('frontend.show_item', item_name=fqname) }}"{{ " " }}
                        {% if not exists -%}class="moin-nonexistent"{%- endif -%}>
-                       {{ item_name|shorten_item_name }}
+                       {{ fqname|shorten_fqname }}
                     </a>
                 {%- endif %}
                 </li>
@@ -118,10 +118,10 @@
         <span id="moin-pagelocation">
             <span class="moin-pagepath">
             {% block pagepath %}
-                {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(item_name) -%}
+                {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(fqname) -%}
                     {% if not loop.last -%}
                         <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
-                            {{ segment_name|shorten_item_name }}
+                            {{ segment_name|shorten_fqname }}
                         </a>
                         <span class="sep">/</span>
                     {% else %}
@@ -129,7 +129,7 @@
                             {{ title_name }}
                         {% else %}
                         <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
-                            {{ segment_name|shorten_item_name }}
+                            {{ segment_name|shorten_fqname }}
                         </a>
                         {%- endif %}
                     {%- endif %}