List enterprise groups

This commit is contained in:
Rohan Mitchell
2013-10-24 14:31:38 +11:00
parent e78815c2d3
commit a6fa73ec13
5 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
module Admin
class EnterpriseGroupsController < ResourceController
def index
end
end
end

View File

@@ -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 => '')

View 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

View File

@@ -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"

View 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