bug fixes
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 355 B |
Binary file not shown.
|
After Width: | Height: | Size: 486 B |
@@ -8,6 +8,7 @@ window.Qwaiter=
|
|||||||
content = options.content || 'Are you sure?'
|
content = options.content || 'Are you sure?'
|
||||||
title = options.title || 'Confirm'
|
title = options.title || 'Confirm'
|
||||||
wrapper = $('<div class="modal"></div>')
|
wrapper = $('<div class="modal"></div>')
|
||||||
|
if typeof(options.ok) == 'function'
|
||||||
callback_wrapper = ->
|
callback_wrapper = ->
|
||||||
wrapper.modal('hide')
|
wrapper.modal('hide')
|
||||||
options.ok()
|
options.ok()
|
||||||
@@ -18,9 +19,16 @@ window.Qwaiter=
|
|||||||
.append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>')
|
.append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>')
|
||||||
.append('<h3>'+title+'</h3>').appendTo(wrapper)
|
.append('<h3>'+title+'</h3>').appendTo(wrapper)
|
||||||
body = $('<div class="modal-body"></div>').append('<p>'+content+'</p>').appendTo(wrapper)
|
body = $('<div class="modal-body"></div>').append('<p>'+content+'</p>').appendTo(wrapper)
|
||||||
|
ok_button = $('<a href="#" class="btn btn-primary">Yes</a>')
|
||||||
|
if typeof(options.ok) == 'function'
|
||||||
|
ok_button.click(callback_wrapper)
|
||||||
|
else
|
||||||
|
ok_button.click ->
|
||||||
|
eval(options.ok)
|
||||||
|
wrapper.modal('hide')
|
||||||
footer = $('<div class="modal-footer"></div>')
|
footer = $('<div class="modal-footer"></div>')
|
||||||
.append($('<a href="#" class="btn">Close</a>').click(callback_cancel_wrapper))
|
.append($('<a href="#" class="btn">Close</a>').click(callback_cancel_wrapper))
|
||||||
.append($('<a href="#" class="btn btn-primary">Yes</a>').click(callback_wrapper))
|
.append(ok_button)
|
||||||
.appendTo(wrapper)
|
.appendTo(wrapper)
|
||||||
wrapper.modal()
|
wrapper.modal()
|
||||||
currency: (num) ->
|
currency: (num) ->
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ root.Qsupplier=
|
|||||||
$('#list-is-helped-button-'+list_id).addClass('hide')
|
$('#list-is-helped-button-'+list_id).addClass('hide')
|
||||||
else if e.event == 'order_being_processed'
|
else if e.event == 'order_being_processed'
|
||||||
$('#order-in-process-button-'+e.data.id).hide()
|
$('#order-in-process-button-'+e.data.id).hide()
|
||||||
|
$('#order-row-'+e.data.id).removeClass('placed').addClass('active')
|
||||||
else if e.event == 'order_being_delivered'
|
else if e.event == 'order_being_delivered'
|
||||||
$('#order-row-'+e.data.id).remove()
|
$('#order-row-'+e.data.id).remove()
|
||||||
else if e.event == 'list_changed_table'
|
else if e.event == 'list_changed_table'
|
||||||
@@ -114,7 +115,7 @@ root.Qsupplier=
|
|||||||
load_active_orders: () ->
|
load_active_orders: () ->
|
||||||
$.get('/supplier/active_orders.json?section_id='+($('#current_section_selector').val() || ''), (res) =>
|
$.get('/supplier/active_orders.json?section_id='+($('#current_section_selector').val() || ''), (res) =>
|
||||||
body = $('#active-orders-table tbody')
|
body = $('#active-orders-table tbody')
|
||||||
body.find('tr').remove()
|
body.html('')
|
||||||
foot = $('#active-orders-table tfoot')
|
foot = $('#active-orders-table tfoot')
|
||||||
if(!res.orders && !res.orders.length)
|
if(!res.orders && !res.orders.length)
|
||||||
alert('No orders in list')
|
alert('No orders in list')
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ class Quser
|
|||||||
watch_events: ->
|
watch_events: ->
|
||||||
faye = new Faye.Client(event_host)
|
faye = new Faye.Client(event_host)
|
||||||
user_id = Qstorage.getItem('user_id')
|
user_id = Qstorage.getItem('user_id')
|
||||||
return unless user_id && user_id.length > 0
|
unless user_id
|
||||||
|
@reset_user()
|
||||||
|
redirect_to 'obtain_token'
|
||||||
|
return false
|
||||||
faye.subscribe "/user/"+user_id, (e)=>
|
faye.subscribe "/user/"+user_id, (e)=>
|
||||||
if(e.event == 'list_closed')
|
if(e.event == 'list_closed')
|
||||||
#redirect_to 'user_root', {list_closed: 'true'}
|
#redirect_to 'user_root', {list_closed: 'true'}
|
||||||
@@ -41,6 +44,8 @@ class Quser
|
|||||||
$('.list-total-amount').html(currency(e.data.total_amount))
|
$('.list-total-amount').html(currency(e.data.total_amount))
|
||||||
console.log(e)
|
console.log(e)
|
||||||
false
|
false
|
||||||
|
ensure_json: (res)->
|
||||||
|
if typeof(res) == 'string' then JSON.parse(res) else res
|
||||||
reset_user: ->
|
reset_user: ->
|
||||||
Qstorage.removeItem('auth_token')
|
Qstorage.removeItem('auth_token')
|
||||||
Qstorage.removeItem('user_id')
|
Qstorage.removeItem('user_id')
|
||||||
@@ -51,6 +56,7 @@ class Quser
|
|||||||
return email.focus() unless email.val() && email.val().length > 0
|
return email.focus() unless email.val() && email.val().length > 0
|
||||||
return password.focus() unless password.val() && password.val().length > 0
|
return password.focus() unless password.val() && password.val().length > 0
|
||||||
$.post(data_host + '/user/obtain_token.json', {"user[email]": email.val(), "user[password]": password.val()}, (res)=>
|
$.post(data_host + '/user/obtain_token.json', {"user[email]": email.val(), "user[password]": password.val()}, (res)=>
|
||||||
|
res = @ensure_json(res)
|
||||||
if res.auth_token
|
if res.auth_token
|
||||||
Qstorage.setItem('auth_token', res.auth_token)
|
Qstorage.setItem('auth_token', res.auth_token)
|
||||||
Qstorage.setItem('user_id', res.user_id)
|
Qstorage.setItem('user_id', res.user_id)
|
||||||
@@ -111,37 +117,18 @@ class Quser
|
|||||||
)).modal()
|
)).modal()
|
||||||
false
|
false
|
||||||
approve_join_request: (user_id)->
|
approve_join_request: (user_id)->
|
||||||
$.post(data_host + '/user/approve_join_request', $.extend({user_id: user_id}, authentication_object), -> window.join_request_active = false)
|
@ensure_token =>
|
||||||
|
$.post(data_host + '/user/approve_join_request', $.extend({user_id: user_id}, @authentication_object), -> window.join_request_active = false)
|
||||||
reject_join_request: (user_id)->
|
reject_join_request: (user_id)->
|
||||||
$.post(data_host + '/user/reject_join_request', $.extend({user_id: user_id}, authentication_object), -> window.join_request_active = false)
|
@ensure_token =>
|
||||||
bogus1: ->
|
$.post(data_host + '/user/reject_join_request', $.extend({user_id: user_id}, @authentication_object), -> window.join_request_active = false)
|
||||||
wrapper = $('<div class="modal"></div>')
|
list_needs_help: ->
|
||||||
join_callback = ( (request)->
|
return unless window.active_list && !window.active_list.needs_help
|
||||||
->
|
@ensure_token =>
|
||||||
$.post(data_host + '/user/approve_join_request', $.extend({user_id: request.user_id}, authentication_object), -> window.join_request_active = false; wrapper.modal('hide') )
|
$.post(data_host + '/user/needs_help.json', @authentication_object, (res) => window.active_list = @ensure_json(res); @list_needs_help_default_action())
|
||||||
)(join_request)
|
|
||||||
reject_callback = ( (request)->
|
|
||||||
->
|
|
||||||
$.post(data_host + '/user/reject_join_request', $.extend({user_id: request.user_id}, authentication_object), -> window.join_request_active = false; wrapper.modal('hide' ))
|
|
||||||
)(join_request)
|
|
||||||
header = $('<div class="modal-header"></div>')
|
|
||||||
.append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>')
|
|
||||||
.append($('<h3></h3>').text(t('join_request.title'))).appendTo(wrapper)
|
|
||||||
|
|
||||||
body = $('<div class="modal-body"></div>')
|
|
||||||
#body.append(join_request.user_email + ' wants to join the table')
|
|
||||||
body.text(t('join_request.body', {email: join_request.user_email}))
|
|
||||||
|
|
||||||
body.appendTo(wrapper)
|
|
||||||
|
|
||||||
footer = $('<div class="modal-footer"></div>')
|
|
||||||
.append($('<a href="#" class="btn"></a>').text(t('join_request.reject')).click(reject_callback))
|
|
||||||
.append($('<a href="#" class="btn btn-primary"></a>').text(t('join_request.approve')).click(join_callback))
|
|
||||||
.appendTo(wrapper)
|
|
||||||
wrapper.modal()
|
|
||||||
|
|
||||||
list_needs_help_default_action: (response)=>
|
list_needs_help_default_action: (response)=>
|
||||||
response ||= window.active_list
|
response ||= window.active_list
|
||||||
|
window.active_list = response
|
||||||
needs_help_container = $('#list-needs-help-button')
|
needs_help_container = $('#list-needs-help-button')
|
||||||
if needs_help_container.length
|
if needs_help_container.length
|
||||||
if response.needs_help
|
if response.needs_help
|
||||||
@@ -158,15 +145,17 @@ class Quser
|
|||||||
Qwaiter.confirm(
|
Qwaiter.confirm(
|
||||||
title: t('list_needs_help.title')
|
title: t('list_needs_help.title')
|
||||||
content: t('list_needs_help.content')
|
content: t('list_needs_help.content')
|
||||||
ok: window.Quser.list_needs_help
|
ok: 'Quser.list_needs_help()'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
needs_help_container.data('click-initialized', true)
|
needs_help_container.data('click-initialized', true)
|
||||||
list_needs_help: ->
|
list_needs_payment: ->
|
||||||
return unless window.active_list && !window.active_list.needs_help
|
return unless window.active_list && !window.active_list.needs_payment
|
||||||
$.post(data_host + '/user/needs_help.json', authentication_object, (res) => window.active_list = res; window.Quser.list_needs_help_default_action(res))
|
@ensure_token =>
|
||||||
|
$.post(data_host + '/user/list_needs_payment.json', @authentication_object, (res) => window.active_list = @ensure_json(res); @list_needs_payment_default_action())
|
||||||
list_needs_payment_default_action: (response)->
|
list_needs_payment_default_action: (response)->
|
||||||
response ||= window.active_list
|
response ||= window.active_list
|
||||||
|
window.active_list = response
|
||||||
needs_payment_container = $('#list-needs-payment-button')
|
needs_payment_container = $('#list-needs-payment-button')
|
||||||
if needs_payment_container.length
|
if needs_payment_container.length
|
||||||
if response.needs_payment
|
if response.needs_payment
|
||||||
@@ -183,13 +172,10 @@ class Quser
|
|||||||
Qwaiter.confirm(
|
Qwaiter.confirm(
|
||||||
title: t('list_needs_payment.title')
|
title: t('list_needs_payment.title')
|
||||||
content: t('list_needs_payment.content')
|
content: t('list_needs_payment.content')
|
||||||
ok: window.Quser.list_needs_payment
|
ok: 'Quser.list_needs_payment()'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
needs_payment_container.data('click-initialized', true)
|
needs_payment_container.data('click-initialized', true)
|
||||||
list_needs_payment: ->
|
|
||||||
return unless window.active_list && !window.active_list.needs_payment
|
|
||||||
$.post(data_host + '/user/list_needs_payment.json', authentication_object, (res) => window.active_list = res; window.Quser.list_needs_payment_default_action(res))
|
|
||||||
load_active_list: () ->
|
load_active_list: () ->
|
||||||
@ensure_token =>
|
@ensure_token =>
|
||||||
$.getJSON(data_host + '/user/active_list.json?'+@authentication_string, (res) =>
|
$.getJSON(data_host + '/user/active_list.json?'+@authentication_string, (res) =>
|
||||||
@@ -350,8 +336,9 @@ class Quser
|
|||||||
@build_product_list()
|
@build_product_list()
|
||||||
false
|
false
|
||||||
actions_for_table: (table)->
|
actions_for_table: (table)->
|
||||||
table = JSON.parse(table) if typeof(table) == 'string'
|
table = @ensure_json(table)
|
||||||
Qstorage.table_id = table.table_id
|
Qstorage.setItem('table_id', table.table_id)
|
||||||
|
@ensure_token =>
|
||||||
$.getJSON(data_host + '/user/table_info.json?'+@authentication_string+'&table_id='+table.table_id, (res)=>
|
$.getJSON(data_host + '/user/table_info.json?'+@authentication_string+'&table_id='+table.table_id, (res)=>
|
||||||
if res.current_table_id
|
if res.current_table_id
|
||||||
if res.other_supplier
|
if res.other_supplier
|
||||||
|
|||||||
@@ -17,3 +17,19 @@
|
|||||||
margin-right: 7px
|
margin-right: 7px
|
||||||
&.hide
|
&.hide
|
||||||
display: none
|
display: none
|
||||||
|
#active-orders-table
|
||||||
|
tbody
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
&:first-child
|
||||||
|
padding-left: 35px
|
||||||
|
background-position: 5px center
|
||||||
|
background-repeat: no-repeat
|
||||||
|
&.active
|
||||||
|
td
|
||||||
|
&:first-child
|
||||||
|
background-image: image-url('icons/order-check.png')
|
||||||
|
&.delivered
|
||||||
|
td
|
||||||
|
&:first-child
|
||||||
|
background-image: image-url('icons/order-doublecheck.png')
|
||||||
|
|||||||
@@ -104,7 +104,12 @@ body
|
|||||||
#list-needs-payment-button
|
#list-needs-payment-button
|
||||||
span
|
span
|
||||||
background-image: image-url('icons/needs-payment.png')
|
background-image: image-url('icons/needs-payment.png')
|
||||||
|
&.active
|
||||||
|
span
|
||||||
|
background-image: image-url('icons/needs-payment-active.png')
|
||||||
#list-needs-help-button
|
#list-needs-help-button
|
||||||
span
|
span
|
||||||
background-image: image-url('icons/needs-help.png')
|
background-image: image-url('icons/needs-help.png')
|
||||||
|
&.active
|
||||||
|
span
|
||||||
|
background-image: image-url('icons/needs-help-active.png')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<tr id="order-row-{{id}}" class="of-list-{{list_id}}">
|
<tr id="order-row-{{id}}" class="of-list-{{list_id}} {{state}}">
|
||||||
<td>{{display}}</td>
|
<td>{{display}}</td>
|
||||||
<td class="numeric table_number">{{table_number}}</td>
|
<td class="numeric table_number">{{table_number}}</td>
|
||||||
<td class="section_title">{{section_title}}</td>
|
<td class="section_title">{{section_title}}</td>
|
||||||
@@ -7,4 +7,4 @@
|
|||||||
<button id="order-in-process-button-{{id}}" class="btn btn-success {{^can_process}}hide{{/can_process}}" onclick="Qsupplier.mark_order_in_process('{{id}}')">In process!</button>
|
<button id="order-in-process-button-{{id}}" class="btn btn-success {{^can_process}}hide{{/can_process}}" onclick="Qsupplier.mark_order_in_process('{{id}}')">In process!</button>
|
||||||
<button class="btn btn-inverse" onclick="Qsupplier.mark_order_delivered('{{id}}')">Is delivered!</button>
|
<button class="btn btn-inverse" onclick="Qsupplier.mark_order_delivered('{{id}}')">Is delivered!</button>
|
||||||
</td>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ en:
|
|||||||
obtain_token:
|
obtain_token:
|
||||||
title: Authenticate Qwaiter
|
title: Authenticate Qwaiter
|
||||||
obtain: Authenticate
|
obtain: Authenticate
|
||||||
|
invalid_combination: The email password combination is incorrect
|
||||||
section:
|
section:
|
||||||
first_section_title: Room
|
first_section_title: Room
|
||||||
manage_tables:
|
manage_tables:
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ nl:
|
|||||||
obtain_token:
|
obtain_token:
|
||||||
title: Aanmelden bij Qwaiter
|
title: Aanmelden bij Qwaiter
|
||||||
obtain: Aanmelden
|
obtain: Aanmelden
|
||||||
|
invalid_combination: De inloggegevens zijn onjuist
|
||||||
section:
|
section:
|
||||||
first_section_title: Ruimte
|
first_section_title: Ruimte
|
||||||
manage_tables:
|
manage_tables:
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ require "spec_helper"
|
|||||||
describe UserController do
|
describe UserController do
|
||||||
describe "routing" do
|
describe "routing" do
|
||||||
|
|
||||||
it "routes root to #home" do
|
it "routes root to #index" do
|
||||||
get("/user").should route_to("user#home")
|
get("/user").should route_to("user#index")
|
||||||
end
|
end
|
||||||
it "routes to #home" do
|
it "routes to #index" do
|
||||||
get("/user/home").should route_to("user#home")
|
get("/user/index").should route_to("user#index")
|
||||||
end
|
end
|
||||||
it "routes to #active_list" do
|
it "routes to #active_list" do
|
||||||
get("/user/active_list").should route_to("user#active_list")
|
get("/user/active_list").should route_to("user#active_list")
|
||||||
@@ -38,9 +38,6 @@ describe UserController do
|
|||||||
it "routes to #history_list" do
|
it "routes to #history_list" do
|
||||||
get("/user/history_list").should route_to("user#history_list")
|
get("/user/history_list").should route_to("user#history_list")
|
||||||
end
|
end
|
||||||
it "routes to #home" do
|
|
||||||
get("/user/home").should route_to("user#home")
|
|
||||||
end
|
|
||||||
it "routes to #order_selected_products" do
|
it "routes to #order_selected_products" do
|
||||||
post("/user/order_selected_products").should route_to("user#order_selected_products")
|
post("/user/order_selected_products").should route_to("user#order_selected_products")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user