Show report search instructions

Solves: https://github.com/openfoodfoundation/openfoodnetwork/issues/2356
This commit is contained in:
Maikel Linke
2018-06-06 17:54:26 +10:00
parent 7a2218fe26
commit 67c2574b0b
5 changed files with 42 additions and 19 deletions

View File

@@ -0,0 +1,7 @@
.report__message {
margin-top: 2em;
border: 1px solid #cee1f4;
border-radius: .5em;
padding: .5em;
text-align: center;
}

View File

@@ -17,6 +17,8 @@ require 'open_food_network/orders_and_fulfillments_report'
Spree::Admin::ReportsController.class_eval do
include Spree::ReportsHelper
helper_method :render_content?
before_filter :cache_search_state
# Fetches user's distributors, suppliers and order_cycles
before_filter :load_data, only: [:customers, :products_and_inventory, :order_cycle_management, :packing]

View File

@@ -1,21 +1,25 @@
- column_partials ||= {}
%br
%br
%table{id: id}
%thead
%tr
- @header.each do |heading|
%th= heading
%tbody
- @table.each do |row|
- if render_content?
%br
%br
%table{id: id}
%thead
%tr
- row.each_with_index do |cell_value, column_index|
%td
- partial = column_partials[column_index]
- if partial
= render partial, value: cell_value
- else
= cell_value
- if @table.empty?
%tr
%td{colspan: @header.count}= t(:none)
- @header.each do |heading|
%th= heading
%tbody
- @table.each do |row|
%tr
- row.each_with_index do |cell_value, column_index|
%td
- partial = column_partials[column_index]
- if partial
= render partial, value: cell_value
- else
= cell_value
- if @table.empty?
%tr
%td{colspan: @header.count}= t(:none)
- else
%p.report__message
= t(".select_and_search")

View File

@@ -2598,6 +2598,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using
display_as:
display_as: Display As
reports:
table:
select_and_search: "Select filters and click on SEARCH to access your data."
bulk_coop:
bulk_coop_supplier_report: 'Bulk Co-op - Totals by Supplier'
bulk_coop_allocation: 'Bulk Co-op - Allocation'

View File

@@ -39,6 +39,8 @@ feature %q{
scenario "customers report" do
click_link "Mailing List"
expect(page).to have_select('report_type', selected: 'Mailing List')
expect(page).to have_content "click on SEARCH"
click_button "Search"
rows = find("table#listing_customers").all("thead tr")
table = rows.map { |r| r.all("th").map { |c| c.text.strip } }
@@ -51,6 +53,7 @@ feature %q{
click_link "Addresses"
expect(page).to have_select('report_type', selected: 'Addresses')
click_button "Search"
rows = find("table#listing_customers").all("thead tr")
table = rows.map { |r| r.all("th").map { |c| c.text.strip } }
expect(table.sort).to eq([
@@ -67,6 +70,7 @@ feature %q{
scenario "payment method report" do
click_link "Payment Methods Report"
click_button "Search"
rows = find("table#listing_ocm_orders").all("thead tr")
table = rows.map { |r| r.all("th").map { |c| c.text.strip } }
expect(table.sort).to eq([
@@ -76,6 +80,7 @@ feature %q{
scenario "delivery report" do
click_link "Delivery Report"
click_button "Search"
rows = find("table#listing_ocm_orders").all("thead tr")
table = rows.map { |r| r.all("th").map { |c| c.text.strip } }
expect(table.sort).to eq([
@@ -148,6 +153,7 @@ feature %q{
login_to_admin_section
click_link 'Reports'
click_link 'Orders And Distributors'
click_button 'Search'
expect(page).to have_content 'Order date'
end
@@ -156,6 +162,7 @@ feature %q{
login_to_admin_section
click_link 'Reports'
click_link 'Bulk Co-Op'
click_button 'Search'
expect(page).to have_content 'Supplier'
end
@@ -164,6 +171,7 @@ feature %q{
login_to_admin_section
click_link 'Reports'
click_link 'Payment Reports'
click_button 'Search'
expect(page).to have_content 'Payment State'
end