better phone alert and optimization

This commit is contained in:
2012-11-29 21:59:19 +01:00
parent 68f3437f8d
commit 8e2ff5ebad
5 changed files with 55 additions and 38 deletions
+29 -33
View File
@@ -17,39 +17,38 @@ html lang="en"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon"
javascript:
var data_host = '#{Rails.env == 'development' ? 'http://qwaiter.dev' : 'http://data.qwaiter.com' }';
//var data_host = 'http://localhost:3000';
var data_host = 'http://data.qwaiter.com';
var event_host = '#{event_host}';
//data_host = 'http://192.168.1.148:3000';
var $locale = 'en';
var $url_vars = null;
// Dummy holder when Qmobile object is not supplied by the mobile phone
var QMobile, Qwaiter, Quser;
QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){},
mobile: function(){return false},
authentication_string: function(){return this.authentication_string_storage || ''},
authentication_object: function(){return this.authentication_object_storage || '{}'},
setAuthToken: function(token){
this.auth_token = token;
this.authentication_string_storage = 'auth_token='+token;
this.authentication_object_storage = '{"auth_token": "'+token+'"}'
},
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
root_url: function(){return ''},
goHome: function(){ redirect_to('user_root')},
connection_problem: function(){alert('There is a problem connecting to the server')},
locale: function(){ return $locale || ($locale = 'en')},
setLocale: function(locale){$locale = locale; return locale},
token: function(){return this.auth_token},
setUserId: function(id){ this.stored_user_id = id},
user_id: function(){return this.stored_user_id },
log: function(str){console.log(str)}
});
#{Rails.env.production? ? '' : %|QMobile.setAuthToken('#{current_user.authentication_token}');QMobile.setUserId('#{current_user.id}');|}
QMobile.log('token: '+QMobile.authentication_string()+' user_id:'+QMobile.user_id()+' ====================================================================');
- unless ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
javascript:
#{Rails.env.production? ? '' : "data_host = 'http://qwaiter.dev';"}
//var data_host = 'http://localhost:3000';
QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){},
mobile: function(){return false},
authentication_string: function(){return this.authentication_string_storage || ''},
authentication_object: function(){return this.authentication_object_storage || '{}'},
setAuthToken: function(token){
this.auth_token = token;
this.authentication_string_storage = 'auth_token='+token;
this.authentication_object_storage = '{"auth_token": "'+token+'"}'
},
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
root_url: function(){return ''},
goHome: function(){ redirect_to('user_root')},
connection_problem: function(){alert('There is a problem connecting to the server')},
locale: function(){ return $locale || ($locale = 'en')},
setLocale: function(locale){$locale = locale; return locale},
token: function(){return this.auth_token},
setUserId: function(id){ this.stored_user_id = id},
user_id: function(){return this.stored_user_id },
log: function(str){console.log(str)}
});
QMobile.setAuthToken('#{current_user.authentication_token}');QMobile.setUserId('#{current_user.id}');
body class=action_name
.navbar.navbar-fixed-top
@@ -76,11 +75,8 @@ html lang="en"
.row
.span12
= yield
/
Javascripts
\==================================================
/ Placed at the end of the document so the pages load faster
= javascript_include_tag "user/application"
script#alert-template[type="text/html"]= render 'alert.mustache'
= yield :footer
javascript:
jQuery(function(){#{onload_javascript}});