Permalink
Browse files

move league creation form into a separate form handler and add error …

…labeling
  • Loading branch information...
1 parent df4923c commit f47660abe6aa3978ccd49067f7b1238d5d975cfc @artnez committed May 14, 2012
Showing with 17 additions and 12 deletions.
  1. +16 −0 src/faceoff/templates/forms/new_league.html
  2. +1 −12 src/faceoff/templates/new_league.html
@@ -0,0 +1,16 @@
+{% from 'macros/form.html' import render_field, render_radio_field %}
+<form id='new-league' action='{{ url_for('new_league') }}' method='post'>
+ <h1>create a league</h1>
+ <fieldset>
+ <div class='control-group{{ ' error' if new_league_form.name.errors | length }}'>
+ <div class='controls'>
+ <input type='text' name='{{ new_league_form.name.name }}' class='span6' placeholder='league name' value='' />
+ {%- if new_league_form.name.errors | length -%}
+ <p class='help-inline'>{{ new_league_form.name.errors[0] }}</p>
+ {%- endif %}
+ </div>
+ </div>
+ <button type='submit' class='btn btn-large'>Create League</button>
+ <a href='{{ url_for('landing') }}' class='cancel'>cancel</a>
+ </fieldset>
+</form>
@@ -3,17 +3,6 @@
{% set logo_url = url_for('landing') %}
{% block content %}
<div>
- <form id='new-league' action='{{ url_for('new_league') }}' method='post'>
- <h1>create a league</h1>
- <fieldset>
- <div class='control-group'>
- <div class='controls'>
- <input type='text' name='{{ new_league_form.name.name }}' class='span6' placeholder='league name' value='' />
- </div>
- </div>
- <button type='submit' class='btn btn-large'>Create League</button>
- <a href='{{ url_for('landing') }}' class='cancel'>cancel</a>
- </fieldset>
- </form>
+ {% include 'forms/new_league.html' %}
</div>
{% endblock %}

0 comments on commit f47660a

Please sign in to comment.