diff options
author | Struan Donald <struan@exo.org.uk> | 2013-02-28 11:07:48 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-02-28 11:07:48 +0000 |
commit | 2ac9ca08ebc95fddb75b39813d7ed85f09bb92f3 (patch) | |
tree | 3479e9871324f24c1d09b0bddf2dd7470998b784 /www/js/views | |
parent | 24fcbd330f20725252a803efaa0631130b965028 (diff) |
WIP around page display
Diffstat (limited to 'www/js/views')
-rw-r--r-- | www/js/views/around.js | 18 | ||||
-rw-r--r-- | www/js/views/fms.js | 4 | ||||
-rw-r--r-- | www/js/views/home.js | 31 |
3 files changed, 52 insertions, 1 deletions
diff --git a/www/js/views/around.js b/www/js/views/around.js new file mode 100644 index 0000000..ba0e62e --- /dev/null +++ b/www/js/views/around.js @@ -0,0 +1,18 @@ +;(function (FMS, Backbone, _, $) { + _.extend( FMS, { + AroundView: FMS.FMSView.extend({ + template: 'around', + tag: 'div', + id: 'around-page', + + afterDisplay: function() { + console.log( 'around after display'); + fixmystreet.latitude = 56.33182; + fixmystreet.longitude = -2.79483; + + show_map(); + console.log('map shown'); + } + }) + }); +})(FMS, Backbone, _, $); diff --git a/www/js/views/fms.js b/www/js/views/fms.js index 45eeabf..d827445 100644 --- a/www/js/views/fms.js +++ b/www/js/views/fms.js @@ -19,6 +19,8 @@ afterRender: function() {}, + afterDisplay: function() {}, + onClickButtonPrev: function() { this.navigate( this.prev, 'right' ); }, @@ -26,6 +28,8 @@ onClickButtonNext: function() { this.navigate( this.next, 'left' ); }, + + destroy: function() { console.log('destory for ' + this.id); this.remove(); } }) }); })(FMS, Backbone, _, $); diff --git a/www/js/views/home.js b/www/js/views/home.js index 644754d..cfa6167 100644 --- a/www/js/views/home.js +++ b/www/js/views/home.js @@ -3,7 +3,36 @@ HomeView: FMS.FMSView.extend({ template: 'home', tag: 'div', - id: 'front-page' + id: 'front-page', + + afterRender: function() { + /* + if ( !can_geolocate && ( !navigator.network || !navigator.network.connection ) ) { + geocheck_count++; + window.setTimeout( decide_front_page, 1000 ); + return; + } + + // sometime onDeviceReady does not fire so set this here to be sure + can_geolocate = true; + + geocheck_count = 0; + */ + + $('#locating').show(); + + }, + + afterDisplay: function() { + if ( navigator && navigator.network && ( navigator.network.connection.type == Connection.NONE || + navigator.network.connection.type == Connection.UNKNOWN ) ) { + localStorage.offline = 1; + FMS.router.navigate( 'no_connection' ); + } else { + alert('pause'); + FMS.router.navigate( 'around', { trigger: true } ); + } + } }) }); })(FMS, Backbone, _, $); |