diff --git a/app/views/active_scaffold_overrides/_human_conditions.html.erb b/app/views/active_scaffold_overrides/_human_conditions.html.erb index 4bb8ae63db..b36c6df08a 100644 --- a/app/views/active_scaffold_overrides/_human_conditions.html.erb +++ b/app/views/active_scaffold_overrides/_human_conditions.html.erb @@ -1 +1,3 @@ -<%= columns.collect {|column| active_scaffold_human_condition_for(column)}.compact.to_sentence %> \ No newline at end of file +<%= columns.collect {|column| active_scaffold_human_condition_for(column)}.compact.to_sentence %> +<%= tag(:br) if columns.present? && grouped_search? %> +<%= as_(:grouped_by, column: active_scaffold_grouped_by_label) if grouped_search? %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 932eca6ac9..b6c550d8d9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -61,6 +61,7 @@ en: found: Found future: Future group_by: Group by + grouped_by: Grouped by %{column} hide: "(Hide)" hours: Hours human_conditions: diff --git a/lib/active_scaffold/actions/field_search.rb b/lib/active_scaffold/actions/field_search.rb index 73eec65fec..b878e6c58d 100644 --- a/lib/active_scaffold/actions/field_search.rb +++ b/lib/active_scaffold/actions/field_search.rb @@ -160,7 +160,7 @@ def do_search active_scaffold_conditions << search_condition filtered_columns << column end - if filtered_columns.present? + if filtered_columns.present? || grouped_search? @filtered = active_scaffold_config.field_search.human_conditions ? filtered_columns : true end diff --git a/lib/active_scaffold/helpers/human_condition_helpers.rb b/lib/active_scaffold/helpers/human_condition_helpers.rb index eca85d5bbe..c02fe4f42c 100644 --- a/lib/active_scaffold/helpers/human_condition_helpers.rb +++ b/lib/active_scaffold/helpers/human_condition_helpers.rb @@ -15,6 +15,13 @@ def active_scaffold_human_condition_for(column) end end + def active_scaffold_grouped_by_label + text, _ = active_scaffold_config.field_search.group_options.find do |text, value| + (value || text) == field_search_params['active_scaffold_group'] + end + active_scaffold_translated_option(active_scaffold_group_column, text).first if text + end + def format_human_condition(column, opt, from = nil, to = nil) attribute = column.active_record_class.human_attribute_name(column.name) "#{attribute} #{as_(opt).downcase} #{from} #{to}"