aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/views')
-rw-r--r--www/js/views/around.js2
-rw-r--r--www/js/views/fms.js2
-rw-r--r--www/js/views/home.js3
-rw-r--r--www/js/views/login.js26
4 files changed, 24 insertions, 9 deletions
diff --git a/www/js/views/around.js b/www/js/views/around.js
index cb304ee..bafc65d 100644
--- a/www/js/views/around.js
+++ b/www/js/views/around.js
@@ -197,7 +197,7 @@
},
displayHelpIfFirstTime: function() {
- if ( !FMS.usedBefore ) {
+ if ( !FMS.usedBefore && !CONFIG.HELP_DISABLED ) {
FMS.helpShow();
}
},
diff --git a/www/js/views/fms.js b/www/js/views/fms.js
index 6ff569b..aef854f 100644
--- a/www/js/views/fms.js
+++ b/www/js/views/fms.js
@@ -107,7 +107,7 @@
$('.form-error').removeClass('form-error');
},
- destroy: function() { FMS.printDebug('destory for ' + this.id); this._destroy(); this.remove(); },
+ destroy: function() { FMS.printDebug('destroy for ' + this.id); this._destroy(); this.remove(); },
_destroy: function() {}
})
diff --git a/www/js/views/home.js b/www/js/views/home.js
index 998af1c..05ee2f7 100644
--- a/www/js/views/home.js
+++ b/www/js/views/home.js
@@ -24,8 +24,11 @@
afterDisplay: function() {
$('#load-screen').hide();
+
if ( FMS.isOffline ) {
this.navigate( 'offline' );
+ } else if ( !FMS.isLoggedIn && CONFIG.LOGIN_REQUIRED ) {
+ this.navigate( 'login' );
} else if ( FMS.currentDraft && (
FMS.currentDraft.get('title') || FMS.currentDraft.get('lat') ||
FMS.currentDraft.get('details') || FMS.currentDraft.get('file') )
diff --git a/www/js/views/login.js b/www/js/views/login.js
index c0f16ba..93a9a5b 100644
--- a/www/js/views/login.js
+++ b/www/js/views/login.js
@@ -40,8 +40,7 @@
that.model.set('name', data.name);
that.model.save();
FMS.isLoggedIn = 1;
- that.$('#password_row').hide();
- that.$('#success_row').show();
+ that.rerender();
} else {
that.validationError('signinForm', FMS.strings.login_details_error);
}
@@ -65,11 +64,7 @@
FMS.isLoggedIn = 0;
that.model.set('password', '');
that.model.save();
- that.$('#form_email').val('');
- that.$('#form_password').val('');
- that.$('#success_row').hide();
- that.$('#signed_in_row').hide();
- that.$('#password_row').show();
+ that.rerender();
},
error: function() {
that.validationError('err', FMS.strings.logout_error);
@@ -102,6 +97,23 @@
}
return isValid;
+ },
+
+ beforeDisplay: function() {
+ this.fixPageHeight();
+ if ( !FMS.isLoggedIn && CONFIG.LOGIN_REQUIRED ) {
+ this.$("#reports-next-btn").hide();
+ }
+ },
+
+ rerender: function() {
+ // Simply calling this.render() breaks the DOM in a weird and
+ // interesting way - somehow the main view element is duplicated
+ // instead of replaced and none of the event handlers are
+ // hooked up so you end up with a blank screen.
+ // This is a convenience wrapper around the correct router call
+ // which works around the problem.
+ FMS.router.login();
}
})
});