changeset 2263:6dd5af01d54d

Sub-items pannel now has fqname support.
author Ashutosh Singla <ashu1461@gmail.com>
date Wed, 11 Sep 2013 14:48:02 +0530
parents 3542a17d9b05
children 8e97ca0b5e83
files MoinMoin/items/__init__.py MoinMoin/templates/modify.html MoinMoin/templates/show.html MoinMoin/templates/utils.html MoinMoin/themes/__init__.py
diffstat 5 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Wed Sep 11 13:17:49 2013 +0530
+++ b/MoinMoin/items/__init__.py	Wed Sep 11 14:48:02 2013 +0530
@@ -635,11 +635,11 @@
         # IndexEntry instances of "directory" subitems
         dirs = []
         added_fullnames = set()
-
         for rev in subitems:
             fullnames = rev.meta[NAME]
             for fullname in fullnames:
                 prefix = self.get_prefix_match(fullname, prefixes)
+                fullname_fqname = CompositeName(self.fqname.namespace, NAME_EXACT, fullname)
                 if not prefix is None:
                     relname = fullname[len(prefix):]
                     if '/' in relname:
@@ -651,11 +651,12 @@
                         if fullname not in added_fullnames:
                             added_fullnames.add(fullname)
                             direct_fullname = prefix + direct_relname
+                            direct_fullname_fqname = CompositeName(self.fqname.namespace, NAME_EXACT, direct_fullname)
                             fqname = split_fqname(direct_fullname)
                             direct_rev = get_storage_revision(fqname)
-                            dirs.append(IndexEntry(direct_relname, direct_fullname, direct_rev.meta))
+                            dirs.append(IndexEntry(direct_relname, direct_fullname_fqname, direct_rev.meta))
                     else:
-                        files.append(IndexEntry(relname, fullname, rev.meta))
+                        files.append(IndexEntry(relname, fullname_fqname, rev.meta))
         return dirs, files
 
     def build_index_query(self, startswith=None, selected_groups=None, isglobalindex=False):
--- a/MoinMoin/templates/modify.html	Wed Sep 11 13:17:49 2013 +0530
+++ b/MoinMoin/templates/modify.html	Wed Sep 11 14:48:02 2013 +0530
@@ -20,7 +20,7 @@
 {% endblock %}
 
 {% block subitem_navigation %}
-    {% call(fullname, shortname, contenttype, has_children) utils.render_subitem_navigation(item_name, True) %}
+    {% call(fullname, shortname, contenttype, has_children) utils.render_subitem_navigation(fqname, True) %}
         {% set shortname = shortname|json_dumps %}
         {% set fullname = fullname|json_dumps %}
         <button class="moin-insertname-action" onclick='InsertName({{ fullname }})'
--- a/MoinMoin/templates/show.html	Wed Sep 11 13:17:49 2013 +0530
+++ b/MoinMoin/templates/show.html	Wed Sep 11 14:48:02 2013 +0530
@@ -37,7 +37,7 @@
 {% endmacro %}
 
 {% block subitem_navigation %}
-    {{ utils.render_subitem_navigation(item_name, False) }}
+    {{ utils.render_subitem_navigation(fqname or item_name, False) }}
 {% endblock %}
 
 {% block content %}
--- a/MoinMoin/templates/utils.html	Wed Sep 11 13:17:49 2013 +0530
+++ b/MoinMoin/templates/utils.html	Wed Sep 11 14:48:02 2013 +0530
@@ -78,9 +78,9 @@
     </ul>
 {% endmacro %}
 
-{% macro render_subitem_navigation(itemname, newtab, subitems=None) %}
+{% macro render_subitem_navigation(fqname, newtab, subitems=None) %}
     {% if not subitems %}
-        {% set subitems = theme_supp.subitem_index(itemname) %}
+        {% set subitems = theme_supp.subitem_index(fqname) %}
     {% endif %}
     {% if caller %}
         {% set mycaller = caller %}
--- a/MoinMoin/themes/__init__.py	Wed Sep 11 13:17:49 2013 +0530
+++ b/MoinMoin/themes/__init__.py	Wed Sep 11 14:48:02 2013 +0530
@@ -132,15 +132,17 @@
                 breadcrumbs.append((wiki_name, fqname, href, exists, err))
         return breadcrumbs
 
-    def subitem_index(self, item_name):
+    def subitem_index(self, fqname):
         """
-        Get a list of subitems for the given item_name
+        Get a list of subitems for the given fqname
 
         :rtype: list
         :returns: list of item tuples (item_name, item_title, item_mime_type, has_children)
         """
         from MoinMoin.items import Item
-        item = Item.create(item_name)
+        if not isinstance(fqname, CompositeName):
+            fqname = split_fqname(fqname)
+        item = Item.create(fqname.fullname)
         return item.get_mixed_index()
 
     def userhome(self):