diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-05-28 09:54:09 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-05-28 09:54:09 -0500 |
commit | 8566cdda713566ef632b78388fa9016a704f6e55 (patch) | |
tree | b1d4bf6e48469380b114db060440d3ffb78ab5a2 | |
parent | e698dedad5a3baa73a6bc0025a77a64c384e5bd4 (diff) | |
download | mediagoblin-8566cdda713566ef632b78388fa9016a704f6e55.tar.lz mediagoblin-8566cdda713566ef632b78388fa9016a704f6e55.tar.xz mediagoblin-8566cdda713566ef632b78388fa9016a704f6e55.zip |
Added a new form rendering system, render_divs, and using it for registration
-rw-r--r-- | mediagoblin/templates/mediagoblin/auth/register.html | 15 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/wtforms.html | 24 |
2 files changed, 32 insertions, 7 deletions
diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index 610c7cc4..31c3d23e 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -20,14 +20,15 @@ {% 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 %} diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 15556936..4a37ab33 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -15,6 +15,30 @@ # 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> |