changeset 483:4307261bac75

item index view modified
author Akash Sinha <akash2607@gmail.com>
date Fri, 08 Jul 2011 17:15:53 +0530
parents 55c1d404dd12
children 19b257c0e102
files MoinMoin/apps/frontend/views.py MoinMoin/templates/index.html MoinMoin/themes/modernized/static/css/common.css
diffstat 3 files changed, 52 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Thu Jul 07 18:57:49 2011 +0530
+++ b/MoinMoin/apps/frontend/views.py	Fri Jul 08 17:15:53 2011 +0530
@@ -477,9 +477,25 @@
     except AccessDeniedError:
         abort(403)
     index = item.flat_index()
+
+    index_more_links = []
+    all_item_index = item.get_index()
+    all_item_text = "\n".join(item_info[1] for item_info in all_item_index)
+    for fullname, relname, contenttype in index:
+        hassubitem = False
+        subitem_name_re = u"%s/" % re.escape(relname)
+        regex = re.compile(subitem_name_re, re.UNICODE)
+        if regex.search(all_item_text):
+            hassubitem = True
+        index_more_links.append((fullname, relname, contenttype, hassubitem))
+    index_more_links.sort()
+    split_char = u'/'
+    item_names = item_name.split(split_char)
+
     return render_template(item.index_template,
                            item=item, item_name=item_name,
-                           index=index,
+                           index=index_more_links,
+                           item_names=item_names
                           )
 
 
--- a/MoinMoin/templates/index.html	Thu Jul 07 18:57:49 2011 +0530
+++ b/MoinMoin/templates/index.html	Fri Jul 08 17:15:53 2011 +0530
@@ -2,16 +2,35 @@
 
 {% block content %}
     <h1>{{ _("Index of subitems of '%(item_name)s'", item_name=item_name) }}</h1>
+    <div class="moin-index-path">
+    <a href="{{ url_for('frontend.global_index') }}" title="{{ _("Global Index") }}">{{ ("..") }}</a>
+    <span class="moin-path-separator">{{ ("/") }}</span>
+    {% 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>
+        <span class="moin-path-separator">{{ ("/") }}</span>
+    {% endfor %}
+    </div>
     {% if index %}
-        <ul>
-        {% for fullname, relname, contenttype in index %}
-            <li>
-                <a href="{{ url_for('.show_item', item_name=fullname) }}"
-                   class="{{ contenttype|contenttype_to_class }}">
-                    {{ relname }}
+    <div id="moin-item-index">
+        {% set maxchars = 20 %}
+        {% for fullname, relname, contenttype, hassubitem in index %}
+            <div>
+                <a href="{{ url_for('.show_item', item_name=fullname) }}" 
+                   class="{{ contenttype|contenttype_to_class }}"
+                   title="{{ relname }}">
+                   {{ relname|truncate(maxchars, true, '..') }}
                 </a>
-            </li>
+                {% if hassubitem %}
+                    <a href="{{ url_for('frontend.index', item_name=fullname) }}" 
+                       title="{{ _("More") }}"
+                       class="moin-more-index">
+                </a>
+                {% endif %}
+            </div>
         {% endfor %}
-        </ul>
+    </div>
+    <div class="moin-clr"></div>
     {% endif %}
 {% endblock %}
--- a/MoinMoin/themes/modernized/static/css/common.css	Thu Jul 07 18:57:49 2011 +0530
+++ b/MoinMoin/themes/modernized/static/css/common.css	Fri Jul 08 17:15:53 2011 +0530
@@ -240,14 +240,19 @@
 .moin-offset-links a:hover { box-shadow: 0px 0px 12px #81BBF2; }
 .moin-clr { clear: both; }
 
-/* global index page */
+/* global(item) index page */
 #moin-letters { width: 90%; margin: 5px auto; text-align: center; }
 #moin-letters a { display: inline-block; margin: 0; padding: 4px 5px; }
 #moin-letters a:hover,
 #moin-letters a.selected { background: #4477FF; border-radius: 5px; color: #FFFFFF; text-decoration: none; }
-#moin-global-index { width: 100%; margin-left: 0.5em; }
-#moin-global-index div { float: left; width: 15em; }
+#moin-global-index,
+#moin-item-index { width: 100%; margin-left: 0.5em; }
+#moin-global-index div,
+#moin-item-index div { float: left; width: 15em; }
 .moin-more-index:before { content: url("../img/moin-expand.png"); }
+.moin-index-path { margin-left: 0.5em; }
+.moin-index-path:before { content: url("../img/moin-parent.png"); margin: 0 0.3em; }
+.moin-path-separator { font-size: 120%; color: #4477FF; }
 
 /* diffs */
 .moin-diff { width:99%; table-layout: fixed; }