changeset 1592:640da44961b2

merged
author Jaiditya Mathur <jaiditya.mathur@gmail.com>
date Thu, 02 Aug 2012 02:56:15 +0530
parents 924a3d927018 (current diff) 89a6cda81ffe (diff)
children 0f40eefb12ba
files MoinMoin/templates/modify_select_contenttype.html MoinMoin/templates/modify_show_contenttype_selection.html MoinMoin/templates/modify_show_itemtype_selection.html MoinMoin/templates/modify_show_template_selection.html
diffstat 12 files changed, 74 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/constants/forms.py	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/constants/forms.py	Thu Aug 02 02:56:15 2012 +0530
@@ -16,6 +16,7 @@
 WIDGET_INLINE_CHECKBOX = u'inline_checkbox'
 WIDGET_ANY_INTEGER = u'any_integer'
 WIDGET_SMALL_NATURAL = u'small_natural'
+WIDGET_DATETIME = u'datetime'
 
 WIDGET_FILE = u'file'
 WIDGET_SEARCH = u'search'
--- a/MoinMoin/constants/keys.py	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/constants/keys.py	Thu Aug 02 02:56:15 2012 +0530
@@ -5,6 +5,10 @@
 MoinMoin - meta data key / index field name related constants
 """
 
+# IMPORTANT: until we require a python >= 2.6.5, we need to keep the keys as
+#            str (not unicode), because of "Issue #4978: Passing keyword
+#            arguments as unicode strings is now allowed." (from 2.6.5 chglog)
+
 # metadata keys
 NAME = "name"
 NAME_OLD = "name_old"
--- a/MoinMoin/forms.py	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/forms.py	Thu Aug 02 02:56:15 2012 +0530
@@ -1,3 +1,4 @@
+# Copyright: 2012 MoinMoin:PavelSviderski
 # Copyright: 2012 MoinMoin:CheerXiao
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
@@ -10,7 +11,7 @@
 
 import re
 
-from flatland import Element, Form, String, Integer, Boolean, Enum, Dict, JoinedString
+from flatland import Element, Form, String, Integer, Boolean, Enum, Dict, DateTime as _DateTime, JoinedString
 from flatland.validation import Validator, Present, IsEmail, ValueBetween, URLValidator, Converted, ValueAtLeast
 
 from MoinMoin.constants.forms import *
@@ -64,6 +65,9 @@
 
 SmallNatural = _Integer.with_properties(widget=WIDGET_SMALL_NATURAL)
 
+DateTime = (_DateTime.with_properties(widget=WIDGET_DATETIME, placeholder=_("YYYY-MM-DD HH:MM:SS (example: 2999-12-31 23:59:59)"))
+            .validated_by(Converted(incorrect=L_("Please use the following format: YYYY-MM-DD HH:MM:SS"))))
+
 File = FileStorage.with_properties(widget=WIDGET_FILE)
 
 Submit = String.using(default=L_('OK'), optional=True).with_properties(widget=WIDGET_SUBMIT, class_=CLASS_BUTTON)
--- a/MoinMoin/items/__init__.py	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/items/__init__.py	Thu Aug 02 02:56:15 2012 +0530
@@ -563,7 +563,7 @@
         # call this if the item is still empty
         rev_ids = []
         item_templates = self.content.get_templates(self.contenttype)
-        return render_template('modify_show_template_selection.html',
+        return render_template('modify_select_template.html',
                                item_name=self.name,
                                # XXX u'default' should be a constant
                                itemtype=u'default',
@@ -580,7 +580,7 @@
         method = request.method
         if method == 'GET':
             if isinstance(self.content, NonExistentContent):
-                return render_template('modify_show_contenttype_selection.html',
+                return render_template('modify_select_contenttype.html',
                                        item_name=self.name,
                                        # XXX see comment above
                                        itemtype=u'default',
@@ -661,7 +661,7 @@
             (u'ticket', u'Ticket', 'Ticket item'),
         ]
 
-        return render_template('modify_show_itemtype_selection.html',
+        return render_template('modify_select_itemtype.html',
                                item_name=self.name,
                                itemtypes=ITEMTYPES,
                               )
--- a/MoinMoin/templates/blog_layout.html	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/templates/blog_layout.html	Thu Aug 02 02:56:15 2012 +0530
@@ -19,7 +19,7 @@
         {% endif %}
     </div>
     <div class="moin-blog-entry-content">
-        {{ entry_item._render_data()|safe }} {# rendered blog entry content #}
+        {{ entry_item.content._render_data()|safe }} {# rendered blog entry content #}
     </div>
     <div class="moin-blog-entry-bottominfo">
         {% set tags = entry_item.meta['tags']|sort %}
@@ -52,7 +52,7 @@
 {% endmacro %}
 
 {% if blog_item %}
-    {% set blog_header = blog_item._render_data()|safe %}
+    {% set blog_header = blog_item.content._render_data()|safe %}
     {% set blog_name = blog_item.name %}
     {% set supertags = blog_item.meta['supertags'] %}
 {% endif %}
--- a/MoinMoin/templates/forms.html	Thu Aug 02 02:34:37 2012 +0530
+++ b/MoinMoin/templates/forms.html	Thu Aug 02 02:56:15 2012 +0530
@@ -50,6 +50,7 @@
       'inline_checkbox': inline_checkbox,
       'any_integer': any_integer,
       'small_natural': small_natural,
+      'datetime': datetime,
       'search': search,
       'submit': raw_input,
       'hidden': raw_input,
@@ -131,6 +132,10 @@
     </dd>
 {% endmacro %}
 
+{% macro datetime(field) %}
+  {{ annotated_input(field, 'text') }}
+{% endmacro %}
+
 {% macro search(field) %}
   {{ raw_input(field, id='moin-search-query') }}
 {% endmacro %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/templates/modify_select_contenttype.html	Thu Aug 02 02:56:15 2012 +0530
@@ -0,0 +1,22 @@
+{% extends theme("layout.html") %}
+{% block content %}
+<h1>{{ _("Create new item?") }}</h1>
+<p>
+{# XXX should show itemtype's display name #}
+{{ _("Please select the contenttype of the new %(itemtype)s item.", itemtype=itemtype) }}
+</p>
+<table id="moin-create-table" class="zebra">
+    {% for gname, contenttypes in contenttype_groups %}
+    <tr>
+        <th>{{ gname }}</th>
+    </tr>
+    <tr>
+        <td> |&nbsp
+        {% for ctname, ctlabel in contenttypes %}
+            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=ctname) }}">{{ ctlabel }}</a> &nbsp|&nbsp
+        {% endfor %}
+        </td>
+    </tr>
+    {% endfor %}
+</table>
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/templates/modify_select_itemtype.html	Thu Aug 02 02:56:15 2012 +0530
@@ -0,0 +1,16 @@
+{% extends theme("layout.html") %}
+{% block content %}
+<h1>{{ _("Create new item?") }}</h1>
+<p>
+{{ _("This item does not exist (yet), but you can try creating it now. Please select the type of the item you want to create.") }}
+</p>
+<table class="zebra">
+    {% for itname, itlabel, itdesc in itemtypes %}
+    <tr>
+        <td>
+            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itname) }}">{{ itlabel }}</a> - {{ itdesc }}
+        </td>
+    </tr>
+    {% endfor %}
+</table>
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/templates/modify_select_template.html	Thu Aug 02 02:56:15 2012 +0530
@@ -0,0 +1,16 @@
+{% extends theme("layout.html") %}
+{% block content %}
+<h1>{{ _("Create new item?") }}</h1>
+<p>
+{{ _("You can either <a href='%(modifyhref)s'>create the item from scratch</a> or select a template.",
+modifyhref=url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=contenttype, template='') ) }}
+</p>
+<h2>{{ _("Available template items") }}</h2>
+<ul>
+    {% for template in templates %}
+    <li>
+    <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=contenttype, template=template) }}">{{ template }}</a>
+    </li>
+    {% endfor %}
+</ul>
+{% endblock %}
--- a/MoinMoin/templates/modify_show_contenttype_selection.html	Thu Aug 02 02:34:37 2012 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-{% extends theme("layout.html") %}
-{% block content %}
-<h1>{{ _("Create new item?") }}</h1>
-<p>
-{# XXX should show itemtype's display name #}
-{{ _("Please select the contenttype of the new %(itemtype)s item.", itemtype=itemtype) }}
-</p>
-<table id="moin-create-table" class="zebra">
-    {% for gname, contenttypes in contenttype_groups %}
-    <tr>
-        <th>{{ gname }}</th>
-    </tr>
-    <tr>
-        <td> |&nbsp
-        {% for ctname, ctlabel in contenttypes %}
-            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=ctname) }}">{{ ctlabel }}</a> &nbsp|&nbsp
-        {% endfor %}
-        </td>
-    </tr>
-    {% endfor %}
-</table>
-{% endblock %}
--- a/MoinMoin/templates/modify_show_itemtype_selection.html	Thu Aug 02 02:34:37 2012 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-{% extends theme("layout.html") %}
-{% block content %}
-<h1>{{ _("Create new item?") }}</h1>
-<p>
-{{ _("This item does not exist (yet), but you can try creating it now. Please select the type of the item you want to create.") }}
-</p>
-<table class="zebra">
-    {% for itname, itlabel, itdesc in itemtypes %}
-    <tr>
-        <td>
-            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itname) }}">{{ itlabel }}</a> - {{ itdesc }}
-        </td>
-    </tr>
-    {% endfor %}
-</table>
-{% endblock %}
--- a/MoinMoin/templates/modify_show_template_selection.html	Thu Aug 02 02:34:37 2012 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-{% extends theme("layout.html") %}
-{% block content %}
-<h1>{{ _("Create new item?") }}</h1>
-<p>
-{{ _("You can either <a href='%(modifyhref)s'>create the item from scratch</a> or select a template.",
-modifyhref=url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=contenttype, template='') ) }}
-</p>
-<h2>{{ _("Available template items") }}</h2>
-<ul>
-    {% for template in templates %}
-    <li>
-    <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=contenttype, template=template) }}">{{ template }}</a>
-    </li>
-    {% endfor %}
-</ul>
-{% endblock %}