diff --git a/app/assets/javascripts/supplier/app/router.js.coffee b/app/assets/javascripts/supplier/app/router.js.coffee index b0411327..7491997c 100644 --- a/app/assets/javascripts/supplier/app/router.js.coffee +++ b/app/assets/javascripts/supplier/app/router.js.coffee @@ -5,6 +5,7 @@ Qsupplier.App.Router.reopen rootURL: '/supplier' Qsupplier.App.Router.map -> + @route '/', queryParams: ['section_id'] @resource 'sections', -> @resource 'section', path: ':section_id' #@resource 'lists', queryParams: ['state'] diff --git a/app/assets/javascripts/supplier/app/views/home_section_jumper_view.js.coffee b/app/assets/javascripts/supplier/app/views/home_section_jumper_view.js.coffee index 1f22e7e3..1ab7a715 100644 --- a/app/assets/javascripts/supplier/app/views/home_section_jumper_view.js.coffee +++ b/app/assets/javascripts/supplier/app/views/home_section_jumper_view.js.coffee @@ -1,6 +1,11 @@ Qsupplier.App.HomeSectionJumperView = Ember.View.extend tagName: 'a' + classNames: ['main-board-section-jumper'] attributeBindings: ['href'] - href: (-> Routes.suppliers_section_path(@get('controller.active_section_id') || 'nothing')).property('controller.active_section_id') + #href: (-> Routes.suppliers_section_path(@get('controller.active_section_id') || 'nothing')).property('controller.active_section_id') + href: '#' isVisible: (-> !!@get('controller.active_section_id') ).property('controller.active_section_id') template: Ember.Handlebars.compile('=>') + click: (e)-> + e.preventDefault() + @get('controller').transitionToRoute 'section', @get('controller.active_section_id') diff --git a/spec/acceptance/suppliers/supplier_main_board.feature b/spec/acceptance/suppliers/supplier_main_board.feature index d9c72b6f..6f735c3f 100644 --- a/spec/acceptance/suppliers/supplier_main_board.feature +++ b/spec/acceptance/suppliers/supplier_main_board.feature @@ -59,3 +59,13 @@ Feature: Supplier main board When I reset the section selector in the supplier dashboard Then I should see the list and the new list And I should see the order and the new order + + @javascript + Scenario: Selecting a specific section and jumping towards section view + Given there is an active list and order + And I am signed in as supplier + Then I should not see the supplier main board section jumper + When I select the section in the supplier dashboard + And I click on the section main board section jumper + Then I should be redirected to the supplier section view + diff --git a/spec/acceptance_steps/suppliers/main_board_steps.rb b/spec/acceptance_steps/suppliers/main_board_steps.rb index 826d7130..593fdd70 100644 --- a/spec/acceptance_steps/suppliers/main_board_steps.rb +++ b/spec/acceptance_steps/suppliers/main_board_steps.rb @@ -114,6 +114,15 @@ end step "I select the new section in the supplier dashboard" do find(%|.section_selector option[value="#{@new_section.id}"]|).select_option end + step "I reset the section selector in the supplier dashboard" do find(%|.section_selector option[value=""]|).select_option end + +step "I should not see the supplier main board section jumper" do + page.should_not have_selector '.main-board-section-jumper' +end + +step "I click on the section main board section jumper" do + find('.main-board-section-jumper').click +end diff --git a/spec/acceptance_steps/suppliers/section_view_steps.rb b/spec/acceptance_steps/suppliers/section_view_steps.rb index 1774ed99..229d958c 100644 --- a/spec/acceptance_steps/suppliers/section_view_steps.rb +++ b/spec/acceptance_steps/suppliers/section_view_steps.rb @@ -64,3 +64,9 @@ step "the section table should not have any active list markings anymore" do css_class.should_not include 'active_order' css_class.should_not include 'needs_payment' end + +step "I should be redirected to the supplier section view" do + sleep 1 + #page.current_path.should == "/supplier/sections/#{@section.id}" + page.evaluate_script('window.location.pathname').should == "/supplier/sections/#{@section.id}" +end