General functionality improvement
This commit is contained in:
@@ -14,7 +14,7 @@ Qsupplier.App.List = DS.Model.extend
|
||||
price: attr 'number'
|
||||
closed_at: DS.attr('date')
|
||||
#table_number: attr 'number'
|
||||
#table: DS.belongsTo('table', inverse: 'active_list')
|
||||
table: DS.belongsTo('table', inverse: 'active_list')
|
||||
#users: DS.hasMany('user', inverse: 'active_list')
|
||||
orders: DS.hasMany('order')
|
||||
section: DS.belongsTo('section')
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
.display-row
|
||||
.display-label=t 'attributes.list.created_at'
|
||||
.display-field=time list.created_at
|
||||
.display-row
|
||||
.display-label=t 'attributes.list.state'
|
||||
.display-field=state 'list' list.state
|
||||
each user in list.users
|
||||
img.facebook-image src="http://graph.facebook.com/#{unbound user.facebook_id}/picture?type=square" alt="f"
|
||||
if list.orders
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.row
|
||||
h2=t 'models.list'
|
||||
partial "list_content"
|
||||
link-to 'lists'
|
||||
span Go to lists
|
||||
link-to 'lists' class="button"
|
||||
span=t 'list.go_to_lists'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
App.ApplicationController = Ember.Controller.extend
|
||||
join_request_sent: false
|
||||
notice: ''
|
||||
actions:
|
||||
confirmCancel: ->
|
||||
@@ -39,11 +40,22 @@ App.ApplicationController = Ember.Controller.extend
|
||||
join_request = @store.createRecord 'join_request', data.join_request
|
||||
@transitionToRoute 'join_requests'
|
||||
join_request_rejected: (data)->
|
||||
# Remove join request from connected users
|
||||
join_request = @store.all('join_request').findBy 'id', data.id
|
||||
join_request.eraseRecord() if join_request
|
||||
|
||||
# Notify requestor in a proper manner
|
||||
# NOTE data.id is in the form of: jr-:user_id
|
||||
requestor_id = data.id.substr(3)
|
||||
if requestor_id is Qstorage.getItem('user_id')
|
||||
@set 'notice', t('join_request.requestor.join_request_rejected')
|
||||
@set 'join_request_sent', false
|
||||
|
||||
join_request_approved: ->
|
||||
@setCurrentList ->
|
||||
@transitionToRoute 'active_list'
|
||||
@transitionToRoute('active_list').then =>
|
||||
@set 'notice', t('join_request.requestor.join_request_approved')
|
||||
|
||||
list_changed_table: ->
|
||||
@setCurrentList()
|
||||
|
||||
@@ -69,4 +81,4 @@ App.ApplicationController = Ember.Controller.extend
|
||||
@set 'list', null
|
||||
@store.find('list', 'current').then(success, error)
|
||||
didInsertElement: (e)->
|
||||
debugger
|
||||
#debugger
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
App.TableController = Ember.ObjectController.extend
|
||||
join_request_sent: false
|
||||
join_request_sent: (-> @get('controllers.application.join_request_sent')).property('controllers.application.join_request_sent')
|
||||
tableCanTakeOrders: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
list = @get('controllers.application.list')
|
||||
@@ -14,7 +14,7 @@ App.TableController = Ember.ObjectController.extend
|
||||
showJoinButton: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
return false if @get('controllers.application.list') # if you already have an active list, do not join another
|
||||
if @get('model.occupied') then true else false
|
||||
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
||||
).property('controllers.application.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'controllers.application.list.table.id')
|
||||
actions:
|
||||
addProduct: (product)->
|
||||
@@ -25,7 +25,7 @@ App.TableController = Ember.ObjectController.extend
|
||||
joinOccupiedTable: ->
|
||||
#@secured =>
|
||||
Ember.$.post('/user/join_occupied_table.json', table_id: @get('model.id'))
|
||||
@set 'join_request_sent', true # keeps the button deactivated
|
||||
@set 'controllers.application.join_request_sent', true # keeps the button deactivated
|
||||
toggleProductCategory: (product_category)->
|
||||
product_category.set 'collapsed', not product_category.get('collapsed')
|
||||
showProductDescription: (product)->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.lists-overview-entry
|
||||
+grid-column(12)
|
||||
cursor: pointer
|
||||
@media #{$medium-only}
|
||||
+grid-column(6)
|
||||
@media #{$large-up}
|
||||
|
||||
@@ -3,7 +3,9 @@ module Suppliers
|
||||
# GET /lists
|
||||
# GET /lists.json
|
||||
def index
|
||||
if params[:date].present?
|
||||
if params[:state] == 'active'
|
||||
@lists = List.active_for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
|
||||
elsif params[:date].present?
|
||||
@date = params[:date].present? ? (Date.parse(params[:date]) rescue Date.today) : Date.today
|
||||
@time = @date.to_time(:utc)
|
||||
@start_time = @time.beginning_of_day
|
||||
|
||||
@@ -99,6 +99,7 @@ class List
|
||||
end
|
||||
|
||||
def self.active_for_supplier(supplier_id, options = {})
|
||||
supplier_id = supplier_id.id if supplier_id.is_a?(Supplier)
|
||||
database.view(active_by_supplier_id_view(key: supplier_id, reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/jQuery(function(){
|
||||
/Qsupplier.load_list('#{@list.id}');
|
||||
/})
|
||||
.test-div
|
||||
/.test-div
|
||||
span.fa.fa-square-o.fa-2x
|
||||
span.fa-stack
|
||||
i.fa.fa-square-o.fa-stack-2x
|
||||
|
||||
@@ -33,6 +33,7 @@ en:
|
||||
is_helped_button: Question answered!
|
||||
close_list: Close!
|
||||
none_found: 'No ${models.plural.list|downcase}'
|
||||
go_to_lists: Go to lists
|
||||
order:
|
||||
being_processed: 'In process!'
|
||||
being_served: 'Is delivered!'
|
||||
|
||||
@@ -33,6 +33,7 @@ nl:
|
||||
is_helped_button: Vraag beantwoord!
|
||||
close_list: Afsluiten!
|
||||
none_found: 'Geen ${models.plural.list|downcase}'
|
||||
go_to_lists: Naar lijsten
|
||||
order:
|
||||
being_processed: 'Ben bezig!'
|
||||
being_served: 'Ik kom het brengen!'
|
||||
|
||||
@@ -13,8 +13,6 @@ en:
|
||||
table_is_reserved: The table you want to sit on is reserved by someone else
|
||||
table_is_closed: The table you want to sit on is not available for service
|
||||
supplier_is_closed: The owner of this table is currently not handling orders
|
||||
join_request_rejected: Your request to join the table has been rejected
|
||||
join_request_approved: Your request to join the table has been approved
|
||||
table_is_from_other_supplier: You cannot move to another table when you have an open list
|
||||
moved_to_another_table: You successfully moved to another table
|
||||
cannot_identify_table: The application cannot determine the table number
|
||||
@@ -34,10 +32,12 @@ en:
|
||||
title: '${models.plural.join_request}'
|
||||
reject_request: Reject
|
||||
approve_request: Approve
|
||||
no_join_requests_message: Nobody wants to join right now
|
||||
no_join_requests_message: No current join requests for your list
|
||||
requestor:
|
||||
join_this_table: Join this table
|
||||
waiting_for_approval: Waiting for approval
|
||||
join_request_rejected: Your request to join the table has been rejected
|
||||
join_request_approved: Your request to join the table has been approved
|
||||
|
||||
list_products:
|
||||
title: Order
|
||||
|
||||
@@ -13,8 +13,6 @@ nl:
|
||||
table_is_reserved: De tafel waar je aan wil gaan zitten is gereserveerd
|
||||
table_is_closed: De tafel waar je aan wil gaan zitten is niet beschikbaar voor bediening
|
||||
supplier_is_closed: De eigenaar van deze tafel is momenteel gesloten
|
||||
join_request_rejected: Je verzoek om te mogen bestellen op een bestaande lijst is afgewezen
|
||||
join_request_approved: Je verzoek om te mogen bestellen op een bestaande lijst is goedgekeurd
|
||||
table_is_from_other_supplier: Je kan geen lijst openen bij een andere zaak zolang je huidige lijst nog niet is afgesloten
|
||||
moved_to_another_table: De tafel is gewijzigd
|
||||
cannot_identify_table: De applicatie kan niet bepalen om welke tafel het gaat
|
||||
@@ -35,10 +33,12 @@ nl:
|
||||
title: '${models.plural.join_request}'
|
||||
reject_request: Afwijzen
|
||||
approve_request: Toestaan
|
||||
no_join_requests_message: Niemand wil deelnemen aan de ${models.list}
|
||||
no_join_requests_message: Geen deelname verzoeken voor de huidige ${models.list}
|
||||
requestor:
|
||||
waiting_for_approval: Wachten op toestemming
|
||||
join_this_table: Ik wil ook bestellen bij deze tafel
|
||||
join_request_rejected: Je verzoek om deel te nemen aan de ${models.list|downcase} is afgewezen
|
||||
join_request_approved: Je verzoek om deel te nemen aan de ${models.list|downcase} is goedgekeurd
|
||||
history_list:
|
||||
title: Afgesloten lijst
|
||||
list_history:
|
||||
|
||||
@@ -12,9 +12,9 @@ Feature: Joining an occupied table
|
||||
When the original user approves the other user's join request
|
||||
Then the original user should not see the join request anymore
|
||||
And the other user should be added to the active list
|
||||
And the other user should be redirected to the user menu page
|
||||
And the other user should be redirected to active list it just joined
|
||||
|
||||
@javascript @broken
|
||||
@javascript
|
||||
Scenario: Original user rejects the join request
|
||||
Given There is an open supplier with a menu
|
||||
And there is a signed in user with an active order
|
||||
@@ -27,13 +27,3 @@ Feature: Joining an occupied table
|
||||
Then the original user should not see the join request anymore
|
||||
And the other user should not be added to the active list
|
||||
And the other user should see a join reject message
|
||||
|
||||
@javascript @broken
|
||||
Scenario: The other user just wants to see the table menu
|
||||
Given There is an open supplier with a menu
|
||||
And there is a signed in user with an active order
|
||||
And I am on the user homepage
|
||||
When another user scans the QR code on the table
|
||||
And the other user clicks the show me the menu button
|
||||
Then the other user sees the table menu
|
||||
And the other user does not see order buttons
|
||||
|
||||
@@ -30,16 +30,3 @@ step "I am signed in as a user" do
|
||||
step "I visit the user obtain token path"
|
||||
end
|
||||
|
||||
step "the other user should be added to the active list" do
|
||||
@other_user.reload
|
||||
@list.reload
|
||||
@other_user.active_list_id.should == @list.id
|
||||
@list.user_ids.should =~ [@user.id, @other_user.id]
|
||||
end
|
||||
|
||||
step "the other user should not be added to the active list" do
|
||||
@other_user.reload
|
||||
@list.reload
|
||||
@other_user.active_list_id.should be_nil
|
||||
@list.user_ids.should == [@user.id]
|
||||
end
|
||||
|
||||
@@ -39,7 +39,3 @@ step "the other user clicks the join table button" do
|
||||
find('.join-table-button').click
|
||||
end
|
||||
|
||||
step "the other user should be redirected to the user menu page" do
|
||||
Capybara.session_name = :other_user
|
||||
route_should_be 'user#list_products'
|
||||
end
|
||||
|
||||
@@ -134,6 +134,7 @@ step "the active list changes to another table in another section" do
|
||||
end
|
||||
|
||||
step "the supplier main board table number should be updated to the new table number" do
|
||||
binding.pry
|
||||
expect( find(".list-row-#{@list.id} .table_number").text ).to eq "65"
|
||||
expect( find(".order-row-#{@list.orders.first.id} .table_number").text ).to eq "65"
|
||||
end
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
step "the original user should see a join request message" do
|
||||
Capybara.session_name = :default
|
||||
request_text = page.evaluate_script(%|t('join_request.body', {email: '#{@other_user.email}'})|)
|
||||
request_text.should be_present
|
||||
page.should have_content request_text
|
||||
#request_text = page.evaluate_script(%|t('join_request.body', {email: '#{@other_user.email}'})|)
|
||||
request_title = page.evaluate_script(%|t('join_request.existing_user.title')|)
|
||||
request_title.should be_present
|
||||
page.should have_content request_title
|
||||
page.should have_content @other_user.email
|
||||
end
|
||||
|
||||
step "the original user should not see the join request anymore" do
|
||||
@@ -13,11 +15,11 @@ step "the original user should not see the join request anymore" do
|
||||
end
|
||||
|
||||
step "the original user approves the other user's join request" do
|
||||
find('.approve-join-request-button').click
|
||||
find('.join-request-approve').click
|
||||
end
|
||||
|
||||
step "the original user rejects the other user's join request" do
|
||||
find('.reject-join-request-button').click
|
||||
find('.join-request-reject').click
|
||||
end
|
||||
|
||||
step "the other user clicks the show me the menu button" do
|
||||
@@ -33,8 +35,29 @@ end
|
||||
|
||||
step "the other user should see a join reject message" do
|
||||
Capybara.session_name = :other_user
|
||||
reject_text = I18n.t('messages.join_request_rejected')
|
||||
reject_text = page.evaluate_script(%|t('join_request.requestor.join_request_rejected')|)
|
||||
reject_text.should be_present
|
||||
reject_text.should_not include 'translation'
|
||||
page.should have_content reject_text
|
||||
end
|
||||
|
||||
step "the other user should be added to the active list" do
|
||||
sleep 1
|
||||
@other_user.reload
|
||||
@list.reload
|
||||
@other_user.active_list_id.should == @list.id
|
||||
@list.user_ids.should =~ [@user.id, @other_user.id]
|
||||
end
|
||||
|
||||
step "the other user should not be added to the active list" do
|
||||
sleep 1
|
||||
@other_user.reload
|
||||
@list.reload
|
||||
@other_user.active_list_id.should be_nil
|
||||
@list.user_ids.should == [@user.id]
|
||||
end
|
||||
|
||||
step "the other user should be redirected to active list it just joined" do
|
||||
Capybara.session_name = :other_user
|
||||
ember_route_should_be '/active_list'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user