changeset 2265:6f45a748fef8

Updated fqname support to index view, also added namespace all identifier to it.
author Ashutosh Singla <ashu1461@gmail.com>
date Wed, 11 Sep 2013 19:22:31 +0530
parents 8e97ca0b5e83
children dea5f965ae8b
files MoinMoin/apps/frontend/views.py MoinMoin/items/__init__.py MoinMoin/templates/index.html
diffstat 3 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Wed Sep 11 18:58:08 2013 +0530
+++ b/MoinMoin/apps/frontend/views.py	Wed Sep 11 19:22:31 2013 +0530
@@ -822,13 +822,14 @@
 
     initials = item.name_initial(item.get_subitem_revs(), uppercase=True)
 
-    dirs, files = item.get_index(startswith, selected_groups, isglobalindex=not item_name)
+    dirs, files = item.get_index(startswith, selected_groups)
     # index = sorted(index, key=lambda e: e.relname.lower())
 
     item_names = item_name.split(u'/')
     return render_template(item.index_template,
                            item_names=item_names,
                            item_name=item_name,
+                           fqname=item.fqname,
                            files=files,
                            dirs=dirs,
                            initials=initials,
--- a/MoinMoin/items/__init__.py	Wed Sep 11 18:58:08 2013 +0530
+++ b/MoinMoin/items/__init__.py	Wed Sep 11 19:22:31 2013 +0530
@@ -51,6 +51,7 @@
     HASH_ALGORITHM, ITEMID, REVID, DATAID, CURRENT, PARENTID, NAMESPACE,
     UFIELDS_TYPELIST, UFIELDS, TRASH,
 )
+from MoinMoin.constants.namespaces import NAMESPACE_ALL
 from MoinMoin.constants.contenttypes import CHARSET, CONTENTTYPE_NONEXISTENT
 from MoinMoin.constants.itemtypes import (
     ITEMTYPE_NONEXISTENT, ITEMTYPE_USERPROFILE, ITEMTYPE_DEFAULT,
@@ -678,8 +679,12 @@
 
         return query
 
-    def get_index(self, startswith=None, selected_groups=None, isglobalindex=False):
+    def get_index(self, startswith=None, selected_groups=None):
+        fqname = self.fqname
+        isglobalindex = not fqname.value or fqname.value == NAMESPACE_ALL
         query = Term(WIKINAME, app.cfg.interwikiname) & self.build_index_query(startswith, selected_groups, isglobalindex)
+        if not fqname.value.startswith(NAMESPACE_ALL+'/') and fqname.value != NAMESPACE_ALL:
+            query = Term(NAMESPACE, fqname.namespace)
         revs = flaskg.storage.search(query, sortedby=NAME_EXACT, limit=None)
         return self.make_flat_index(revs, isglobalindex)
 
--- a/MoinMoin/templates/index.html	Wed Sep 11 18:58:08 2013 +0530
+++ b/MoinMoin/templates/index.html	Wed Sep 11 19:22:31 2013 +0530
@@ -120,7 +120,11 @@
             {% for i in range(0, item_names|count) %}
                 {% set fullname = item_names[:i+1]|join('/') %}
                 {% set relname = item_names[i] %}
-                <a href="{{ url_for('frontend.index', item_name=fullname) }}" title="{{ relname }}">{{ relname }}</a>
+                {% if relname.startswith('@') %}
+                    {{ relname }}
+                {% else %}
+                    <a href="{{ url_for('frontend.index', item_name=fullname) }}" title="{{ relname }}">{{ relname }}</a>
+                {% endif %}
                 <span class="moin-path-separator">{{ ("/") }}</span>
             {% endfor %}
         </div>