Added a new form rendering system, render_divs, and using it for registration
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 28 May 2011 14:54:09 +0000 (09:54 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 28 May 2011 14:54:09 +0000 (09:54 -0500)
mediagoblin/templates/mediagoblin/auth/register.html
mediagoblin/templates/mediagoblin/utils/wtforms.html

index 610c7cc4fd87ac872b473cc6af7f0b86b319fcf0..31c3d23e4ab1a8cd68244f0d275ebca7d21a00cd 100644 (file)
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
 
 {% block mediagoblin_content %}
+  <h2>Create an account!</h2>
+
   <form action="{{ request.urlgen('mediagoblin.auth.register') }}"
         method="POST" enctype="multipart/form-data">
-    <table>
-      {{ wtforms_util.render_table(register_form) }}
-      <tr>
-        <td></td>
-        <td><input type="submit" value="submit" class="button" /></td>
-      </tr>
-    </table>
+    <div class="register_box form_box">
+      {{ wtforms_util.render_divs(register_form) }}
+      <div class="form_submit_buttons">
+        <input type="submit" value="submit" class="button" />
+      </div>
+    </div>
   </form>
 {% endblock %}
index 155569366f4abb813d0a274dd948abfa5b7cc593..4a37ab336a6605c5ef4d8eda9f7f2f5bbe2c7def 100644 (file)
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #}
+
+{# Auto-render a form as a series of divs #}
+{% macro render_divs(form) -%}
+  {% for field in form %}
+    <div class="form_field_box">
+      <div class="form_field_label">{{ field.label }}</div>
+      {% if field.description -%}
+        <div class="form_field_description">{{ field.description }}</div>
+      {%- endif %}
+      <div class="form_field_input">{{ field }}</div>
+      {%- if field.errors -%}
+        <div class="form_field_errors">
+          <ul>
+            {% for error in field.errors %}
+              <li>{{ error }}</li>
+            {% endfor %}
+          </ul>
+        </div>
+      {%- endif %}
+    </div>
+  {% endfor %}
+{%- endmacro %}
+
+{# Auto-render a form as a table #}
 {% macro render_table(form) -%}
   {% for field in form %}
     <tr>