added focus to form input
authorRodney Ewing <ewing.rj@gmail.com>
Thu, 23 May 2013 20:22:13 +0000 (13:22 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Fri, 24 May 2013 23:52:50 +0000 (16:52 -0700)
Conflicts:
mediagoblin/auth/views.py
mediagoblin/plugins/openid/views.py

mediagoblin/auth/views.py
mediagoblin/templates/mediagoblin/auth/change_fp.html
mediagoblin/templates/mediagoblin/auth/forgot_password.html
mediagoblin/templates/mediagoblin/auth/login.html
mediagoblin/templates/mediagoblin/auth/register.html

index f6d4d4d1447ab62201167bf6c9d90e6ccfcf444e..5a360bd08f190a2e70d65b261b84578cfd8016e5 100644 (file)
@@ -62,7 +62,9 @@ def register(request):
     return render_to_response(
         request,
         'mediagoblin/auth/register.html',
-        {'register_form': register_form})
+        {'register_form': register_form,
+         'focus': 'username',
+         'post_url': request.urlgen('mediagoblin.auth.register')})
 
 
 def login(request):
@@ -113,6 +115,8 @@ def login(request):
         {'login_form': login_form,
          'next': request.GET.get('next') or request.form.get('next'),
          'login_failed': login_failed,
+         'focus': 'username',
+         'post_url': request.urlgen('mediagoblin.auth.login'),
          'allow_registration': mg_globals.app_config["allow_registration"]})
 
 
index 1f7d9aca4fc82a253d04c8c6ecc1f3c93df286a3..afffeaddfc141e0de91bc443c44f41ac532c6066 100644 (file)
@@ -39,6 +39,7 @@
         <input type="submit" value="{% trans %}Set password{% endtrans %}" class="button_form"/>
       </div>
     </div>
-  </form>
+</form><!-- Focus the field passed in with the focus arg-->
+<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
 {% endblock %}
 
index 98cd9a06ab3a3adf47105fddd3629f597dd6777b..6a74e2a2047d1d0b410630c335369ee16fe12817 100644 (file)
@@ -35,4 +35,6 @@
       </div>
     </div>
   </form>
+<!-- Focus the field passed in with the focus arg-->
+<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
 {% endblock %}
index 4a39059d35c1d7723a72a313b10d92f73f64c219..6ec5d3432765675c7a6ca701b4165a0e5b0dcde0 100644 (file)
@@ -59,4 +59,6 @@
       {% endif %}
     </div>
   </form>
+<!-- Focus the field passed in with the focus arg-->
+<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
 {% endblock %}
index 6dff0207a78bfc70909002b2e66a2b12dc7fc105..755d54187b962de213d8b31bfd6a0be36dbb104c 100644 (file)
@@ -42,6 +42,6 @@
       </div>
     </div>
   </form>
-<!-- Focus the username field by default -->
-<script>$(document).ready(function(){$("#username").focus();});</script>
+<!-- Focus the field passed in with the focus arg-->
+<script>$(document).ready(function(){$({{ focus }}).focus();});</script>
 {% endblock %}