From 482abdcc8aef8c8a06bd7cf9540e2dfd67c11caa Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 28 Feb 2013 13:57:04 +0000 Subject: [PATCH] Submit/edit form tweaks * Don't specify action on form - this is best practice and avoids the need to have separate form tags for submit and edit * Add a short introduction to the submit form * Focus first field on load only if first field is empty (avoids doing this focusing on the edit form which is not really useful). Signed-off-by: Paul Eggleton --- layerindex/editlayer.html | 8 ++++++-- layerindex/static/css/additional.css | 4 ++++ layerindex/submitlayer.html | 6 ++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/layerindex/editlayer.html b/layerindex/editlayer.html index 13178b0..54cfe0d 100644 --- a/layerindex/editlayer.html +++ b/layerindex/editlayer.html @@ -30,14 +30,14 @@ {% endblock %} -{% block formtag %} +{% block formtop %} {% if form.was_saved %}
Changes saved successfully.
{% endif %} -
{% endblock %} + {% csrf_token %} {% for hidden in form.hidden_fields %} {{ hidden }} @@ -235,6 +235,10 @@ $('#addanothermaintainer').click(expand_maintainer) $('#id_vcs_url').change(auto_web_fields) + + firstfield = $("#edit_layer_form input:text, #edit_layer_form textarea").first(); + if( ! firstfield.val() ) + firstfield.focus() }); {% endblock %} diff --git a/layerindex/static/css/additional.css b/layerindex/static/css/additional.css index d5abfe8..5d36df4 100644 --- a/layerindex/static/css/additional.css +++ b/layerindex/static/css/additional.css @@ -72,6 +72,10 @@ padding: 8px; margin: 0px; } +.submitformintro { + padding-bottom: 0.75em; +} + .formfields input { width: 50%; } diff --git a/layerindex/submitlayer.html b/layerindex/submitlayer.html index 6950da9..41b5aa1 100644 --- a/layerindex/submitlayer.html +++ b/layerindex/submitlayer.html @@ -21,8 +21,10 @@ {% endblock %} -{% block formtag %} - +{% block formtop %} +
+

Please enter the details for the layer you wish to add to the index.

+
{% endblock %} {% block submitbuttons %}