Thomas Waldmann avatar Thomas Waldmann committed ec37a42

item modify ui: remove cancel button (user can just click anywhere else than on SAVE)

Comments (0)

Files changed (2)

MoinMoin/apps/frontend/views.py

     """Modify the wiki item item_name.
 
     On GET, displays a form.
-    On POST, saves the new page (unless there's an error in input, or cancelled).
+    On POST, saves the new page (unless there's an error in input).
     After successful POST, redirects to the page.
     """
     contenttype = request.values.get('contenttype')
         content = item.do_modify(template_name)
         return content
     elif request.method == 'POST':
-        cancelled = 'button_cancel' in request.form
-        if not cancelled:
-            form = TextChaizedForm.from_flat(request.form)
-            TextCha(form).amend_form()
-            valid = form.validate()
-            if not valid:
-                data_text = request.values.get('data_text')
-                meta_text = item.meta_dict_to_text(item.meta)
-                comment = request.values.get('comment')
-                return render_template(item.template,
-                                       item_name=item_name,
-                                       gen=make_generator(),
-                                       form=form,
-                                       data_text=data_text,
-                                       meta_text=meta_text,
-                                       comment=comment,
-                                       cols=COLS,
-                                       rows_data=ROWS_DATA,
-                                       rows_meta=ROWS_META,
-                                      )
-            try:
-                item.modify()
-                item_modified.send(app._get_current_object(),
-                                   item_name=item_name)
-                if contenttype in ('application/x-twikidraw', 'application/x-anywikidraw', 'application/x-svgdraw'):
-                    # TWikiDraw/AnyWikiDraw/SvgDraw POST more than once, redirecting would break them
-                    return "OK"
-            except AccessDeniedError:
-                abort(403)
+        form = TextChaizedForm.from_flat(request.form)
+        TextCha(form).amend_form()
+        valid = form.validate()
+        if not valid:
+            data_text = request.values.get('data_text')
+            meta_text = item.meta_dict_to_text(item.meta)
+            comment = request.values.get('comment')
+            return render_template(item.template,
+                                   item_name=item_name,
+                                   gen=make_generator(),
+                                   form=form,
+                                   data_text=data_text,
+                                   meta_text=meta_text,
+                                   comment=comment,
+                                   cols=COLS,
+                                   rows_data=ROWS_DATA,
+                                   rows_meta=ROWS_META,
+                                  )
+        try:
+            item.modify()
+            item_modified.send(app._get_current_object(),
+                               item_name=item_name)
+            if contenttype in ('application/x-twikidraw', 'application/x-anywikidraw', 'application/x-svgdraw'):
+                # TWikiDraw/AnyWikiDraw/SvgDraw POST more than once, redirecting would break them
+                return "OK"
+        except AccessDeniedError:
+            abort(403)
         return redirect(url_for('frontend.show_item', item_name=item_name))
 
 

MoinMoin/templates/modify_binary.html

 {% extends "modify_applet.html" %}
 {% block extra_form %}
 <input class="button" type="submit" name="button_save" value="{{ _("Save") }}" />
-<input class="button" type="submit" name="button_cancel" value="{{ _("Cancel") }}" />
 {{ forms.render_textcha(gen, form) }}
 <br />
 <label for="comment">{{ _("Comment:") }}</label><input type="text" id="comment" name="comment" size="80" maxlength="200" value="{{ comment }}" />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.