mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
List enterprise groups
This commit is contained in:
7
app/controllers/admin/enterprise_groups_controller.rb
Normal file
7
app/controllers/admin/enterprise_groups_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Admin
|
||||
class EnterpriseGroupsController < ResourceController
|
||||
def index
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -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 => "<li><%= link_to 'Enterprise Groups', main_app.admin_enterprise_groups_path %></li>",
|
||||
:partial => 'enterprise_groups/admin_configurations_menu',
|
||||
:original => '')
|
||||
18
app/views/admin/enterprise_groups/index.html.haml
Normal file
18
app/views/admin/enterprise_groups/index.html.haml
Normal file
@@ -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
|
||||
@@ -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"
|
||||
|
||||
26
spec/features/admin/enterprise_groups_spec.rb
Normal file
26
spec/features/admin/enterprise_groups_spec.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user