diff options
author | Struan Donald <struan@exo.org.uk> | 2013-05-23 18:45:56 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-05-23 18:45:56 +0100 |
commit | 96161b33aa5dcdf9be97b8274c406184ea9dd36e (patch) | |
tree | bf06ca032bb9537196be663c7005c728ac03872c /www/js | |
parent | cf36e88dc8159cc47fc883182178c4b198ab3ca3 (diff) |
add placeholder image to photo page to reduce jumping about
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/views/photo.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/www/js/views/photo.js b/www/js/views/photo.js index e802c73..65b2f44 100644 --- a/www/js/views/photo.js +++ b/www/js/views/photo.js @@ -17,6 +17,16 @@ 'click #id_del_photo_button': 'deletePhoto' }, + beforeDisplay: function() { + this.fixPageHeight(); + if ( this.model.get('file') ) { + $('#id_photo_button').hide(); + $('#id_existing').hide(); + } else { + this.$('#id_del_photo_button').hide(); + } + }, + takePhoto: function() { var that = this; navigator.camera.getPicture( function(imgURI) { that.addPhotoSuccess(imgURI); }, function(error) { that.addPhotoFail(error); }, { saveToPhotoAlbum: true, quality: 49, destinationType: Camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.CAMERA, correctOrientation: true }); @@ -37,8 +47,9 @@ FMS.saveCurrentDraft(); $('#photo-next-btn .ui-btn-text').text('Next'); - $('#display_photo').show(); - $('#add_photo').hide(); + $('#id_del_photo_button').show(); + $('#id_photo_button').hide(); + $('#id_existing').hide(); }); move.fail( function() { that.addPhotoFail(); } ); @@ -59,11 +70,12 @@ del.done( function() { that.model.set('file', ''); FMS.saveCurrentDraft(); - $('#photo').attr('src', ''); + $('#photo').attr('src', 'images/placeholder-photo.png'); $('#photo-next-btn .ui-btn-text').text('Skip'); - $('#display_photo').hide(); - $('#add_photo').show(); + $('#id_del_photo_button').hide(); + $('#id_photo_button').show(); + $('#id_existing').show(); }); } |