mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Adding basic routing to display customer index page
This commit is contained in:
4
app/controllers/admin/customers_controller.rb
Normal file
4
app/controllers/admin/customers_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
module Admin
|
||||
class CustomersController < ResourceController
|
||||
end
|
||||
end
|
||||
@@ -185,6 +185,8 @@ class AbilityDecorator
|
||||
|
||||
# Reports page
|
||||
can [:admin, :index, :customers, :group_buys, :bulk_coop, :sales_tax, :payments, :orders_and_distributors, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management], :report
|
||||
|
||||
can [:admin, :index], Customer
|
||||
end
|
||||
|
||||
|
||||
|
||||
1
app/views/admin/customers/index.html.haml
Normal file
1
app/views/admin/customers/index.html.haml
Normal file
@@ -0,0 +1 @@
|
||||
Customers
|
||||
@@ -79,6 +79,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
resources :variant_overrides do
|
||||
post :bulk_update, on: :collection
|
||||
end
|
||||
|
||||
resources :customers, only: [:index]
|
||||
end
|
||||
|
||||
namespace :api do
|
||||
|
||||
@@ -220,6 +220,10 @@ module Spree
|
||||
should_not have_ability([:sales_total, :group_buys, :payments, :orders_and_distributors, :users_and_enterprises], for: :report)
|
||||
end
|
||||
|
||||
it "should not be able to list customers" do
|
||||
should_not have_ability([:admin, :index], for: Customer)
|
||||
end
|
||||
|
||||
describe "order_cycles abilities" do
|
||||
context "where the enterprise is not in an order_cycle" do
|
||||
let!(:order_cycle) { create(:simple_order_cycle) }
|
||||
@@ -407,6 +411,10 @@ module Spree
|
||||
should_not have_ability([:sales_total, :users_and_enterprises], for: :report)
|
||||
end
|
||||
|
||||
it "should be able to list customers" do
|
||||
should have_ability([:admin, :index], for: Customer)
|
||||
end
|
||||
|
||||
context "for a given order_cycle" do
|
||||
let!(:order_cycle) { create(:simple_order_cycle) }
|
||||
let!(:exchange){ create(:exchange, incoming: false, order_cycle: order_cycle, receiver: d1, sender: order_cycle.coordinator) }
|
||||
|
||||
Reference in New Issue
Block a user