Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…labeling
  • Loading branch information...
commit f47660abe6aa3978ccd49067f7b1238d5d975cfc 1 parent df4923c
@artnez authored
View
16 src/faceoff/templates/forms/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>
View
13 src/faceoff/templates/new_league.html
@@ -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 %}
Please sign in to comment.
Something went wrong with that request. Please try again.