diff --git a/app/controllers/admin/enterprise_groups_controller.rb b/app/controllers/admin/enterprise_groups_controller.rb new file mode 100644 index 0000000000..c3b79f9f95 --- /dev/null +++ b/app/controllers/admin/enterprise_groups_controller.rb @@ -0,0 +1,7 @@ +module Admin + class EnterpriseGroupsController < ResourceController + def index + end + + end +end diff --git a/app/overrides/add_enterprise_groups_to_admin_configurations_menu.rb b/app/overrides/add_enterprise_groups_to_admin_configurations_menu.rb new file mode 100644 index 0000000000..9fb511fc8a --- /dev/null +++ b/app/overrides/add_enterprise_groups_to_admin_configurations_menu.rb @@ -0,0 +1,6 @@ +Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu", + :name => "add_enterprise_groups_to_admin_configurations_menu", + :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']", + :text => "
  • <%= link_to 'Enterprise Groups', main_app.admin_enterprise_groups_path %>
  • ", + :partial => 'enterprise_groups/admin_configurations_menu', + :original => '') diff --git a/app/views/admin/enterprise_groups/index.html.haml b/app/views/admin/enterprise_groups/index.html.haml new file mode 100644 index 0000000000..2fb4e235dc --- /dev/null +++ b/app/views/admin/enterprise_groups/index.html.haml @@ -0,0 +1,18 @@ +%h1 Enterprise Groups + +%table.index#listing_enterprise_groups + %thead + %tr + %th Name + %th On front page? + %th Enterprises + %th.actions + + %tbody + - @enterprise_groups.each do |enterprise_group| + %tr + %td= enterprise_group.name + %td= enterprise_group.on_front_page ? 'Y' : 'N' + %td= enterprise_group.enterprises.map(&:name).join ', ' + %td.actions + jjj diff --git a/config/routes.rb b/config/routes.rb index c872bd872c..47438230d4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,6 +29,8 @@ Openfoodnetwork::Application.routes.draw do resources :enterprise_fees do post :bulk_update, :on => :collection, :as => :bulk_update end + + resources :enterprise_groups end get "new_landing_page", :controller => 'home', :action => "new_landing_page" diff --git a/spec/features/admin/enterprise_groups_spec.rb b/spec/features/admin/enterprise_groups_spec.rb new file mode 100644 index 0000000000..eb8a7494c9 --- /dev/null +++ b/spec/features/admin/enterprise_groups_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +feature %q{ + As an administrator + I want to manage enterprise groups +} do + include AuthenticationWorkflow + include WebHelper + + before(:each) do + login_to_admin_section + end + + scenario "listing enterprise groups" do + e = create(:enterprise) + group = create(:enterprise_group, enterprises: [e], on_front_page: true) + + click_link 'Configuration' + click_link 'Enterprise Groups' + + page.should have_selector 'td', text: group.name + page.should have_selector 'td', text: 'Y' + page.should have_selector 'td', text: e.name + end + +end