From 8e1f1769622dba30f8e156649d50e19ad44c27d4 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 16 Sep 2013 12:33:18 +0100 Subject: Change photo page title if report has a photo Also update it when adding a photo to give an indication that adding the photo was succesful. This is to remove any confusion about whether the photo on the page has been added. Fixes #130 --- src/js/strings.js | 1 + src/js/views/photo.js | 4 ++++ src/templates/en/photo.html | 13 ++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/js/strings.js b/src/js/strings.js index a421279..905b2c3 100644 --- a/src/js/strings.js +++ b/src/js/strings.js @@ -42,6 +42,7 @@ invalid_email: 'Invalid email', invalid_report: 'Invalid report', photo_failed: 'There was a problem taking your photo.', + photo_added: 'Photo added', photo_loading: 'Uploading images may take some time, please be patient', upload_aborted: 'There was a problem uploading your report.', try_again: 'Try Again', diff --git a/src/js/views/photo.js b/src/js/views/photo.js index aa9c9ee..a6bbb47 100644 --- a/src/js/views/photo.js +++ b/src/js/views/photo.js @@ -60,6 +60,8 @@ var that = this; move.done( function( file ) { + $('#nophoto_title').hide(); + $('#photo_title').html(FMS.strings.photo_added).show(); $('#photo').attr('src', file.toURL()).addClass('small').removeClass('placeholder'); that.model.set('file', file.toURL()); FMS.saveCurrentDraft(); @@ -91,6 +93,8 @@ var del = FMS.files.deleteURI( this.model.get('file') ); del.done( function() { + $('#photo_title').hide(); + $('#nophoto_title').show(); $('#id_del_photo_button').hide(); that.model.set('file', ''); FMS.saveCurrentDraft(true); diff --git a/src/templates/en/photo.html b/src/templates/en/photo.html index 460f38f..aa44e9e 100644 --- a/src/templates/en/photo.html +++ b/src/templates/en/photo.html @@ -7,7 +7,18 @@ <% } %>
-

Add a Photo (optional)

+ <% var photoClass = 'nodisplay', nophotoClass = 'nodisplay'; + if ( file != '' ) { + photoClass = ''; + } else { + nophotoClass = ''; + } %> +

+ Add a Photo (optional) +

+

+ Photo for report +

<% if ( file == '' ) { %> -- cgit v1.2.3