better phone alert and optimization
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
window.Qwaiter=
|
window.Qwaiter=
|
||||||
alert: (msg) ->
|
alert: (msg) ->
|
||||||
alert(msg)
|
template = @mustache('#alert-template', {title: 'Alert', message: msg, close: 'OK'})
|
||||||
confirm: (options) ->
|
$(template).modal()
|
||||||
|
false
|
||||||
|
confirm: (options) ->
|
||||||
options ||= {}
|
options ||= {}
|
||||||
content = options.content || 'Are you sure?'
|
content = options.content || 'Are you sure?'
|
||||||
title = options.title || 'Confirm'
|
title = options.title || 'Confirm'
|
||||||
@@ -24,6 +26,13 @@ window.Qwaiter=
|
|||||||
currency: (num) ->
|
currency: (num) ->
|
||||||
num = 0.0 if isNaN(num) || num == '' || num == null
|
num = 0.0 if isNaN(num) || num == '' || num == null
|
||||||
'€ ' + parseFloat(num).toFixed(2)
|
'€ ' + parseFloat(num).toFixed(2)
|
||||||
|
mustache: (selector, locals)->
|
||||||
|
locs = $.extend(locals,
|
||||||
|
currency: ->
|
||||||
|
(val)->
|
||||||
|
currency(Mustache.render(val, this))
|
||||||
|
)
|
||||||
|
Mustache.to_html($(selector).html(), locs)
|
||||||
|
|
||||||
jQuery.ajaxSetup
|
jQuery.ajaxSetup
|
||||||
'beforeSend': (xhr) ->
|
'beforeSend': (xhr) ->
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class Quser
|
|||||||
$('#order-row-'+e.data.id).addClass('active')
|
$('#order-row-'+e.data.id).addClass('active')
|
||||||
if(e.event == 'order_being_delivered')
|
if(e.event == 'order_being_delivered')
|
||||||
$('#order-row-'+e.data.id).addClass('delivered')
|
$('#order-row-'+e.data.id).addClass('delivered')
|
||||||
console.log(e)
|
|
||||||
false
|
false
|
||||||
home_loader: ->
|
home_loader: ->
|
||||||
$.getJSON(data_host + '/user/list_info.json?' + authentication_string, (res) => @handle_active_list_default_actions(res))
|
$.getJSON(data_host + '/user/list_info.json?' + authentication_string, (res) => @handle_active_list_default_actions(res))
|
||||||
@@ -200,7 +199,7 @@ class Quser
|
|||||||
body.find('tr').remove()
|
body.find('tr').remove()
|
||||||
foot.find('tr').remove()
|
foot.find('tr').remove()
|
||||||
if !res.orders && !res.orders.length
|
if !res.orders && !res.orders.length
|
||||||
alert('No orders in list')
|
Qwaiter.alert('No orders in list')
|
||||||
return
|
return
|
||||||
m_obj = res
|
m_obj = res
|
||||||
body.append @mustache('#active-list-order-template', new Order(order)) for order in m_obj.orders
|
body.append @mustache('#active-list-order-template', new Order(order)) for order in m_obj.orders
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<div class="modal hide fade" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{{title}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>{{message}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">{{close}}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -17,39 +17,38 @@ html lang="en"
|
|||||||
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
|
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
|
||||||
link href="/favicon.ico" rel="shortcut icon"
|
link href="/favicon.ico" rel="shortcut icon"
|
||||||
javascript:
|
javascript:
|
||||||
var data_host = '#{Rails.env == 'development' ? 'http://qwaiter.dev' : 'http://data.qwaiter.com' }';
|
var data_host = 'http://data.qwaiter.com';
|
||||||
//var data_host = 'http://localhost:3000';
|
|
||||||
var event_host = '#{event_host}';
|
var event_host = '#{event_host}';
|
||||||
//data_host = 'http://192.168.1.148:3000';
|
|
||||||
var $locale = 'en';
|
var $locale = 'en';
|
||||||
var $url_vars = null;
|
var $url_vars = null;
|
||||||
// Dummy holder when Qmobile object is not supplied by the mobile phone
|
|
||||||
var QMobile, Qwaiter, Quser;
|
var QMobile, Qwaiter, Quser;
|
||||||
QMobile || (QMobile = {
|
- unless ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
|
||||||
scanQr: function(){window.location = '/select_qrcode'},
|
javascript:
|
||||||
activateRotation: function(){},
|
#{Rails.env.production? ? '' : "data_host = 'http://qwaiter.dev';"}
|
||||||
mobile: function(){return false},
|
//var data_host = 'http://localhost:3000';
|
||||||
authentication_string: function(){return this.authentication_string_storage || ''},
|
QMobile || (QMobile = {
|
||||||
authentication_object: function(){return this.authentication_object_storage || '{}'},
|
scanQr: function(){window.location = '/select_qrcode'},
|
||||||
setAuthToken: function(token){
|
activateRotation: function(){},
|
||||||
this.auth_token = token;
|
mobile: function(){return false},
|
||||||
this.authentication_string_storage = 'auth_token='+token;
|
authentication_string: function(){return this.authentication_string_storage || ''},
|
||||||
this.authentication_object_storage = '{"auth_token": "'+token+'"}'
|
authentication_object: function(){return this.authentication_object_storage || '{}'},
|
||||||
},
|
setAuthToken: function(token){
|
||||||
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
|
this.auth_token = token;
|
||||||
root_url: function(){return ''},
|
this.authentication_string_storage = 'auth_token='+token;
|
||||||
goHome: function(){ redirect_to('user_root')},
|
this.authentication_object_storage = '{"auth_token": "'+token+'"}'
|
||||||
connection_problem: function(){alert('There is a problem connecting to the server')},
|
},
|
||||||
locale: function(){ return $locale || ($locale = 'en')},
|
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
|
||||||
setLocale: function(locale){$locale = locale; return locale},
|
root_url: function(){return ''},
|
||||||
token: function(){return this.auth_token},
|
goHome: function(){ redirect_to('user_root')},
|
||||||
setUserId: function(id){ this.stored_user_id = id},
|
connection_problem: function(){alert('There is a problem connecting to the server')},
|
||||||
user_id: function(){return this.stored_user_id },
|
locale: function(){ return $locale || ($locale = 'en')},
|
||||||
log: function(str){console.log(str)}
|
setLocale: function(locale){$locale = locale; return locale},
|
||||||
});
|
token: function(){return this.auth_token},
|
||||||
|
setUserId: function(id){ this.stored_user_id = id},
|
||||||
#{Rails.env.production? ? '' : %|QMobile.setAuthToken('#{current_user.authentication_token}');QMobile.setUserId('#{current_user.id}');|}
|
user_id: function(){return this.stored_user_id },
|
||||||
QMobile.log('token: '+QMobile.authentication_string()+' user_id:'+QMobile.user_id()+' ====================================================================');
|
log: function(str){console.log(str)}
|
||||||
|
});
|
||||||
|
QMobile.setAuthToken('#{current_user.authentication_token}');QMobile.setUserId('#{current_user.id}');
|
||||||
|
|
||||||
body class=action_name
|
body class=action_name
|
||||||
.navbar.navbar-fixed-top
|
.navbar.navbar-fixed-top
|
||||||
@@ -76,11 +75,8 @@ html lang="en"
|
|||||||
.row
|
.row
|
||||||
.span12
|
.span12
|
||||||
= yield
|
= yield
|
||||||
/
|
|
||||||
Javascripts
|
|
||||||
\==================================================
|
|
||||||
/ Placed at the end of the document so the pages load faster
|
|
||||||
= javascript_include_tag "user/application"
|
= javascript_include_tag "user/application"
|
||||||
|
script#alert-template[type="text/html"]= render 'alert.mustache'
|
||||||
= yield :footer
|
= yield :footer
|
||||||
javascript:
|
javascript:
|
||||||
jQuery(function(){#{onload_javascript}});
|
jQuery(function(){#{onload_javascript}});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
rm -rf public/assets;
|
rm -rf public/assets;
|
||||||
|
QWAITER_MOBILE_EXPORT=yes
|
||||||
RAILS_ENV=production rake assets:precompile;
|
RAILS_ENV=production rake assets:precompile;
|
||||||
RAILS_ENV=production rails runner script/build_mobile_app.rb
|
RAILS_ENV=production rails runner script/build_mobile_app.rb
|
||||||
|
|||||||
Reference in New Issue
Block a user