aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/templates
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-06-21 14:14:40 -0700
committerRodney Ewing <ewing.rj@gmail.com>2013-06-21 14:14:40 -0700
commite4deacd9c898b6a627d892ef09d3d6efeb88ac52 (patch)
tree9fe1b5343d250ae44b874e21f8bf019935cb388c /mediagoblin/templates
parent54ef2c408bdae8a7b827ce648567ae94573a99e3 (diff)
downloadmediagoblin-e4deacd9c898b6a627d892ef09d3d6efeb88ac52.tar.lz
mediagoblin-e4deacd9c898b6a627d892ef09d3d6efeb88ac52.tar.xz
mediagoblin-e4deacd9c898b6a627d892ef09d3d6efeb88ac52.zip
changes after cwebb's review
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r--mediagoblin/templates/mediagoblin/auth/change_fp.html4
-rw-r--r--mediagoblin/templates/mediagoblin/auth/forgot_password.html4
-rw-r--r--mediagoblin/templates/mediagoblin/auth/login.html4
-rw-r--r--mediagoblin/templates/mediagoblin/auth/register.html4
-rw-r--r--mediagoblin/templates/mediagoblin/utils/wtforms.html16
5 files changed, 16 insertions, 16 deletions
diff --git a/mediagoblin/templates/mediagoblin/auth/change_fp.html b/mediagoblin/templates/mediagoblin/auth/change_fp.html
index afffeadd..a3cf9cb9 100644
--- a/mediagoblin/templates/mediagoblin/auth/change_fp.html
+++ b/mediagoblin/templates/mediagoblin/auth/change_fp.html
@@ -34,12 +34,10 @@
{{ csrf_token }}
<div class="form_box">
<h1>{% trans %}Set your new password{% endtrans %}</h1>
- {{ wtforms_util.render_divs(cp_form) }}
+ {{ wtforms_util.render_divs(cp_form, True) }}
<div class="form_submit_buttons">
<input type="submit" value="{% trans %}Set password{% endtrans %}" class="button_form"/>
</div>
</div>
-</form><!-- Focus the field passed in with the focus arg-->
-<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/auth/forgot_password.html b/mediagoblin/templates/mediagoblin/auth/forgot_password.html
index a6c9e1e9..6cfd2c85 100644
--- a/mediagoblin/templates/mediagoblin/auth/forgot_password.html
+++ b/mediagoblin/templates/mediagoblin/auth/forgot_password.html
@@ -29,12 +29,10 @@
{{ csrf_token }}
<div class="form_box">
<h1>{% trans %}Recover password{% endtrans %}</h1>
- {{ wtforms_util.render_divs(fp_form) }}
+ {{ wtforms_util.render_divs(fp_form, True) }}
<div class="form_submit_buttons">
<input type="submit" value="{% trans %}Send instructions{% endtrans %}" class="button_form"/>
</div>
</div>
</form>
-<!-- Focus the field passed in with the focus arg-->
-<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html
index 2adbe547..d9f92557 100644
--- a/mediagoblin/templates/mediagoblin/auth/login.html
+++ b/mediagoblin/templates/mediagoblin/auth/login.html
@@ -45,7 +45,7 @@
{%- trans %}Create one here!{% endtrans %}</a>
</p>
{% endif %}
- {{ wtforms_util.render_divs(login_form) }}
+ {{ wtforms_util.render_divs(login_form, True) }}
{% if pass_auth %}
<p>
<a href="{{ request.urlgen('mediagoblin.auth.forgot_password') }}" id="forgot_password">
@@ -61,6 +61,4 @@
{% endif %}
</div>
</form>
-<!-- Focus the field passed in with the focus arg-->
-<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html
index 755d5418..b315975c 100644
--- a/mediagoblin/templates/mediagoblin/auth/register.html
+++ b/mediagoblin/templates/mediagoblin/auth/register.html
@@ -34,7 +34,7 @@
method="POST" enctype="multipart/form-data">
<div class="form_box">
<h1>{% trans %}Create an account!{% endtrans %}</h1>
- {{ wtforms_util.render_divs(register_form) }}
+ {{ wtforms_util.render_divs(register_form, True) }}
{{ csrf_token }}
<div class="form_submit_buttons">
<input type="submit" value="{% trans %}Create{% endtrans %}"
@@ -42,6 +42,4 @@
</div>
</div>
</form>
-<!-- Focus the field passed in with the focus arg-->
-<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html
index be6976c2..90b237ee 100644
--- a/mediagoblin/templates/mediagoblin/utils/wtforms.html
+++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html
@@ -33,10 +33,14 @@
{%- endmacro %}
{# Generically render a field #}
-{% macro render_field_div(field) %}
+{% macro render_field_div(field, autofocus_first=False) %}
{{- render_label_p(field) }}
<div class="form_field_input">
- {{ field }}
+ {% if autofocus_first %}
+ {{ field(autofocus=True) }}
+ {% else %}
+ {{ field }}
+ {% endif %}
{%- if field.errors -%}
{% for error in field.errors %}
<p class="form_field_error">{{ error }}</p>
@@ -49,9 +53,13 @@
{%- endmacro %}
{# Auto-render a form as a series of divs #}
-{% macro render_divs(form) -%}
+{% macro render_divs(form, autofocus_first=False) -%}
{% for field in form %}
- {{ render_field_div(field) }}
+ {% if autofocus_first and loop.first %}
+ {{ render_field_div(field, True) }}
+ {% else %}
+ {{ render_field_div(field) }}
+ {% endif %}
{% endfor %}
{%- endmacro %}