aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/photo.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/views/photo.js')
-rw-r--r--www/js/views/photo.js87
1 files changed, 0 insertions, 87 deletions
diff --git a/www/js/views/photo.js b/www/js/views/photo.js
deleted file mode 100644
index 74f3933..0000000
--- a/www/js/views/photo.js
+++ /dev/null
@@ -1,87 +0,0 @@
-(function (FMS, Backbone, _, $) {
- _.extend( FMS, {
- PhotoView: FMS.FMSView.extend({
- template: 'photo',
- id: 'photo-page',
- prev: 'around',
- next: 'details',
-
- events: {
- 'pagehide': 'destroy',
- 'pagebeforeshow': 'beforeDisplay',
- 'pageshow': 'afterDisplay',
- 'vclick .ui-btn-left': 'onClickButtonPrev',
- 'vclick .ui-btn-right': 'onClickButtonNext',
- 'vclick #id_photo_button': 'takePhoto',
- 'vclick #id_existing': 'addPhoto',
- 'vclick #id_del_photo_button': 'deletePhoto'
- },
-
- beforeDisplay: function() {
- this.fixPageHeight();
- if ( this.model.get('file') ) {
- $('#id_photo_button').parents('.ui-btn').hide();
- $('#id_existing').parents('.ui-btn').hide();
- } else {
- this.$('#id_del_photo_button').parents('.ui-btn').hide();
- }
- },
-
- takePhoto: function(e) {
- e.preventDefault();
- 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 });
- },
-
- addPhoto: function(e) {
- e.preventDefault();
- var that = this;
- navigator.camera.getPicture( function(imgURI) { that.addPhotoSuccess(imgURI); }, function(error) { that.addPhotoFail(error); }, { saveToPhotoAlbum: false, quality: 49, destinationType: Camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY, correctOrientation: true });
- },
-
- addPhotoSuccess: function(imgURI) {
- var move = FMS.files.moveURI( imgURI );
-
- var that = this;
- move.done( function( file ) {
- $('#photo').attr('src', file.toURL());
- that.model.set('file', file.toURL());
- FMS.saveCurrentDraft();
-
- $('#photo-next-btn .ui-btn-text').text('Next');
- $('#id_del_photo_button').parents('.ui-btn').show();
- $('#id_photo_button').parents('.ui-btn').hide();
- $('#id_existing').parents('.ui-btn').hide();
- });
-
- move.fail( function() { that.addPhotoFail(); } );
- },
-
- addPhotoFail: function() {
- if ( message != 'no image selected' &&
- message != 'Selection cancelled.' &&
- message != 'Camera cancelled.' ) {
- this.displayError(FMS.strings.photo_failed);
- }
- },
-
- deletePhoto: function(e) {
- e.preventDefault();
- var that = this;
- var del = FMS.files.deleteURI( this.model.get('file') );
-
- del.done( function() {
- that.model.set('file', '');
- FMS.saveCurrentDraft();
- $('#photo').attr('src', 'images/placeholder-photo.png');
-
- $('#photo-next-btn .ui-btn-text').text('Skip');
- $('#id_del_photo_button').parents('.ui-btn').hide();
- $('#id_photo_button').parents('.ui-btn').show();
- $('#id_existing').parents('.ui-btn').show();
- });
-
- }
- })
- });
-})(FMS, Backbone, _, $);