aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorZog2018-02-02 12:43:55 +0100
committerZog2018-02-02 12:43:55 +0100
commit771084101913ec0fb6d5790786ae533b5413f9b2 (patch)
tree02f57ee2661e2358e49067459dd9870bb7de18ce /app
parent6300165062bacc73bf900723c1dbed1d69425c95 (diff)
downloadchouette-core-771084101913ec0fb6d5790786ae533b5413f9b2.tar.bz2
Refs #5832 @1h; Show active filters5832-fix-filter-by-stopareas-on-vjs-index
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/components/_forms.sass9
-rw-r--r--app/helpers/search_helper.rb15
-rw-r--r--app/views/calendars/_filters.html.slim6
-rw-r--r--app/views/compliance_check_sets/_filters.html.slim8
-rw-r--r--app/views/compliance_checks/_filters.html.slim8
-rw-r--r--app/views/compliance_control_sets/_filters.html.slim10
-rw-r--r--app/views/compliance_controls/_filters.html.slim8
-rw-r--r--app/views/imports/_filters.html.slim6
-rw-r--r--app/views/lines/_filters.html.slim10
-rw-r--r--app/views/purchase_windows/_filters.html.slim4
-rw-r--r--app/views/referential_lines/_filters.html.slim4
-rw-r--r--app/views/referential_vehicle_journeys/_filters.html.slim14
-rw-r--r--app/views/referentials/_filters.html.slim8
-rw-r--r--app/views/routing_constraint_zones/_filters.html.slim4
-rw-r--r--app/views/stop_areas/_filters.html.slim10
-rw-r--r--app/views/time_tables/_filter.html.slim6
-rw-r--r--app/views/workbenches/_filters.html.slim10
17 files changed, 82 insertions, 58 deletions
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass
index ba5bbbde1..caa8ac0e4 100644
--- a/app/assets/stylesheets/components/_forms.sass
+++ b/app/assets/stylesheets/components/_forms.sass
@@ -457,6 +457,15 @@ table, .table
margin: 0
min-height: 41px
padding: 5px 15px
+ &.active
+ &:after
+ position: absolute
+ top: 0
+ left: 0
+ right: 0
+ height: 4px
+ background: $blue
+ content: ""
&.per-page-select
padding-top: 10px
.selected
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index f4976ea53..be70d974d 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -8,4 +8,19 @@ module SearchHelper
link_to name, params.deep_merge("q" => search,:page => 1), html_options
end
+ def filter_item_class q, key
+ active = false
+ if q.present? && q[key].present?
+ val = q[key]
+ if val.is_a?(Array)
+ active = val.any? &:present?
+ elsif val.is_a?(Hash)
+ active = val.values.any? &:present?
+ else
+ active = true
+ end
+ end
+ active ? 'active' : 'inactive'
+ end
+
end
diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim
index b5283c1e8..d9c936b64 100644
--- a/app/views/calendars/_filters.html.slim
+++ b/app/views/calendars/_filters.html.slim
@@ -1,19 +1,19 @@
= search_form_for @q, url: calendars_path, builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_short_name_cont)
= f.search_field :name_or_short_name_cont, class: 'form-control', placeholder: 'Indiquez un nom/nom court de calendrier...'
span.input-group-btn
button.btn.btn-default#search_btn type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :shared_true)
= f.label Calendar.human_attribute_name(:shared), required: false, class: 'control-label'
.form-group.checkbox_list
= f.input :shared_true, as: :boolean, label: ("<span>Oui</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' }
= f.input :shared_false, as: :boolean, label: ("<span>Non</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' }
- .form-group
+ .form-group class=filter_item_class(params[:q], :contains_date)
= f.label Calendar.human_attribute_name(:date), class: 'control-label'
= f.input :contains_date, as: :date, label: false, wrapper_html: { class: 'date smart_date' }, class: 'form-control', include_blank: true
diff --git a/app/views/compliance_check_sets/_filters.html.slim b/app/views/compliance_check_sets/_filters.html.slim
index bf929bc08..e413a6cdd 100644
--- a/app/views/compliance_check_sets/_filters.html.slim
+++ b/app/views/compliance_check_sets/_filters.html.slim
@@ -1,23 +1,23 @@
= search_form_for @q_for_form, url: workbench_compliance_check_sets_path(@workbench), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :referential_name_cont)
= f.search_field :referential_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name')
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :parent_type_eq_any)
= f.label t('activerecord.attributes.compliance_check_set.assigned_to'), required: false, class: 'control-label'
= f.input :parent_type_eq_any, collection: ComplianceCheckSet.order('parent_type'), as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :created_at)
= f.label Import.human_attribute_name(:created_at), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :created_at do |p|
= p.input :start_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @begin_range, include_blank: @begin_range ? false : true
= p.input :end_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @end_range, include_blank: @end_range ? false : true
.form-group.search
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :compliance_control_set_name_cont)
= f.search_field :compliance_control_set_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name_compliance_control_set')
span.input-group-btn
button.btn.btn-default type='submit'
diff --git a/app/views/compliance_checks/_filters.html.slim b/app/views/compliance_checks/_filters.html.slim
index 0d747da27..40e45dd92 100644
--- a/app/views/compliance_checks/_filters.html.slim
+++ b/app/views/compliance_checks/_filters.html.slim
@@ -5,7 +5,7 @@
class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_cont)
= f.search_field :name_cont,
class: 'form-control',
placeholder: t('compliance_checks.filters.name')
@@ -14,7 +14,7 @@
span.fa.fa-search
.ffg-row
- .form-group.togglable#compliance_check_block-filter
+ .form-group.togglable#compliance_check_block-filter class=filter_item_class(params[:q], :compliance_check_block_id_eq_any)
= f.label t('activerecord.models.compliance_check_block.one'), required: false, class: 'control-label'
= f.input :compliance_check_block_id_eq_any,
collection: @compliance_check_set.compliance_check_blocks,
@@ -23,7 +23,7 @@
label_method: lambda {|w| ("<span>#{transport_mode_text(w)}</span>").html_safe},
required: false,
wrapper_html: {class: 'checkbox_list'}
- .form-group.togglable#subclass-filter
+ .form-group.togglable#subclass-filter class=filter_item_class(params[:q], :origin_code_cont_any)
= f.label t('compliance_checks.filters.subclass'), required: false, class: 'control-label'
= f.input :origin_code_cont_any,
collection: subclass_selection_list,
@@ -32,7 +32,7 @@
label_method: lambda {|w| ("<span>#{w.first}</span>").html_safe},
required: false,
wrapper_html: {class: 'checkbox_list'}
- .form-group.togglable#severity-filter
+ .form-group.togglable#severity-filter class=filter_item_class(params[:q], :criticity_eq_any)
= f.label t('compliance_checks.filters.criticity'), required: false, class: 'control-label'
= f.input :criticity_eq_any,
collection: ComplianceControl.criticities,
diff --git a/app/views/compliance_control_sets/_filters.html.slim b/app/views/compliance_control_sets/_filters.html.slim
index 6a5d3ac44..4348defac 100644
--- a/app/views/compliance_control_sets/_filters.html.slim
+++ b/app/views/compliance_control_sets/_filters.html.slim
@@ -1,16 +1,16 @@
= search_form_for @q_for_form, url: compliance_control_sets_path, builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_cont)
= f.search_field :name_cont, class: 'form-control', placeholder: t('compliance_control_sets.filters.name')
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :organisation_name_eq_any)
= f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label'
= f.input :organisation_name_eq_any, collection: organisations_filters_values, as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w.name}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'}
-
- .form-group.togglable
+
+ .form-group.togglable class=filter_item_class(params[:q], :updated_at)
= f.label Import.human_attribute_name(:updated_at), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :updated_at do |p|
@@ -19,4 +19,4 @@
.actions
= link_to t('actions.erase'), @compliance_control_set, class: 'btn btn-link'
- = f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_control_set_filter_btn' \ No newline at end of file
+ = f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_control_set_filter_btn'
diff --git a/app/views/compliance_controls/_filters.html.slim b/app/views/compliance_controls/_filters.html.slim
index d38da5d2d..f6b9970f2 100644
--- a/app/views/compliance_controls/_filters.html.slim
+++ b/app/views/compliance_controls/_filters.html.slim
@@ -5,7 +5,7 @@
class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_cont)
= f.search_field :name_cont,
class: 'form-control',
placeholder: t('compliance_controls.filters.name')
@@ -14,7 +14,7 @@
span.fa.fa-search
.ffg-row
- .form-group.togglable#compliance_control_block-filter
+ .form-group.togglable#compliance_control_block-filter class=filter_item_class(params[:q], :compliance_control_block_id_eq_any)
= f.label t('activerecord.models.compliance_control_block.one'), required: false, class: 'control-label'
= f.input :compliance_control_block_id_eq_any,
collection: @compliance_control_set.compliance_control_blocks,
@@ -23,7 +23,7 @@
label_method: lambda {|w| ("<span>#{transport_mode_text(w)}</span>").html_safe},
required: false,
wrapper_html: {class: 'checkbox_list'}
- .form-group.togglable#subclass-filter
+ .form-group.togglable#subclass-filter class=filter_item_class(params[:q], :origin_code_cont_any)
= f.label t('compliance_controls.filters.subclass'), required: false, class: 'control-label'
= f.input :origin_code_cont_any,
collection: subclass_selection_list,
@@ -32,7 +32,7 @@
label_method: lambda {|w| ("<span>#{w.first}</span>").html_safe},
required: false,
wrapper_html: {class: 'checkbox_list'}
- .form-group.togglable#severity-filter
+ .form-group.togglable#severity-filter class=filter_item_class(params[:q], :criticity_eq_any)
= f.label t('compliance_controls.filters.criticity'), required: false, class: 'control-label'
= f.input :criticity_eq_any,
collection: ComplianceControl.criticities,
diff --git a/app/views/imports/_filters.html.slim b/app/views/imports/_filters.html.slim
index b1f23e2c8..25c0d10d9 100644
--- a/app/views/imports/_filters.html.slim
+++ b/app/views/imports/_filters.html.slim
@@ -1,17 +1,17 @@
= search_form_for @q, url: workbench_imports_path(@workbench), html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_creator_cont)
= f.search_field :name_or_creator_cont, class: 'form-control', placeholder: t('imports.filters.name_or_creator_cont')
span.input-group-btn
button.btn.btn-default#search_btn type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :status_eq_any)
= f.label Import.human_attribute_name(:status), required: false, class: 'control-label'
= f.input :status_eq_any, collection: %w(pending successful warning failed), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + import_status(l) + "</span>").html_safe}, required: false, wrapper_html: { class: "checkbox_list"}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :started_at)
= f.label Import.human_attribute_name(:started_at), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :started_at do |p|
diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim
index e3674656a..67ba297cf 100644
--- a/app/views/lines/_filters.html.slim
+++ b/app/views/lines/_filters.html.slim
@@ -1,25 +1,25 @@
= search_form_for @q, url: line_referential_lines_path(@line_referential), html: {method: :get}, class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_number_or_objectid_cont)
= f.search_field :name_or_number_or_objectid_cont, placeholder: t('lines.index.name_or_number_or_objectid'), class: 'form-control'
span.input-group-btn
button.btn.btn-default#search-btn type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :network_id_eq_any)
= f.label Chouette::Line.human_attribute_name(:network_id), required: false, class: 'control-label'
= f.input :network_id_eq_any, collection: @line_referential.networks.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :company_id_eq_any)
= f.label Chouette::Line.human_attribute_name(:company_id), required: false, class: 'control-label'
= f.input :company_id_eq_any, collection: @line_referential.companies.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :transport_mode_eq_any)
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
= f.input :transport_mode_eq_any, collection: StifTransportModeEnumerations.sorted_transport_modes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :transport_submode_eq_any)
= f.label Chouette::Line.human_attribute_name(:transport_submode), required: false, class: 'control-label'
= f.input :transport_submode_eq_any, collection: StifTransportSubmodeEnumerations.sorted_transport_submodes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
diff --git a/app/views/purchase_windows/_filters.html.slim b/app/views/purchase_windows/_filters.html.slim
index 4d7c8ce26..eedbf31d5 100644
--- a/app/views/purchase_windows/_filters.html.slim
+++ b/app/views/purchase_windows/_filters.html.slim
@@ -1,12 +1,12 @@
= search_form_for @q, url: referential_purchase_windows_path, builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_cont)
= f.search_field :name_cont, class: 'form-control', placeholder: t('purchase_windows.index.filter_placeholder')
span.input-group-btn
button.btn.btn-default#search_btn type='submit'
span.fa.fa-search
- .form-group
+ .form-group class=filter_item_class(params[:q], :contains_date)
= f.label Chouette::PurchaseWindow.human_attribute_name(:date), class: 'control-label'
= f.input :contains_date, as: :date, label: false, wrapper_html: { class: 'date smart_date' }, class: 'form-control', default: @date, include_blank: @date ? false : true
diff --git a/app/views/referential_lines/_filters.html.slim b/app/views/referential_lines/_filters.html.slim
index 379d6234f..501f61c16 100644
--- a/app/views/referential_lines/_filters.html.slim
+++ b/app/views/referential_lines/_filters.html.slim
@@ -1,13 +1,13 @@
= search_form_for @q, url: referential_line_path(@referential, @line), class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_objectid_cont)
= f.search_field :name_or_objectid_cont, class: 'form-control', placeholder: "Indiquez un nom d'itinéraire ou un ID..."
span.input-group-btn
button.btn.btn-default#search-btn type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :wayback_eq_any)
= f.label Chouette::Route.human_attribute_name(:wayback), required: false, class: 'control-label'
= f.input :wayback_eq_any, class: 'form-control', collection: Chouette::Route.wayback.values, as: :check_boxes, label: false, required: false, wrapper_html: { class: 'checkbox_list'}, label_method: lambda{|l| ("<span>" + t("enumerize.route.wayback.#{l}") + "</span>").html_safe}
diff --git a/app/views/referential_vehicle_journeys/_filters.html.slim b/app/views/referential_vehicle_journeys/_filters.html.slim
index d3cb9eb4b..bd8245e39 100644
--- a/app/views/referential_vehicle_journeys/_filters.html.slim
+++ b/app/views/referential_vehicle_journeys/_filters.html.slim
@@ -9,14 +9,14 @@
.form-group.per-page-select
= I18n.t("simple_form.per_page")
= %w(10 50 100).each_with_index.map{ |v, i| (params[:per_page] == v || params[:per_page].nil? && i == 0) ? "<span class='selected'>#{v}</span>" : link_to(v, referential_vehicle_journeys_path(@referential, q: params[:q], per_page: v)) }.join(' - ').html_safe
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :company_id_eq_any)
= f.label Chouette::VehicleJourney.human_attribute_name(:company), required: false, class: 'control-label'
- if @all_companies.present?
= f.input :company_id_eq_any, collection: @all_companies.select(:id, :name).order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
- else
= f.input :company_id_eq_any, collection: [[I18n.t('companies.search_no_results_for_filter'), nil]], as: :check_boxes, label: false, disabled: true, required: false, wrapper_html: { class: 'checkbox_list disabled'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :route_line_id_eq)
= f.label Chouette::Line.model_name.human,
required: false,
class: 'control-label'
@@ -25,7 +25,7 @@
as: :select,
include_blank: t(".all"),
collection: @vehicle_journeys.lines,
- selected: params[:q] && params[:q][:line_id],
+ selected: params[:q] && params[:q][:route_line_id_eq],
input_html: { \
'data-select2ed': 'true',
'data-select2ed-placeholder': t('referentials.filters.line') \
@@ -34,22 +34,22 @@
label_method: :display_name,
wrapper_html: { class: 'filter_menu-item select2ed' }
- .form-group.togglable.name-filter
+ .form-group.togglable.name-filter class=filter_item_class(params[:q], :published_journey_name_gteq)
= f.label Chouette::VehicleJourney.human_attribute_name(:published_journey_name), required: false, class: 'control-label'
.inputs.form-inline.checkbox_list
= f.input :published_journey_name_gteq, label: false, wrapper_html: { class: 'w45'}
.form-group.w10.to= I18n.t('vehicle_journeys.form.to')
= f.input :published_journey_name_lteq, label: false, wrapper_html: { class: 'w45'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :stop_area_ids)
= f.label Chouette::StopArea.model_name.human.pluralize, required: false, class: 'control-label'
= f.input :stop_area_ids, collection: @all_stop_areas.select(:id, :name, :kind).order(name: :asc), checked: params[:q] && params[:q][:stop_area_ids], as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}, multiple: true
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :purchase_window)
= f.label Chouette::VehicleJourney.human_attribute_name(:purchase_window), class: 'control-label'
.filter_menu
= f.simple_fields_for :purchase_window do |p|
= p.input :start_date, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @purchase_window_begin_range, include_blank: @purchase_window_begin_range ? false : true
= p.input :end_date, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @purchase_window_end_range, include_blank: @purchase_window_end_range ? false : true
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :time_table)
= f.label Chouette::TimeTable.model_name.human, class: 'control-label'
.filter_menu
= f.simple_fields_for :time_table do |p|
diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim
index 93fa679df..190e70ebe 100644
--- a/app/views/referentials/_filters.html.slim
+++ b/app/views/referentials/_filters.html.slim
@@ -1,21 +1,21 @@
= search_form_for @q, url: referential_path(@referential.id), class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_number_or_objectid_cont)
= f.search_field :name_or_number_or_objectid_cont, class: 'form-control', placeholder: t('.name_or_number_or_objectid')
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :transport_mode_eq_any)
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
= f.input :transport_mode_eq_any, collection: @referential.lines.pluck(:transport_mode).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :network_id_eq_any)
= f.label t('activerecord.attributes.referential.networks'), required: false, class: 'control-label'
= f.input :network_id_eq_any, collection: LineReferential.first.networks.order('name').pluck(:id), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>#{LineReferential.first.networks.find(l).name}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :company_id_eq_any)
= f.label t('activerecord.attributes.referential.companies'), required: false, class: 'control-label'
= f.input :company_id_eq_any, collection: LineReferential.first.companies.order('name').pluck(:id), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>#{LineReferential.first.companies.find(l).name}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
diff --git a/app/views/routing_constraint_zones/_filters.html.slim b/app/views/routing_constraint_zones/_filters.html.slim
index 433dde4ab..74e299a8b 100644
--- a/app/views/routing_constraint_zones/_filters.html.slim
+++ b/app/views/routing_constraint_zones/_filters.html.slim
@@ -1,13 +1,13 @@
= search_form_for @q, url: referential_line_routing_constraint_zones_path(@referential, @line), class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_objectid_cont)
= f.search_field :name_or_objectid_cont, class: 'form-control', placeholder: "Indiquez un nom d'ITL ou un ID..."
span.input-group-btn
button.btn.btn-default#search-btn type='submit'
span.fa.fa-search
.ffg-row
- .form-group
+ .form-group class=filter_item_class(params[:q], :route_id_eq)
= f.label 'Itinéraire associé', required: false, class: 'control-label'
= f.input :route_id_eq, as: :select, collection: @line.routing_constraint_zones.pluck(:route_id).uniq, label: false, label_method: lambda { |r| @line.routing_constraint_zones.find_by(route_id: r).route_name }, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez un itinéraire...' }, wrapper_html: { class: 'select2ed'}
diff --git a/app/views/stop_areas/_filters.html.slim b/app/views/stop_areas/_filters.html.slim
index 90368dff4..1d71d477a 100644
--- a/app/views/stop_areas/_filters.html.slim
+++ b/app/views/stop_areas/_filters.html.slim
@@ -1,18 +1,18 @@
= search_form_for @q, url: stop_area_referential_stop_areas_path(@stop_area_referential), html: {method: :get}, class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_or_objectid_cont)
= f.search_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control'
span.input-group-btn
button.btn.btn-default#search-btn type='submit'
span.fa.fa-search
.ffg-row
- = f.input :zip_code_cont, placeholder: t('.zip_code'), label: Chouette::StopArea.human_attribute_name(:zip_code), required: false
- = f.input :city_name_cont, placeholder: t('.city_name'), label: Chouette::StopArea.human_attribute_name(:city_name), required: false
+ = f.input :zip_code_cont, placeholder: t('.zip_code'), label: Chouette::StopArea.human_attribute_name(:zip_code), required: false, wrapper_html: {class: filter_item_class(params[:q], :zip_code_cont)}
+ = f.input :city_name_cont, placeholder: t('.city_name'), label: Chouette::StopArea.human_attribute_name(:city_name), required: false, wrapper_html: {class: filter_item_class(params[:q], :city_name_cont)}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :area_type_eq_any)
= f.label Chouette::StopArea.human_attribute_name(:area_type), required: false, class: 'control-label'
- = f.input :area_type_eq_any, collection: Chouette::AreaType.options, as: :check_boxes, label: false, label_method: lambda{|w| ("<span>" + w[0] + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
+ = f.input :area_type_eq_any, checked: params[:q][:area_type_eq_any], collection: Chouette::AreaType.options, as: :check_boxes, label: false, label_method: lambda{|w| ("<span>" + w[0] + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
.actions
= link_to 'Effacer', @workbench, class: 'btn btn-link'
diff --git a/app/views/time_tables/_filter.html.slim b/app/views/time_tables/_filter.html.slim
index 11e9987c4..030036a13 100644
--- a/app/views/time_tables/_filter.html.slim
+++ b/app/views/time_tables/_filter.html.slim
@@ -1,17 +1,17 @@
= search_form_for @q, url: referential_time_tables_path(@referential), html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :comment_cont)
= f.text_field :comment_cont, :placeholder => "#{t('time_tables.index.comment')}", class: 'form-control'
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
- .form-group
+ .form-group class=filter_item_class(params[:q], :tag_search)
= f.label Chouette::TimeTable.human_attribute_name(:tag_search), required: false, class: 'control-label'
= f.input :tag_search, as: :tags, collection: Chouette::TimeTable.tags_on(:tags).pluck(:name), label: false, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une étiquette...' }, wrapper_html: { class: 'select2ed'}, include_blank: false, selected: params[:q] ? params[:q]['tag_search'] : nil
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :bounding_dates)
= f.label Chouette::TimeTable.human_attribute_name(:bounding_dates), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :bounding_dates do |p|
diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim
index 491749515..c9dd13d96 100644
--- a/app/views/workbenches/_filters.html.slim
+++ b/app/views/workbenches/_filters.html.slim
@@ -1,23 +1,23 @@
= search_form_for @q_for_form, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
.ffg-row
- .input-group.search_bar
+ .input-group.search_bar class=filter_item_class(params[:q], :name_cont)
= f.search_field :name_cont, class: 'form-control', placeholder: t('referentials.filters.name')
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
- .form-group
+ .form-group class=filter_item_class(params[:q], :associated_lines_id_eq)
= f.label t('activerecord.models.line.one').upcase, required: false, class: 'control-label'
= f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('referentials.filters.line') }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'}
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :archived_at_not_null)
= f.label Referential.human_attribute_name(:status), required: false, class: 'control-label'
.form-group.checkbox_list
= f.input :archived_at_not_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at')}<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' }
= f.input :archived_at_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at_null')}<span class='sb sb-lg sb-preparing'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' }
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :organisation_name_eq_any)
= f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label'
= f.input :organisation_name_eq_any,
collection: @workbench.workgroup.organisations.order('name').pluck(:name),
@@ -27,7 +27,7 @@
required: false,
wrapper_html: { class: 'checkbox_list' }
- .form-group.togglable
+ .form-group.togglable class=filter_item_class(params[:q], :validity_period)
= f.label Referential.human_attribute_name(:validity_period), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :validity_period do |p|