diff options
| author | jpl | 2017-04-11 14:32:44 +0200 |
|---|---|---|
| committer | jpl | 2017-04-11 14:32:52 +0200 |
| commit | 3862831d652caa0d6085af5aa2dffded2b47bb1b (patch) | |
| tree | 6c546dc92bd0cbfded5ef96597d8decee7f7a795 | |
| parent | cacf29a1b4a679e70a017053ed25e0ed7d095d10 (diff) | |
| download | chouette-core-3862831d652caa0d6085af5aa2dffded2b47bb1b.tar.bz2 | |
Refs #2909: working on tt#index filters/search
| -rw-r--r-- | app/assets/stylesheets/components/_select2.sass | 13 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 2 | ||||
| -rw-r--r-- | app/views/time_tables/index.html.slim | 50 |
3 files changed, 35 insertions, 30 deletions
diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass index 5e3741bf0..6f329cd27 100644 --- a/app/assets/stylesheets/components/_select2.sass +++ b/app/assets/stylesheets/components/_select2.sass @@ -50,9 +50,16 @@ .form-filter .form-group.select2ed - .select2-container--bootstrap .select2-selection--single - height: 31px - padding: 4px 24px 5px 12px + .select2-container--bootstrap + .select2-selection--single, .select2-selection--multiple + height: 31px + padding: 0px 3px 4px 6px + + .select2-selection--multiple + min-height: 31px + + .select2-search--inline .select2-search__field + height: 28px .select2-container--bootstrap .select2-selection border-color: rgba($grey, 0.3) diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 2e03485f2..cb7c96e03 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -95,7 +95,7 @@ class TimeTablesController < ChouetteController def collection ransack_params = params[:q] # Hack to delete params can't be used by ransack - tag_search = ransack_params["tag_search"].split(",").collect(&:strip) if ransack_params.present? && ransack_params["tag_search"].present? + tag_search = ransack_params["tag_search"] if ransack_params.present? && ransack_params["tag_search"].present? ransack_params.delete("tag_search") if ransack_params.present? selected_time_tables = tag_search ? select_time_tables.tagged_with(tag_search, :wild => true, :any => true) : select_time_tables diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index 6653d6015..ef835c956 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -9,31 +9,29 @@ .container-fluid .row .col-lg-12 - = search_form_for @q, :url => referential_time_tables_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| - .panel.panel-default - .panel-heading - .input-group.col-md-9 - = f.text_field :comment_cont, :placeholder => "#{t('.comment')}", class: 'form-control' - - .input-group-btn - button.btn.btn-default type="submit" - i.fa.fa-search - - a data-toggle="collapse" data-parent="#search" href="#advanced_search" - i.fa.fa-plus - = "#{t('.advanced_search')}" - - #advanced_search.panel-collapse.collapse - .panel-body - div - label = "#{t('.from')}" - = f.text_field :start_date_gteq, :placeholder => "#{t('.start_date')}", class: 'form-control date_picker', :type => "date" - - label = "#{t('.to')}" - = f.text_field :end_date_lteq, :placeholder => "#{t('.end_date')}", class: 'form-control date_picker', :type => "date" - - div - = f.text_field :tag_search, :placeholder => "#{t('.tag_search')}", class: 'form-control' + = 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 + = f.text_field :comment_cont, :placeholder => "#{t('.comment')}", class: 'form-control' + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search + + .ffg-row + .form-group + = f.label @time_tables.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 + + / .form-group.togglable + / = f.label @time_tables.human_attribute_name(:bounding_dates), required: false, class: 'control-label' + / .filter_menu + / = f.input :start_date_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date filter_menu-item' } + / = f.input :end_date_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' - if @time_tables.any? .row @@ -48,6 +46,6 @@ = new_pagination @time_tables, 'pull-right' - unless @time_tables.any? - .row + .row.mt-xs .col-lg-12 = replacement_msg t('time_tables.search_no_results') |
