diff options
-rw-r--r-- | www/js/views/photo.js | 22 | ||||
-rw-r--r-- | www/templates/en/photo.html | 26 |
2 files changed, 24 insertions, 24 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(); }); } diff --git a/www/templates/en/photo.html b/www/templates/en/photo.html index 96a99f0..bd1a259 100644 --- a/www/templates/en/photo.html +++ b/www/templates/en/photo.html @@ -7,27 +7,15 @@ <% } %> </div> <div data-role="content"> - <% if ( file != '' ) { %> - <div id="add_photo" style="display: none"> - <% } else { %> - <div id="add_photo"> - <% } %> - <h2>Add a Photo <em>(optional)</em>:</h2> - <input value="Take a new photo" type="button" name="photo_button" id="id_photo_button" data-role="button" data-theme="a"> Or - <input value="Add and existing photo" type="button" name="existing" id="id_existing" data-role="button" data-theme="c"> - </div> - + <h2>Add a Photo <em>(optional)</em>:</h2> + <div class="photo"> <% if ( file == '' ) { %> - <div id="display_photo" style="display: none"> + <img class="small" src="images/placeholder-photo.png" alt="" id="photo"> <% } else { %> - <div id="display_photo"> - <% } %> - <label>Your Photo</label> - <div class="photo"> <img class="small" id="photo" src="<%= file %>" /> - </div> - <div class="right"> - <input value="Remove Photo" type="button" name="del_photo_button" id="id_del_photo_button" data-role="button" data-theme="a"> - <div> + <% } %> </div> + <a data-role="button" id="id_existing" data-theme="c">Add an existing photo</a> + <a id="id_photo_button" data-role="button" data-theme="a">Take a new photo</a> + <a id="id_del_photo_button" data-role="button" data-theme="a">Remove Photo</a> </div> |