changeset 1007:0e285910600d

merged
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 29 Oct 2011 03:17:33 -0200
parents c36f61f85e97 (current diff) b65a998fab8e (diff)
children fc85c7c88c14 d311c9f841b2
files MoinMoin/apps/frontend/views.py
diffstat 3 files changed, 37 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/admin/views.py	Sat Oct 29 02:14:29 2011 -0200
+++ b/MoinMoin/apps/admin/views.py	Sat Oct 29 03:17:33 2011 -0200
@@ -27,7 +27,7 @@
 
 @admin.route('/')
 def index():
-    return render_template('admin/index.html', item_name="+admin")
+    return render_template('admin/index.html', title_name=_(u"Admin"))
 
 
 @admin.route('/userbrowser')
@@ -45,7 +45,7 @@
                           groups=[groupname for groupname in groups if doc[NAME] in groups[groupname]],
                      )
                      for doc in docs]
-    return render_template('admin/userbrowser.html', user_accounts=user_accounts, item_name="+admin/Userbrowser")
+    return render_template('admin/userbrowser.html', user_accounts=user_accounts, title_name=_(u"User Browser"))
 
 
 @admin.route('/userprofile/<user_name>', methods=['GET', 'POST', ])
@@ -101,7 +101,7 @@
         action = 'syspages_upgrade'
         label = 'Upgrade System Pages'
         return render_template('admin/sysitems_upgrade.html',
-                               item_name="+admin/System items upgrade")
+                               title_name=_(u"System items upgrade"))
     if request.method == 'POST':
         xmlfile = request.files.get('xmlfile')
         try:
@@ -156,7 +156,7 @@
 
     found.sort()
     return render_template('admin/wikiconfig.html',
-                           item_name="+admin/wikiconfig",
+                           title_name=_(u"Wiki Configuration"),
                            found=found, settings=settings)
 
 
@@ -185,7 +185,7 @@
         groups.append((heading, desc, opts))
     groups.sort()
     return render_template('admin/wikiconfighelp.html',
-                           item_name="+admin/wikiconfighelp",
+                           title_name=_(u"Wiki Configuration Help"),
                            groups=groups)
 
 
@@ -202,7 +202,7 @@
     rows = sorted([[desc, ' '.join(names), ' '.join(patterns), ' '.join(mimetypes), ]
                    for desc, names, patterns, mimetypes in lexers])
     return render_template('admin/highlighterhelp.html',
-                           item_name="+admin/highlighterhelp",
+                           title_name=_(u"Highlighter Help"),
                            headings=headings,
                            rows=rows)
 
@@ -215,7 +215,7 @@
                ]
     rows = sorted(app.cfg.interwiki_map.items())
     return render_template('admin/interwikihelp.html',
-                           item_name="+admin/interwikihelp",
+                           title_name=_(u"Interwiki Help"),
                            headings=headings,
                            rows=rows)
 
@@ -230,7 +230,7 @@
             for rev in flaskg.storage.documents(wikiname=app.cfg.interwikiname)]
     rows = sorted(rows, reverse=True)
     return render_template('admin/itemsize.html',
-                           item_name="+admin/itemsize",
+                           title_name=_(u"Item Size"),
                            headings=headings,
                            rows=rows)
 
--- a/MoinMoin/apps/frontend/views.py	Sat Oct 29 02:14:29 2011 -0200
+++ b/MoinMoin/apps/frontend/views.py	Sat Oct 29 03:17:33 2011 -0200
@@ -147,6 +147,7 @@
 
 @frontend.route('/+search', methods=['GET', 'POST'])
 def search():
+    title_name = _("Search")
     search_form = SearchForm.from_flat(request.values)
     valid = search_form.validate()
     search_form['submit'].set_default() # XXX from_flat() kills all values
@@ -178,14 +179,14 @@
                                    content_suggestions=content_suggestions,
                                    query=query,
                                    medium_search_form=search_form,
-                                   item_name='+search', # XXX
+                                   title_name=title_name,
                                   )
             flaskg.clock.stop('search render')
     else:
         html = render_template('search.html',
                                query=query,
                                medium_search_form=search_form,
-                               item_name='+search', # XXX
+                               title_name=title_name,
                               )
     return html
 
