From 69c43d244cf955f7cf5724e10b76e1b297bb9cab Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 16 Feb 2016 12:49:02 -0500 Subject: [PATCH] Bug 15828: Upload patron images is hard to read The styling of the patron image upload form causes the text to be smaller than it should be for the main body of a page. This patch revises the form style and cleans up the markup a bit. This patch also adds client-side validation of the form so that a file upload is required, and a card number is required if an image file is selected. To test, apply the patch and go to Tools -> Upload patron images. 1. Confirm that the text in the form is the correct size. 2. With "Zip file" selected, confirm that submitting the form is blocked and the file upload marked as required. 3. With "Image file" selected, confirm that submitting the form with an empty card number field is blocked and the card number field is marked as required. 4. Confirm that uploading zip files and single images still works correctly. Signed-off-by: Hector Castro Works as advertised Signed-off-by: Jonathan Druart --- .../prog/en/modules/tools/picture-upload.tt | 47 +++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt index ef22fe1..1ee7e67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt @@ -9,6 +9,17 @@ $("#image").click(function(){ $("#cardnum").show(); }); + $( "#upload_form" ).validate({ + rules: { + cardnumber: { + required: { + depends: function(element) { + return $("#image").is(":checked"); + } + } + } + } + }); }); @@ -104,23 +115,31 @@ [% END %] [% END %] -
-
-
NOTE: Only PNG, GIF, JPEG, XPM formats are supported.
+ +
+

NOTE: Only PNG, GIF, JPEG, XPM formats are supported.

    -
  1. -
  2. -
  3. - -
    1. - - [% IF ( filetype == 'image' ) %][% ELSE %] +
    2. +
    3. + +
    4. + [% IF ( filetype == 'image' ) %] +
    5. + [% ELSE %] +
    6. +
    7. + + + Required
    8. -
    -
+
-- 2.7.0