changeset 2261:a90551dc4b75

Updated fqname support to modify view.
author Ashutosh Singla <ashu1461@gmail.com>
date Wed, 11 Sep 2013 11:03:36 +0530
parents c800c819efc4
children 3542a17d9b05
files MoinMoin/items/__init__.py MoinMoin/templates/modify.html MoinMoin/templates/modify_select_contenttype.html MoinMoin/templates/modify_select_itemtype.html MoinMoin/templates/modify_select_template.html
diffstat 5 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Wed Sep 11 10:42:50 2013 +0530
+++ b/MoinMoin/items/__init__.py	Wed Sep 11 11:03:36 2013 +0530
@@ -743,7 +743,8 @@
         rev_ids = []
         item_templates = self.content.get_templates(self.contenttype)
         return render_template('modify_select_template.html',
-                               item_name=self.fqname.fullname,
+                               item_name=self.name,
+                               fqname=self.fqname,
                                itemtype=self.itemtype,
                                rev=self.rev,
                                contenttype=self.contenttype,
@@ -775,7 +776,8 @@
         if method in ['GET', 'HEAD']:
             if isinstance(self.content, NonExistentContent):
                 return render_template('modify_select_contenttype.html',
-                                       item_name=self.fqname.fullname,
+                                       fqname=self.fqname,
+                                       item_name=self.name,
                                        itemtype=self.itemtype,
                                        group_names=content_registry.group_names,
                                        groups=content_registry.groups,
@@ -811,7 +813,8 @@
                 else:
                     return redirect(url_for_item(**self.fqname.split))
         return render_template(self.modify_template,
-                               item_name=self.fqname.fullname,
+                               fqname=self.fqname,
+                               item_name=self.name,
                                rows_meta=str(ROWS_META), cols=str(COLS),
                                form=form,
                                search_form=None,
--- a/MoinMoin/templates/modify.html	Wed Sep 11 10:42:50 2013 +0530
+++ b/MoinMoin/templates/modify.html	Wed Sep 11 11:03:36 2013 +0530
@@ -10,7 +10,7 @@
 {% set extra_head = content_template.extra_head %}
 {% set data_editor = content_template.data_editor %}
 
-{% set title = _("Modifying '%(item_name)s'", item_name=item_name) %}
+{% set title = _("Modifying '%(item_name)s'", item_name=fqname.value) %}
 
 {% block head %}
     {{ super() }}
--- a/MoinMoin/templates/modify_select_contenttype.html	Wed Sep 11 10:42:50 2013 +0530
+++ b/MoinMoin/templates/modify_select_contenttype.html	Wed Sep 11 11:03:36 2013 +0530
@@ -13,7 +13,7 @@
     <tr>
         <td> |&nbsp;
         {% for e in groups[group] %}
-            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=itemtype, contenttype=Type(e.content_type, parameters=e.default_contenttype_params)|string) }}">{{ e.display_name }}</a> &nbsp;|&nbsp;
+            <a href="{{ url_for('frontend.modify_item', item_name=fqname, itemtype=itemtype, contenttype=Type(e.content_type, parameters=e.default_contenttype_params)|string) }}">{{ e.display_name }}</a> &nbsp;|&nbsp;
         {% endfor %}
         </td>
     </tr>
--- a/MoinMoin/templates/modify_select_itemtype.html	Wed Sep 11 10:42:50 2013 +0530
+++ b/MoinMoin/templates/modify_select_itemtype.html	Wed Sep 11 11:03:36 2013 +0530
@@ -2,13 +2,13 @@
 {% block content %}
 <h1>{{ _("Item not found, create it now?") }}</h1>
 <p>
-{{ _("Item '%(name)s' does not exist (yet), but you can try creating it now. Please select the type of the item you want to create.", name=item_name) }}
+{{ _("Item '%(fqname)s' does not exist (yet), but you can try creating it now. Please select the type of the item you want to create.", fqname=fqname) }}
 </p>
 <table class="zebra">
     {% for e in itemtypes %}
     <tr>
         <td>
-            <a href="{{ url_for('frontend.modify_item', item_name=item_name, itemtype=e.itemtype) }}">{{ e.display_name }}</a> - {{ e.description }}
+            <a href="{{ url_for('frontend.modify_item', item_name=fqname, itemtype=e.itemtype) }}">{{ e.display_name }}</a> - {{ e.description }}
         </td>
     </tr>
     {% endfor %}
--- a/MoinMoin/templates/modify_select_template.html	Wed Sep 11 10:42:50 2013 +0530
+++ b/MoinMoin/templates/modify_select_template.html	Wed Sep 11 11:03:36 2013 +0530
@@ -2,14 +2,13 @@
 {% 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='') ) }}
+{{ _("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=fqname, 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>
+    <a href="{{ url_for('frontend.modify_item', item_name=fqname, itemtype=itemtype, contenttype=contenttype, template=template) }}">{{ template }}</a>
     </li>
     {% endfor %}
 </ul>