diff --git a/app/assets/javascripts/supplier/app/controllers/orders_display_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/orders-display.js.coffee similarity index 51% rename from app/assets/javascripts/supplier/app/controllers/orders_display_controller.js.coffee rename to app/assets/javascripts/supplier/app/controllers/orders-display.js.coffee index 3b1f48f5..89fc2731 100644 --- a/app/assets/javascripts/supplier/app/controllers/orders_display_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/orders-display.js.coffee @@ -1,7 +1,6 @@ App.OrdersDisplayController = Ember.Controller.extend - active_section: null - sections: (-> @store.peekAll('section') ).property() - orders: Ember.computed 'model.[]', 'active_section.id', -> + sections: Ember.computed -> @store.peekAll('section') + orders: Ember.computed 'model.[]', 'globals.active_section.id', -> orders = @get('model').filterBy('needs_supplier_attention') - orders = orders.filterBy('section.id', id) if id = @get('active_section.id') + orders = orders.filterBy('list.section.id', id) if id = @get('globals.active_section.id') orders.sortBy('created_at') # Not reversed, oldest on top, start with oldest order first :-) Customer happyness diff --git a/app/assets/javascripts/supplier/app/router.js.coffee b/app/assets/javascripts/supplier/app/router.js.coffee index 3b97eff8..018ba6ac 100644 --- a/app/assets/javascripts/supplier/app/router.js.coffee +++ b/app/assets/javascripts/supplier/app/router.js.coffee @@ -15,7 +15,7 @@ App.Router.map -> @route 'employees' @route 'employee', path: '/employees/:employee_id' @route 'page', path: 'pages/:page_id' - @route 'orders_display' # chromecast etc + @route 'orders-display' # chromecast etc @route 'menu' @route 'settings' @route 'schedule' diff --git a/app/assets/javascripts/supplier/app/routes/orders_display_route.js.coffee b/app/assets/javascripts/supplier/app/routes/orders-display.js.coffee similarity index 100% rename from app/assets/javascripts/supplier/app/routes/orders_display_route.js.coffee rename to app/assets/javascripts/supplier/app/routes/orders-display.js.coffee diff --git a/app/assets/javascripts/supplier/app/templates/orders_display.emblem b/app/assets/javascripts/supplier/app/templates/orders-display.emblem similarity index 92% rename from app/assets/javascripts/supplier/app/templates/orders_display.emblem rename to app/assets/javascripts/supplier/app/templates/orders-display.emblem index ad11dd3f..b8bd7ec0 100644 --- a/app/assets/javascripts/supplier/app/templates/orders_display.emblem +++ b/app/assets/javascripts/supplier/app/templates/orders-display.emblem @@ -1,4 +1,4 @@ -= sections-header active_section=section += sections-header active_section=globals.active_section table.table thead tr diff --git a/bin/test_prepare b/bin/test_prepare index 022a90d8..f34ad051 100755 --- a/bin/test_prepare +++ b/bin/test_prepare @@ -4,6 +4,6 @@ require 'active_support/all' # rm log/test.log && rm -rf tmp/capybara/* && ./bin/test_prepare && touch public/user/cordova.js && rspec spec/acceptance/users/sign_up.feature:15 mozo_user_path = ENV['MOZO_USER_PATH'] || Pathname.new(File.expand_path('../../../mozo-user', __FILE__)) Dir.chdir mozo_user_path do - `ember build --output-path=../mozo/public/user/ --environment=testexport` # not production, because then the production servers will be queried + `ember build --output-path=../backend/public/user/ --environment=testexport` # not production, because then the production servers will be queried end diff --git a/spec/acceptance/users/get_product_information.feature b/spec/acceptance/users/get_product_information.feature index d29e972e..cd7ae215 100644 --- a/spec/acceptance/users/get_product_information.feature +++ b/spec/acceptance/users/get_product_information.feature @@ -7,5 +7,6 @@ Feature: Getting product information during an order And I am signed in as a user And I am on the user homepage When the user scans a table QR code + And the users clicks on the product category "Beer" title And the user clicks on the more info button for the product with name 'Heineken beer' Then the user page should have product information 'Brewed in Amsterdam' diff --git a/spec/acceptance/users/order_a_product.feature b/spec/acceptance/users/order_a_product.feature index de26f6c0..2a4632c8 100644 --- a/spec/acceptance/users/order_a_product.feature +++ b/spec/acceptance/users/order_a_product.feature @@ -6,9 +6,11 @@ Feature: Ordering a product as a user And I am signed in as a user And I am on the user homepage When the user scans a table QR code + And the users clicks on the product category "Beer" title And the user clicks on the order 'Heineken beer' twice Then the user order 'Heineken beer' should be in the order list with price And the user order total should not be visible for only one order + And the users clicks on the product category "Lunch" title When the user clicks on the order product button 'Apple pie' Then the user order total should be visible with the correct total price When the user clicks on the user order button @@ -31,6 +33,7 @@ Feature: Ordering a product as a user And I am signed in as a user And I am on the user homepage When the user scans a table QR code + And the users clicks on the product category "Beer" title And the user clicks on the order product button 'Australian beer' And the user selects the product variant 'Without foam' Then the user order 'Australian beer' with variant 'Without foam' should be in the order list @@ -42,7 +45,9 @@ Feature: Ordering a product as a user And I am signed in as a user And I am on the user homepage When the user scans a table QR code + And the users clicks on the product category "Beer" title And the user clicks on the order 'Heineken beer' twice + And the users clicks on the product category "Lunch" title And the user clicks on the order product button 'Apple pie' And the user clicks on the clear order for the last order button And the user clicks on the clear order for the last order button @@ -64,5 +69,5 @@ Feature: Ordering a product as a user And the user clicks on the lists link in the side menu And the user opens the side menu again And the user clicks on the order products link in the side menu - Then the user page contains the product category beer + Then the user page contains the product category "Beer" And the user should see the products listed for the active list diff --git a/spec/acceptance/users/product_category_visibility.feature b/spec/acceptance/users/product_category_visibility.feature index 9bc6f3df..83007c81 100644 --- a/spec/acceptance/users/product_category_visibility.feature +++ b/spec/acceptance/users/product_category_visibility.feature @@ -7,11 +7,11 @@ Feature: And there is a table And I am signed in as a user When the user is on the order products page - Then the user page contains the product category lunch + Then the user page contains the product category "Lunch" When the product category lunch is not visible today And I reload the page - Then the user page contains the product category beer - And the user page does not contain the product category lunch + Then the user page contains the product category "Beer" + And the user page does not contain the product category "Lunch" @javascript Scenario: Product category visibility by minute when inside the range @@ -19,11 +19,11 @@ Feature: And there is a table And I am signed in as a user When the user is on the order products page - Then the user page contains the product category lunch + Then the user page contains the product category "Lunch" When the product category lunch is visible at this time And I reload the page - Then the user page contains the product category beer - And the user page contains the product category lunch + Then the user page contains the product category "Beer" + And the user page contains the product category "Lunch" @javascript Scenario: Product category visibility by minute when category is visible after now @@ -31,11 +31,11 @@ Feature: And there is a table And I am signed in as a user When the user is on the order products page - Then the user page contains the product category lunch + Then the user page contains the product category "Lunch" When the product category lunch is visible later than now And I reload the page - Then the user page contains the product category beer - And the user page does not contain the product category lunch + Then the user page contains the product category "Beer" + And the user page does not contain the product category "Lunch" @javascript Scenario: Product category visibility by minute when category is visible before now @@ -43,8 +43,8 @@ Feature: And there is a table And I am signed in as a user When the user is on the order products page - Then the user page contains the product category lunch + Then the user page contains the product category "Lunch" When the product category lunch is visible earlyer than now And I reload the page - Then the user page contains the product category beer - And the user page does not contain the product category lunch + Then the user page contains the product category "Beer" + And the user page does not contain the product category "Lunch" diff --git a/spec/acceptance/website/contact_form.feature b/spec/acceptance/website/contact_form.feature index 860d9514..7c8f0d71 100644 --- a/spec/acceptance/website/contact_form.feature +++ b/spec/acceptance/website/contact_form.feature @@ -1,7 +1,7 @@ Feature: Submitting contact form Scenario: Website visitor submits contact form Given there are standard website pages - When I visit '/contact' + When I visit '/en/contact' And I fill in the website contact form And I submit the website contact form Then I should be redirected to the homepage diff --git a/spec/acceptance_steps/suppliers/dashboard_steps.rb b/spec/acceptance_steps/suppliers/dashboard_steps.rb index 866d9477..86b7d751 100644 --- a/spec/acceptance_steps/suppliers/dashboard_steps.rb +++ b/spec/acceptance_steps/suppliers/dashboard_steps.rb @@ -134,7 +134,7 @@ end step "the supplier main board table number should be updated to the new table number" do 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" + expect( find(".order-row-#{@list.orders.first.id} .table-number").text ).to eq "# 65" end step "the supplier main board section name should be updated to the new section" do diff --git a/spec/acceptance_steps/users/changing_table_steps.rb b/spec/acceptance_steps/users/changing_table_steps.rb index e64a15a5..50c4f4bf 100644 --- a/spec/acceptance_steps/users/changing_table_steps.rb +++ b/spec/acceptance_steps/users/changing_table_steps.rb @@ -14,8 +14,9 @@ step "the user indicates in the popup that he wants to change the table" do end step "the user should see the supplier menu having the other table as base" do - #route_should_be 'user#list_products' - page.should have_content 'Apple pie' + ember_route_should_be '/active-list' + product_order = @list.orders.first.product_orders.first + page.should have_content "#{product_order.quantity} x #{product_order.product_name}" all('.table-number').map(&:text).uniq.should == ["# #{@other_table.number.to_s}"] end diff --git a/spec/acceptance_steps/users/feedback_steps.rb b/spec/acceptance_steps/users/feedback_steps.rb index 51f3eae0..52b9bf75 100644 --- a/spec/acceptance_steps/users/feedback_steps.rb +++ b/spec/acceptance_steps/users/feedback_steps.rb @@ -7,7 +7,8 @@ step "the user clicks on the submit feedback button" do end step "the user should see the feedback submitted message" do - page.should have_content 'Thank you for your feedback' + #page.should have_content 'Thank you for your feedback' + page.should have_content 'Dank je voor het meedenken' end step "a user feedback should be created containing the feedback" do diff --git a/spec/acceptance_steps/users/order_products_steps.rb b/spec/acceptance_steps/users/order_products_steps.rb index 7ab27374..b1b119cf 100644 --- a/spec/acceptance_steps/users/order_products_steps.rb +++ b/spec/acceptance_steps/users/order_products_steps.rb @@ -140,12 +140,12 @@ step "the user has an active list with a/an :order_status order" do |order_statu end end -step "the user page contains the product category lunch" do - js_text("#product-category-#{@category_lunch.id} .product_category-title").should include @category_lunch.name +step "the user page contains the product category :product_category_name" do |product_category_name| + product_category = ProductCategory.find_by_name(product_category_name) + js_text("#product-category-#{product_category.id} .product_category-title").should include product_category.name end -step "the user page contains the product category beer" do - js_text("#product-category-#{@category_beer.id} .product_category-title").should include @category_beer.name -end -step "the user page does not contain the product category lunch" do - page.should_not have_selector "#product-category-#{@category_lunch.id} .product_category-title" + +step "the user page does not contain the product category :product_category_name" do |product_category_name| + product_category = ProductCategory.find_by_name(product_category_name) + page.should_not have_selector "#product-category-#{product_category.id} .product_category-title" end diff --git a/spec/acceptance_steps/users/product_category_steps.rb b/spec/acceptance_steps/users/product_category_steps.rb new file mode 100644 index 00000000..63d42f3f --- /dev/null +++ b/spec/acceptance_steps/users/product_category_steps.rb @@ -0,0 +1,5 @@ + +step "the users clicks on the product category :product_category_name title" do |product_category_name| + product_category = ProductCategory.find_by_name product_category_name + js_click "#product-category-#{product_category.id} .product_category-title" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9ad4e853..6d19a20d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -9,8 +9,8 @@ describe User do user.supplier_name.should == 'Benji setup' end - it 'falls back to unkown if not present' do - user.supplier_name.should == I18n.t('supplier.user.unkown_name') + it 'falls back to unknown if not present' do + user.supplier_name.should == I18n.t('supplier.user.unknown_name') end end diff --git a/wip.md b/wip.md index 9e2a10e2..6425e449 100644 --- a/wip.md +++ b/wip.md @@ -8,6 +8,8 @@ Release todos: - Printer paperclip 5 minute setup story - Maybe responsive supplier dashboard - facebook api integration on homepage share picture and js +- Signup explanation better and link to current supplier when already + signed in Supplier --------