diff options
Diffstat (limited to 'src/js/views')
-rw-r--r-- | src/js/views/login.js | 7 | ||||
-rw-r--r-- | src/js/views/reports.js | 16 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/js/views/login.js b/src/js/views/login.js index 28eaf96..c0f16ba 100644 --- a/src/js/views/login.js +++ b/src/js/views/login.js @@ -20,6 +20,7 @@ onClickLogin: function(e) { // prevent form submission from onscreen keyboard e.preventDefault(); + $('#login').focus(); if ( this.validate() ) { var that = this; $.ajax( { @@ -41,14 +42,12 @@ FMS.isLoggedIn = 1; that.$('#password_row').hide(); that.$('#success_row').show(); - $('#logout').focus(); } else { - $('#login').focus(); - that.validationError('form_email', FMS.strings.login_details_error); + that.validationError('signinForm', FMS.strings.login_details_error); } }, error: function() { - that.validationError('form_email', FMS.strings.login_error); + that.validationError('signinForm', FMS.strings.login_error); } } ); } diff --git a/src/js/views/reports.js b/src/js/views/reports.js index f68944d..3e58658 100644 --- a/src/js/views/reports.js +++ b/src/js/views/reports.js @@ -44,6 +44,22 @@ var el = $(e.target); var id = el.parents('li').attr('id'); FMS.currentDraft = FMS.allDrafts.get(id); + $('#drafts').hide(); + if ( FMS.currentDraft && FMS.currentDraft.get('lat') ) { + var coords = { latitude: FMS.currentDraft.get('lat'), longitude: FMS.currentDraft.get('lon') }; + fixmystreet.latitude = coords.latitude; + fixmystreet.longitude = coords.longitude; + + if ( fixmystreet.map ) { + var centre = new OpenLayers.LonLat( coords.longitude, coords.latitude ); + centre.transform( + new OpenLayers.Projection("EPSG:4326"), + fixmystreet.map.getProjectionObject() + ); + + fixmystreet.map.panTo(centre); + } + } this.navigate('around'); }, |