@@ -668,7 +669,7 @@
     """
     my_changes = _mychanges(flaskg.user.itemid)
     return render_template('item_link_list.html',
-                           item_name='+mychanges', # XXX
+                           title_name=_(u'My Changes'),
                            headline=_(u'My Changes'),
                            item_names=my_changes
                           )
@@ -944,7 +945,7 @@
 
 @frontend.route('/+register', methods=['GET', 'POST'])
 def register():
-    item_name = 'Register' # XXX
+    title_name = _(u'Register')
     # is openid_submit in the form?
     isOpenID = 'openid_submit' in request.values
 
@@ -1005,7 +1006,7 @@
                     return redirect(url_for('.show_root'))
 
     return render_template(template,
-                           item_name=item_name,
+                           title_name=title_name,
                            form=form,
                           )
 
@@ -1038,7 +1039,7 @@
 @frontend.route('/+lostpass', methods=['GET', 'POST'])
 def lostpass():
     # TODO use ?next=next_location check if target is in the wiki and not outside domain
-    item_name = 'LostPass' # XXX
+    title_name = _(u'Lost Pass')
 
     if not _using_moin_auth():
         return Response('No MoinAuth in auth list', 403)
@@ -1063,7 +1064,7 @@
             flash(_("If this account exists, you will be notified."), "info")
             return redirect(url_for('.show_root'))
     return render_template('lostpass.html',
-                           item_name=item_name,
+                           title_name=title_name,
                            form=form,
                           )
 
@@ -1100,7 +1101,7 @@
 @frontend.route('/+recoverpass', methods=['GET', 'POST'])
 def recoverpass():
     # TODO use ?next=next_location check if target is in the wiki and not outside domain
-    item_name = 'RecoverPass' # XXX
+    title_name = _(u'Recover Pass')
 
     if not _using_moin_auth():
         return Response('No MoinAuth in auth list', 403)
@@ -1118,7 +1119,7 @@
                 flash(_('Your token is invalid!'), "error")
             return redirect(url_for('.show_root'))
     return render_template('recoverpass.html',
-                           item_name=item_name,
+                           title_name=title_name,
                            form=form,
                           )
 
@@ -1168,7 +1169,7 @@
 @frontend.route('/+login', methods=['GET', 'POST'])
 def login():
     # TODO use ?next=next_location check if target is in the wiki and not outside domain
-    item_name = 'Login' # XXX
+    title_name = _(u'Login')
 
     # multistage return
     if flaskg._login_multistage_name == 'openid':
@@ -1189,7 +1190,7 @@
         for msg in flaskg._login_messages:
             flash(msg, "error")
     return render_template('login.html',
-                           item_name=item_name,
+                           title_name=title_name,
                            login_inputs=app.cfg.auth_login_inputs,
                            form=form,
                           )
@@ -1268,7 +1269,7 @@
 @frontend.route('/+usersettings/<part>', methods=['GET', 'POST'])
 def usersettings(part):
     # TODO use ?next=next_location check if target is in the wiki and not outside domain
-    item_name = 'User Settings' # XXX
+    title_name = _('User Settings')
 
     # these forms can't be global because we need app object, which is only available within a request:
     class UserSettingsPersonalForm(Form):
@@ -1310,7 +1311,7 @@
         # 'main' part or some invalid part
         return render_template('usersettings.html',
                                part='main',
-                               item_name=item_name,
+                               title_name=title_name,
                               )
     if request.method == 'GET':
         form = FormClass.from_object(flaskg.user)
@@ -1349,7 +1350,7 @@
                     form = FormClass.from_object(flaskg.user)
                     form['submit'].set_default() # XXX from_object() kills all values
     return render_template('usersettings.html',
-                           item_name=item_name,
+                           title_name=title_name,
                            part=part,
                            form=form,
                           )
--- a/MoinMoin/templates/layout.html	Sat Oct 29 02:14:29 2011 -0200
+++ b/MoinMoin/templates/layout.html	Sat Oct 29 03:17:33 2011 -0200
@@ -73,10 +73,20 @@
         <span id="moin-pagelocation">
             <span class="moin-pagepath">
                 {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(item_name) -%}
-                    <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
-                        {{ segment_name|shorten_item_name }}
-                    </a>
-                    {% if not loop.last -%}<span class="sep">/</span>{%- endif %}
+                    {% if not loop.last -%}
+                        <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
+                            {{ segment_name|shorten_item_name }}
+                        </a>
+			<span class="sep">/</span>
+                    {% else %}
+		        {% if title_name %}
+                            {{ title_name }}
+                        {% else %}
+                        <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
+                            {{ segment_name|shorten_item_name }}
+                        </a>
+		        {%- endif %}
+                    {%- endif %}
                 {%- endfor %}
             </span>
         </span>