changeset 215:d661d49a46dc

reverted 214:0f501a426b50, it will be solved differently by a filter for the Generator in util.forms
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 07 May 2011 19:33:57 +0200
parents 0f501a426b50
children 60242b1ba235
files MoinMoin/templates/forms.html MoinMoin/templates/login.html MoinMoin/templates/openid_register.html MoinMoin/templates/recoverpass.html MoinMoin/templates/register.html
diffstat 5 files changed, 19 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/forms.html	Wed May 04 22:22:46 2011 +0200
+++ b/MoinMoin/templates/forms.html	Sat May 07 19:33:57 2011 +0200
@@ -15,16 +15,13 @@
   {% endif %}
 {% endmacro %}
 
-{% macro render_field(gen, field, field_type, class="optional") %}
+{% macro render_field(gen, field, field_type) %}
+  {% set f_class = "optional" if field.optional else "required" %}
   <dt>
-    {{ gen.label(field, class=class) }}
+    {{ gen.label(field, class=f_class) }}
   </dt>
   <dd>
-    {% if class == "optional" %}
-      {{ gen.input(field, class="optional", type=field_type) }}
-    {% else %}
-      {{ gen.input(field, class="required", type=field_type, required="required") }}
-    {% endif %}
+    {{ gen.input(field, class=f_class, type=field_type) }}
     {{ render_errors(field) }}
   </dd>
 {% endmacro %}
@@ -53,7 +50,7 @@
         {# The value of -51 below is the sum of signature length, timestamp and a space (see security/textcha.py) #}
         {{ form.textcha_question.value[:-51] }}
         {{ gen.input(form.textcha_question, class=f_class, type='hidden') }}<br />
-        {{ gen.input(form.textcha, class="required", required="required") }}
+        {{ gen.input(form.textcha, class="required") }}
         {{ render_errors(form.textcha) }}
     </dd>
     {% endif %}
--- a/MoinMoin/templates/login.html	Wed May 04 22:22:46 2011 +0200
+++ b/MoinMoin/templates/login.html	Sat May 07 19:33:57 2011 +0200
@@ -12,10 +12,10 @@
   {{ gen.input(form['submit'], type='hidden') }}
 
   {% if 'username' in login_inputs %}
-  {{ forms.render_field(gen, form['username'], 'text', 'required') }}
+  {{ forms.render_field(gen, form['username'], 'text') }}
   {% endif %}
   {% if 'password' in login_inputs %}
-  {{ forms.render_field(gen, form['password'], 'password', 'required') }}
+  {{ forms.render_field(gen, form['password'], 'password') }}
   {% endif %}
 
   <input type="submit" value="{{ _('Log in') }}" />
--- a/MoinMoin/templates/openid_register.html	Wed May 04 22:22:46 2011 +0200
+++ b/MoinMoin/templates/openid_register.html	Sat May 07 19:33:57 2011 +0200
@@ -12,10 +12,10 @@
     <dt>{{ gen.label(form['openid']) }}</dt>
     <dd>{{ gen.input(form['openid'], type='text', readonly='1') }}</dd>
 
-    {{ forms.render_field(gen, form['username'], 'text', 'required') }}
-    {{ forms.render_field(gen, form['password1'], 'password', 'required') }}
-    {{ forms.render_field(gen, form['password2'], 'password', 'required') }}
-    {{ forms.render_field(gen, form['email'], 'text', 'required') }}
+    {{ forms.render_field(gen, form['username'], 'text') }}
+    {{ forms.render_field(gen, form['password1'], 'password') }}
+    {{ forms.render_field(gen, form['password2'], 'password') }}
+    {{ forms.render_field(gen, form['email'], 'text') }}
     {{ forms.render_textcha(gen, form) }}
   </dl>
   <input type="submit" value="{{ _("Register") }}" />
--- a/MoinMoin/templates/recoverpass.html	Wed May 04 22:22:46 2011 +0200
+++ b/MoinMoin/templates/recoverpass.html	Sat May 07 19:33:57 2011 +0200
@@ -6,10 +6,10 @@
 {{ gen.form.open(form, method="post", action=url_for('frontend.recoverpass')) }}
   {{ forms.render_errors(form) }}
   <dl>
-    {{ forms.render_field(gen, form['username'], 'text', 'required') }}
-    {{ forms.render_field(gen, form['token'], 'text', 'required') }}
-    {{ forms.render_field(gen, form['password1'], 'password', 'required') }}
-    {{ forms.render_field(gen, form['password2'], 'password', 'required') }}
+    {{ forms.render_field(gen, form['username'], 'text') }}
+    {{ forms.render_field(gen, form['token'], 'text') }}
+    {{ forms.render_field(gen, form['password1'], 'password') }}
+    {{ forms.render_field(gen, form['password2'], 'password') }}
   </dl>
   {{ gen.input(form['submit'], type='submit') }}
 {{ gen.form.close() }}
--- a/MoinMoin/templates/register.html	Wed May 04 22:22:46 2011 +0200
+++ b/MoinMoin/templates/register.html	Sat May 07 19:33:57 2011 +0200
@@ -7,10 +7,10 @@
 {{ gen.form.open(form, method="post", action=url_for('frontend.register')) }}
   {{ forms.render_errors(form) }}
   <dl>
-    {{ forms.render_field(gen, form['username'], 'text', 'required') }}
-    {{ forms.render_field(gen, form['password1'], 'password', 'required') }}
-    {{ forms.render_field(gen, form['password2'], 'password', 'required') }}
-    {{ forms.render_field(gen, form['email'], 'text', 'required') }}
+    {{ forms.render_field(gen, form['username'], 'text') }}
+    {{ forms.render_field(gen, form['password1'], 'password') }}
+    {{ forms.render_field(gen, form['password2'], 'password') }}
+    {{ forms.render_field(gen, form['email'], 'text') }}
     {{ forms.render_field(gen, form['openid'], 'text') }}
     {{ forms.render_textcha(gen, form) }}
   </dl>