diff options
| author | Zog | 2018-04-27 11:09:48 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-27 11:17:19 +0200 |
| commit | 3ed5ca0e97c287977646b7af6a41632c9dd3ad49 (patch) | |
| tree | 658f0329a085b12065730b11a8116bdb2a6d64d7 | |
| parent | 923f9fcb1a603ab02c4d7dad2678bb232cbdfa56 (diff) | |
| download | chouette-core-3ed5ca0e97c287977646b7af6a41632c9dd3ad49.tar.bz2 | |
Refs #6572; Hide useless filters
| -rw-r--r-- | app/views/referentials/_filters.html.slim | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim index f709fd39d..36db5bfb5 100644 --- a/app/views/referentials/_filters.html.slim +++ b/app/views/referentials/_filters.html.slim @@ -11,13 +11,15 @@ = 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 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: @referential.lines.pluck(:network_id).uniq, 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' } + - if (network_ids = @referential.lines.pluck(:network_id).uniq.compact).size > 1 + .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: network_ids, 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 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: @referential.lines.pluck(:company_id).uniq, 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' } + - if (company_ids = @referential.lines.pluck(:company_id).uniq.compact).size > 1 + .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: company_ids, 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' } .actions = link_to t('actions.erase'), @workbench, class: 'btn btn-link' |
