changeset 158:eaa4c984d8f3

Textcha for Copy Added
author Akash Sinha <akash2607@gmail.com>
date Mon, 21 Mar 2011 23:53:00 +0530
parents a712f180d741
children a84d782f38e9
files MoinMoin/apps/frontend/views.py MoinMoin/templates/copy.html
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon Mar 21 00:58:19 2011 +0100
+++ b/MoinMoin/apps/frontend/views.py	Mon Mar 21 23:53:00 2011 +0530
@@ -349,14 +349,26 @@
         item = Item.create(item_name)
     except AccessDeniedError:
         abort(403)
+    form = TextChaizedForm.from_flat(request.form)
+    TextCha(form).amend_form()
     if request.method == 'GET':
         return render_template(item.copy_template,
                                item=item, item_name=item_name,
+                               form=form,
+                               gen=make_generator(),
                               )
     if request.method == 'POST':
         if 'button_ok' in request.form:
             target = request.form.get('target')
             comment = request.form.get('comment')
+            valid = form.validate()
+            if not valid:
+                return render_template(item.copy_template,
+                                       item=item, item_name=item_name,
+                                       form=form,
+                                       gen=make_generator(),
+                                       comment=comment,
+                                      )
             item.copy(target, comment)
             redirect_to = target
         else:
--- a/MoinMoin/templates/copy.html	Mon Mar 21 00:58:19 2011 +0100
+++ b/MoinMoin/templates/copy.html	Mon Mar 21 23:53:00 2011 +0530
@@ -1,3 +1,4 @@
+{% import "forms.html" as forms %}
 {% extends theme("layout.html") %}
 {% block content %}
 <h1>{{ _("Copy '%(item_name)s'", item_name=item.name) }}</h1>
@@ -13,6 +14,8 @@
 
     <input class="button" type="submit" name="button_ok" value="{{ _('Copy') }}" />
     <input class="button" type="submit" name="button_cancel" value="{{ _('Cancel') }}" />
+    <br/>
+    {{ forms.render_textcha(gen, form) }}
 </form>
 </div>
 {% endblock %}