mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
WIP: Add route for User and Enterprise report
This commit is contained in:
@@ -613,7 +613,8 @@ Spree::Admin::ReportsController.class_eval do
|
||||
:orders_and_fulfillment => {:name => "Orders & Fulfillment Reports", :description => ''},
|
||||
:customers => {:name => "Customers", :description => 'Customer details'},
|
||||
:products_and_inventory => {:name => "Products & Inventory", :description => ''},
|
||||
:sales_total => { :name => "Sales Total", :description => "Sales Total For All Orders" }
|
||||
:sales_total => { :name => "Sales Total", :description => "Sales Total For All Orders" },
|
||||
:users_and_enterprises => { :name => "Users & Enterprises", :description => "Enterprise Ownership & Status" }
|
||||
}
|
||||
# Return only reports the user is authorized to view.
|
||||
reports.select { |action| can? action, :report }
|
||||
|
||||
@@ -116,6 +116,7 @@ Spree::Core::Engine.routes.prepend do
|
||||
match '/admin/reports/bulk_coop' => 'admin/reports#bulk_coop', :as => "bulk_coop_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/payments' => 'admin/reports#payments', :as => "payments_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/orders_and_fulfillment' => 'admin/reports#orders_and_fulfillment', :as => "orders_and_fulfillment_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/users_and_enterprises' => 'admin/reports#users_and_enterprises', :as => "users_and_enterprises_admin_reports", :via => [:get, :post]
|
||||
match '/admin/products/bulk_edit' => 'admin/products#bulk_edit', :as => "bulk_edit_admin_products"
|
||||
match '/admin/orders/bulk_management' => 'admin/orders#bulk_management', :as => "admin_bulk_order_management"
|
||||
match '/admin/reports/products_and_inventory' => 'admin/reports#products_and_inventory', :as => "products_and_inventory_admin_reports", :via => [:get, :post]
|
||||
|
||||
@@ -14,17 +14,19 @@ feature %q{
|
||||
create(:distributor_enterprise)
|
||||
])
|
||||
end
|
||||
it "should not show the Sales Total report" do
|
||||
it "does not show super admin only reports" do
|
||||
login_to_admin_as user
|
||||
click_link "Reports"
|
||||
page.should_not have_content "Sales Total"
|
||||
page.should_not have_content "Users & Enterprises"
|
||||
end
|
||||
end
|
||||
context "As an admin user" do
|
||||
it "shows the Sales Total report" do
|
||||
it "shows the super admin only reports" do
|
||||
login_to_admin_section
|
||||
click_link "Reports"
|
||||
page.should have_content "Sales Total"
|
||||
page.should have_content "Users & Enterprises"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user