diff options
-rw-r--r-- | www/css/fms.css | 84 | ||||
-rw-r--r-- | www/js/models/report.js | 4 | ||||
-rw-r--r-- | www/js/views/around.js | 6 | ||||
-rw-r--r-- | www/js/views/existing.js | 9 | ||||
-rw-r--r-- | www/js/views/photo.js | 21 | ||||
-rw-r--r-- | www/js/views/submit.js | 1 | ||||
-rw-r--r-- | www/templates/en/around.html | 6 | ||||
-rw-r--r-- | www/templates/en/existing.html | 41 | ||||
-rw-r--r-- | www/templates/en/photo.html | 2 |
9 files changed, 133 insertions, 41 deletions
diff --git a/www/css/fms.css b/www/css/fms.css index 5853757..de47a3b 100644 --- a/www/css/fms.css +++ b/www/css/fms.css @@ -1,6 +1,9 @@ *{ box-sizing:border-box; } + div[data-role="content"] { + background-color: white; + } label{ display:none; } @@ -127,6 +130,76 @@ margin-top: 0em; } + #existing h3 { + margin-top: 0em; + } + + #existing_report h3 { + margin-bottom: 5px; + } + + #existing_report div.meta { + font-weight: italic; + font-size: 0.8em; + margin-bottom: 0.5em; + } + + #existing_report div.photo { + text-align: right; + float: right; + margin: 0em 0em 0.5em 0em; + } + + #existing_report div.photo img.small { + width: 200px; + } + + /* taken from http://www.mobify.com/blog/multiline-ellipsis-in-pure-css/ */ + #existing_report div.details { + max-height: 200px; + overflow: hidden; + line-height: 20px; + } + + #existing_report div.details:before { + content:""; + float: left; + width: 5px; height: 200px; + } + + #existing_report div.details > *:first-child { + float: right; + width: 100%; + margin-left: -5px; + } + + #existing_report div.details:after { + content: "\02026"; + + box-sizing: content-box; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + + float: right; position: relative; + top: -20px; left: 100%; + width: 3em; margin-left: -3em; + padding-right: 5px; + + text-align: right; + + background: -webkit-gradient(linear, left top, right top, + from(rgba(255, 255, 255, 0)), to(white), color-stop(50%, white)); + background: -moz-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white); + background: -o-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white); + background: -ms-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white); + background: linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white); + } + + #existing div.right { + clear: both; + margin-top: 0.5em; + } + .frontpage-menu{ padding: 0px; } @@ -221,14 +294,19 @@ background-color: rgb(248,248,248); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5); } - + + #locating p { + margin-left: 15px; + margin-right: 15px; + } + #OpenLayers_Control_Crosshairs_crosshairs{ pointer-events: none; } - + #login-options a.loggedin .signout{ display:block; - + } #map_box{ background-color: #534741; diff --git a/www/js/models/report.js b/www/js/models/report.js index 529a6d8..2508b3f 100644 --- a/www/js/models/report.js +++ b/www/js/models/report.js @@ -72,6 +72,7 @@ if ( model.get('submit_clicked') == 'submit_sign_in' ) { params.submit_sign_in = 1; params.password_sign_in = model.get('user').get('password'); + params.remember_me = 1; } else { params.password_register = model.get('user').get('password') || ''; params.submit_register = 1; @@ -80,6 +81,7 @@ var that = this; if ( model.get('file') && model.get('file') !== '' ) { var fileUploadSuccess = function(r) { + $.mobile.loading('hide'); if ( r.response ) { var data; try { @@ -99,6 +101,7 @@ }; var fileUploadFail = function() { + $.mobile.loading('hide'); that.trigger('error', that, FMS.strings.report_send_error, options); }; @@ -112,6 +115,7 @@ fileOptions.chunkedMode = false; var ft = new FileTransfer(); + $.mobile.loading('show'); ft.upload(fileURI, CONFIG.FMS_URL + "report/new/mobile", fileUploadSuccess, fileUploadFail, fileOptions); } else { $.ajax( { diff --git a/www/js/views/around.js b/www/js/views/around.js index 419c990..834c442 100644 --- a/www/js/views/around.js +++ b/www/js/views/around.js @@ -41,13 +41,13 @@ afterDisplay: function() { if ( FMS.isOffline ) { this.navigate( 'offline' ); + } else if ( this.model && this.model.get('lat') ) { + var modelInfo = { coordinates: { latitude: this.model.get('lat'), longitude: this.model.get('lon') } }; + this.gotLocation(modelInfo); } else if ( FMS.currentPosition ) { var info = { coordinates: FMS.currentPosition }; FMS.currentPosition = null; this.gotLocation(info); - } else if ( this.model && this.model.get('lat') ) { - var modelInfo = { coordinates: { latitude: this.model.get('lat'), longitude: this.model.get('lon') } }; - this.gotLocation(modelInfo); } else { this.locate(); } diff --git a/www/js/views/existing.js b/www/js/views/existing.js index 4f761fd..21a3404 100644 --- a/www/js/views/existing.js +++ b/www/js/views/existing.js @@ -13,17 +13,20 @@ 'vclick #discard': 'discardReport' }, - useReport: function() { + useReport: function(e) { + e.preventDefault(); FMS.setCurrentDraft(this.model); this.navigate('around'); }, - saveReport: function() { + saveReport: function(e) { + e.preventDefault(); FMS.clearCurrentDraft(); this.navigate('around'); }, - discardReport: function() { + discardReport: function(e) { + e.preventDefault(); var reset = FMS.removeDraft(this.model.id, true); var that = this; reset.done( function() { that.onDraftRemove(); } ); diff --git a/www/js/views/photo.js b/www/js/views/photo.js index 041d573..74f3933 100644 --- a/www/js/views/photo.js +++ b/www/js/views/photo.js @@ -27,12 +27,14 @@ } }, - takePhoto: function() { + 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() { + 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 }); }, @@ -47,9 +49,9 @@ FMS.saveCurrentDraft(); $('#photo-next-btn .ui-btn-text').text('Next'); - $('#id_del_photo_button').show(); - $('#id_photo_button').hide(); - $('#id_existing').hide(); + $('#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(); } ); @@ -63,7 +65,8 @@ } }, - deletePhoto: function() { + deletePhoto: function(e) { + e.preventDefault(); var that = this; var del = FMS.files.deleteURI( this.model.get('file') ); @@ -73,9 +76,9 @@ $('#photo').attr('src', 'images/placeholder-photo.png'); $('#photo-next-btn .ui-btn-text').text('Skip'); - $('#id_del_photo_button').hide(); - $('#id_photo_button').show(); - $('#id_existing').show(); + $('#id_del_photo_button').parents('.ui-btn').hide(); + $('#id_photo_button').parents('.ui-btn').show(); + $('#id_existing').parents('.ui-btn').show(); }); } diff --git a/www/js/views/submit.js b/www/js/views/submit.js index e408a2e..3e1ef8e 100644 --- a/www/js/views/submit.js +++ b/www/js/views/submit.js @@ -235,6 +235,7 @@ }, beforeSubmit: function() { + $('#report').focus(); if ( $('#form_name').val() ) { this.model.set('submit_clicked', 'submit_register'); this.model.set('phone', $('#form_phone').val()); diff --git a/www/templates/en/around.html b/www/templates/en/around.html index a2a6b11..7ff5564 100644 --- a/www/templates/en/around.html +++ b/www/templates/en/around.html @@ -16,8 +16,8 @@ the map when it's <% print( CONFIG.ACCURACY ) %>m or better. </p> - <div style="width:100%; height:10px; border:1px solid black;"> - <div id="progress-bar" style="width:0%; background-color: grey; height:10px;"> + <div style="width:100%; height:15px; border:1px solid black;"> + <div id="progress-bar" style="width:0%; background-color: grey; height:15px;"> </div> </div> @@ -26,7 +26,7 @@ </p> <p> - <input type="button" id="locate_search" value="Search"> + <input data-theme="a" type="button" id="locate_search" value="Search"> </p> </div> <script type="text/javascript"> diff --git a/www/templates/en/existing.html b/www/templates/en/existing.html index 03e6539..bb5b326 100644 --- a/www/templates/en/existing.html +++ b/www/templates/en/existing.html @@ -1,30 +1,33 @@ <div data-role="header"> - <h1>Draft Report</h1> + <h1>In progress</h1> </div> <div data-role="content" role="main"> - <h2>You have an unsubmitted report</h2> - - <ul id="existing"> - <% if (lat) { %> - <li>This report has a location</li> - <% } %> - + <div id="existing_report"> <% if ( title ) { %> - <li>title: <%= title %></li> + <h3><%= title %></h3> <% } %> - <% if ( details ) { %> - <li>details: <%= details %></li> - <% } %> + <div class="meta"> + <% if (lat) { %> + <span>Saved with a location</span> + <% } %> - <% if ( category && category != '-- Pick a category --' ) { %> - <li>category: <%= category %></li> - <% } %> - </ul> + <% if ( category && category != '-- Pick a category --' ) { %> + <span> in the <%= category %> category</span> + <% } %> + + <span> <% print( moment( created ).fromNow() ) %></span> + </div> + + <% if ( file ) { %> + <div class="photo"><img class="small" src="<%= file %>"></div> + <% } %> + + <% if ( details ) { %> + <div class="details"><div><%= details %></div></div> + <% } %> + </div> - <% if ( file ) { %> - <div class="photo"><img class="small" src="<%= file %>"></div> - <% } %> <div class="right"> <input id="use_report" type="button" value="use" data-role="button" data-theme="a" /> diff --git a/www/templates/en/photo.html b/www/templates/en/photo.html index c0373a2..7ba6a00 100644 --- a/www/templates/en/photo.html +++ b/www/templates/en/photo.html @@ -17,5 +17,5 @@ </div> <input type="button" id="id_existing" data-theme="c" value="Add an existing photo" > <input id="id_photo_button" type="button" data-theme="a" value="Take a new photo"> - <input id="id_del_photo_button" type="button" data-theme="a" valu="Remove Photo"> + <input id="id_del_photo_button" type="button" data-theme="a" value="Remove Photo"> </div> |