diff options
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/time_tables/index.html.slim | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index cd682a741..eedfef07c 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -96,15 +96,11 @@ class TimeTablesController < ChouetteController scope = select_time_tables if params[:q] && params[:q]["tag_search"] tags = params[:q]["tag_search"].reject {|c| c.empty?} - if tags.any? - # Hack to delete params can't be used by ransack - params[:q].delete("tag_search") - scope = select_time_tables.tagged_with(tags, :wild => true, :any => true) - end + params[:q].delete("tag_search") + scope = select_time_tables.tagged_with(tags, :wild => true, :any => true) if tags.any? end @q = scope.search(params[:q]) - if sort_column && sort_direction @time_tables ||= @q.result(:distinct => true).order("#{sort_column} #{sort_direction}") else diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index 84ad539c2..65d0787e8 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -22,11 +22,11 @@ = 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' } + .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 @@ -44,7 +44,7 @@ 'table has-search' = new_pagination @time_tables, 'pull-right' - + - unless @time_tables.any? .row.mt-xs .col-lg-12 |
