From 4c15d6d9127c8c5fa187221ab5ad23dd7c8b1127 Mon Sep 17 00:00:00 2001 From: jpl Date: Wed, 15 Mar 2017 15:53:37 +0100 Subject: Refs #2794: fixing new filters integration --- app/assets/stylesheets/components/_forms.sass | 4 +-- app/views/lines/_filters.html.slim | 36 +++++++++++++------------ app/views/referentials/_filters.html.slim | 30 +++++++++++---------- app/views/stop_areas/_filters.html.slim | 18 +++++++------ app/views/workbenches/_filters.html.slim | 38 +++++++++++++++------------ 5 files changed, 68 insertions(+), 58 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass index 81bc28046..7c2638e79 100644 --- a/app/assets/stylesheets/components/_forms.sass +++ b/app/assets/stylesheets/components/_forms.sass @@ -80,7 +80,7 @@ input // Search bar .search_bar position: relative - background-color: rgba($grey, 0.15) + // background-color: rgba($grey, 0.15) padding: 7px 15px width: 100% padding-right: 60% @@ -503,7 +503,7 @@ table, .table top: 100% left: 0 min-width: 100% - max-height: 300px + max-height: 240px background-color: #fff color: $darkgrey box-shadow: 0 0 3px rgba($darkgrey, 0.25) diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim index 719491dc3..6a5f38ae4 100644 --- a/app/views/lines/_filters.html.slim +++ b/app/views/lines/_filters.html.slim @@ -1,25 +1,27 @@ = search_form_for @q, url: line_referential_lines_path(@line_referential), html: {method: :get}, class: 'form form-filter' do |f| - .input-group.search_bar - = f.search_field :name_or_objectid_cont, placeholder: t('lines.index.name_or_objectid'), class: 'form-control' - span.input-group-btn - button.btn.btn-default#search-btn type='submit' - span.fa.fa-search + .ffg-row + .input-group.search_bar + = f.search_field :name_or_objectid_cont, placeholder: t('lines.index.name_or_objectid'), class: 'form-control' + span.input-group-btn + button.btn.btn-default#search-btn type='submit' + span.fa.fa-search - .form-group.togglable - = f.label @lines.human_attribute_name(:network), 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| ("" + l.name + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} + .ffg-row + .form-group.togglable + = f.label @lines.human_attribute_name(:network), 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| ("" + l.name + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} - .form-group.togglable - = f.label @lines.human_attribute_name(:company), 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| ("" + l.name + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} + .form-group.togglable + = f.label @lines.human_attribute_name(:company), 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| ("" + l.name + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} - .form-group.togglable - = f.label @lines.human_attribute_name(:transport_mode), required: false, class: 'control-label' - = f.input :transport_mode_eq_any, collection: Chouette::Line.transport_mode.values, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("enumerize.line.transport_mode.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} + .form-group.togglable + = f.label @lines.human_attribute_name(:transport_mode), required: false, class: 'control-label' + = f.input :transport_mode_eq_any, collection: Chouette::Line.transport_mode.values, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("enumerize.line.transport_mode.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} - .form-group.togglable - = f.label @lines.human_attribute_name(:transport_submode), required: false, class: 'control-label' - = f.input :transport_submode_eq_any, collection: Chouette::Line.transport_submode.values, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("enumerize.line.transport_submode.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} + .form-group.togglable + = f.label @lines.human_attribute_name(:transport_submode), required: false, class: 'control-label' + = f.input :transport_submode_eq_any, collection: Chouette::Line.transport_submode.values, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("enumerize.line.transport_submode.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} .actions = link_to 'Effacer', @workbench, class: 'btn btn-link' diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim index c27620143..eadd72d9f 100644 --- a/app/views/referentials/_filters.html.slim +++ b/app/views/referentials/_filters.html.slim @@ -1,21 +1,23 @@ = search_form_for @q, url: referential_path(@referential.id), class: 'form form-filter' do |f| - .input-group.search_bar - = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de ligne' - span.input-group-btn - button.btn.btn-default type='submit' - span.fa.fa-search + .ffg-row + .input-group.search_bar + = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de ligne' + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search - .form-group.togglable - = f.label @reflines.human_attribute_name(:transport_mode), required: false, class: 'control-label' - = f.input :transport_mode_eq_any, collection: LineReferential.first.transport_modes, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("transport_modes.label.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + .ffg-row + .form-group.togglable + = f.label @reflines.human_attribute_name(:transport_mode), required: false, class: 'control-label' + = f.input :transport_mode_eq_any, collection: LineReferential.first.transport_modes, as: :check_boxes, label: false, label_method: lambda{|l| ("" + t("transport_modes.label.#{l}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } - .form-group.togglable - = f.label @reflines.human_attribute_name(:network), 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| ("#{LineReferential.first.networks.find(l).name}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + .form-group.togglable + = f.label @reflines.human_attribute_name(:network), 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| ("#{LineReferential.first.networks.find(l).name}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } - .form-group.togglable - = f.label @reflines.human_attribute_name(:company), 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| ("#{LineReferential.first.companies.find(l).name}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + .form-group.togglable + = f.label @reflines.human_attribute_name(:company), 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| ("#{LineReferential.first.companies.find(l).name}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } .actions = link_to 'Effacer', @workbench, class: 'btn btn-link' diff --git a/app/views/stop_areas/_filters.html.slim b/app/views/stop_areas/_filters.html.slim index 3ce97deaa..b7c57e842 100644 --- a/app/views/stop_areas/_filters.html.slim +++ b/app/views/stop_areas/_filters.html.slim @@ -1,10 +1,12 @@ = search_form_for @q, url: stop_area_referential_stop_areas_path(@stop_area_referential), html: {method: :get}, class: 'form form-filter' do |f| - .input-group.search_bar - = 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 + .input-group.search_bar + = 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: @stop_areas.human_attribute_name(:zip_code), required: false = f.input :city_name_cont, placeholder: t('.city_name'), label: @stop_areas.human_attribute_name(:city_name), required: false @@ -12,6 +14,6 @@ = f.label @stop_areas.human_attribute_name(:area_type), required: false, class: 'control-label' = f.input :area_type_eq_any, collection: Chouette::StopArea.area_type.options.sort, as: :check_boxes, label: false, label_method: lambda{|w| ("" + t("enumerize.stop_area.area_type.#{w[1]}") + "").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } - .actions - = link_to 'Effacer', @workbench, class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + .actions + = link_to 'Effacer', @workbench, class: 'btn btn-link' + = f.submit 'Filtrer', class: 'btn btn-default' diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim index ad82b3efd..f3e7c7148 100644 --- a/app/views/workbenches/_filters.html.slim +++ b/app/views/workbenches/_filters.html.slim @@ -1,23 +1,27 @@ = search_form_for @q, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f| - .input-group.search_bar - = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de référentiel' - span.input-group-btn - button.btn.btn-default type='submit' - span.fa.fa-search - .form-group.togglable - = f.label @wbench_refs.human_attribute_name(:status), required: false, class: 'control-label' - = f.input :archived_at_not_null, label: ("Conservé").html_safe, as: :boolean, wrapper_html: { class: 'checkbox_list' }, input_html: { class: 'check_boxes' } + .ffg-row + .input-group.search_bar + = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de référentiel' + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search - .form-group.togglable - = f.label 'Organisation(s)', required: false, class: 'control-label' - = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("#{w}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + .ffg-row + .form-group.togglable + = f.label @wbench_refs.human_attribute_name(:status), required: false, class: 'control-label' + = f.input :archived_at_not_null, label: ("Conservé").html_safe, as: :boolean, wrapper_html: { class: 'checkbox_list' }, input_html: { class: 'check_boxes' } + + .form-group.togglable + = f.label 'Organisation(s)', required: false, class: 'control-label' + = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("#{w}").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + + .form-group.togglable + = f.label @wbench_refs.human_attribute_name(:validity_period), required: false, class: 'control-label' + .filter_menu + = f.simple_fields_for :validity_period do |p| + = p.input :begin_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date filter_menu-item' } + = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date filter_menu-item' } - .form-group.togglable - = f.label @wbench_refs.human_attribute_name(:validity_period), required: false, class: 'control-label' - .filter_menu - = f.simple_fields_for :validity_period do |p| - = p.input :begin_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date filter_menu-item' } - = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date filter_menu-item' } .actions = link_to 'Effacer', @workbench, class: 'btn btn-link' = f.submit 'Filtrer', class: 'btn btn-default' -- cgit v1.2.3