changeset 1741:bf840fab4737

On +index view, Use GET for filtering.
author Cheer Xiao <xiaqqaix@gmail.com>
date Sat, 25 Aug 2012 22:07:39 +0800
parents 7d258c74032d
children 8f18745faf4a
files MoinMoin/apps/frontend/views.py MoinMoin/templates/index.html
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Sat Aug 25 11:55:59 2012 +0200
+++ b/MoinMoin/apps/frontend/views.py	Sat Aug 25 22:07:39 2012 +0800
@@ -752,12 +752,10 @@
     except AccessDenied:
         abort(403)
 
-    if request.method == 'GET':
-        form = IndexForm.from_defaults()
-        selected_groups = None
-    elif request.method == "POST":
-        form = IndexForm.from_flat(request.form)
-        selected_groups = [k.replace("_", " ") for k, v in form['contenttype'].iteritems() if v]
+    # XXX retain default values when some arg missing from request.args?
+    form = IndexForm.from_flat(request.args)
+
+    selected_groups = [k.replace("_", " ") for k, v in form['contenttype'].iteritems() if v]
 
     startswith = request.values.get("startswith")
 
--- a/MoinMoin/templates/index.html	Sat Aug 25 11:55:59 2012 +0200
+++ b/MoinMoin/templates/index.html	Sat Aug 25 22:07:39 2012 +0800
@@ -50,7 +50,7 @@
             <div class="moin-contenttypes-wrapper">
                 <div class="ct-hide">{{ _("Filter by content type") }}</div>
                 {% set unknown_items_label = _("items having unknown mime types") %}
-                {{ gen.form.open(form, method="post", action=url_for('frontend.index', item_name=item_name)) }}
+                {{ gen.form.open(form, method="get", action=url_for('frontend.index', item_name=item_name)) }}
                 <ul>
                     <li>
                         <a href="#" class="filter-toggle">&raquo; {{ _("Toggle") }}</a>