]> git.parisson.com Git - telemeta.git/commitdiff
add form submit pressing enter for login and search
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 16 Apr 2013 12:41:19 +0000 (14:41 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 16 Apr 2013 12:41:19 +0000 (14:41 +0200)
telemeta/templates/telemeta/login.html
telemeta/templates/telemeta/search_criteria.html

index 8b1b776fb73ff054e370308e65b89c4d08df8fe1..c5819b3938f243d68b8e77370e5b6d344fd99ebe 100644 (file)
@@ -6,6 +6,15 @@
 {% endblock %}
 
 {% block content %}
+<script>
+$(document).ready(function() {
+    $(this).keydown(function(e) {
+        if (e.keyCode == '13') {
+            $("#_loginForm").submit();
+        }
+    });
+});
+</script>
 {% if form.errors %}
 <p class="login-error">{% trans "Your username and password didn't match. Please try again." %}</p>
 {% endif %}
@@ -16,8 +25,7 @@
 {{ form.password.label_tag }}
 {{ form.password }}
 </p>
-<a href="#" class="component_icon button icon_login" style="float: right;"
-                onclick="document.getElementById('_loginForm').submit(); return false;">{% trans "Sign in" %}</a>
+<a href="#" class="component_icon button icon_login" style="float: right;" onclick="document.getElementById('_loginForm').submit(); return false;">{% trans "Sign in" %}</a>
 <input type="hidden" name="next" value="{{ next }}" />
 <span style="align: right; font-weight: bold;"><a href="{% url telemeta-password-reset %}">{% trans "Password forgotten" %} ?</a></span>
 </form>
index 425de75e973d78ceec2c760ca9988e1cf140fe6d..41fbe26a12518a0770038aa83a64c48a0bfa0678 100644 (file)
@@ -48,6 +48,14 @@ $(document).ready(function () {
     });
 });
 
+$(document).ready(function() {
+    $(this).keydown(function(e) {
+        if (e.keyCode == '13') {
+            $("#searchform").submit();
+        }
+    });
+});
+
 </script>
 {% endblock %}