aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorcedricnjanga2017-09-06 01:06:47 +0200
committercedricnjanga2017-09-06 09:47:25 +0200
commit53804667d4ba62e29ff687995dfa6d2566139075 (patch)
tree2a1ca835d7d7abccc2e905c6872333ff4916fbb5 /app/views
parentbcea52e515f1eef544da5cfcbfb5e900c69b1081 (diff)
downloadchouette-core-53804667d4ba62e29ff687995dfa6d2566139075.tar.bz2
Updated imports#index date filter : used the same logic for the Calendar#index date filter (ransackable scope)
I realized that we could submit the form with incomplete date which caused an 500 error. So I added a small JS script to prevent user from subnitting filter form with incomplete dates Since it was really similar with previous work I added two folders : /helpers & /filters to be more DRY The JS files are loaded in 4 views for the moment, hence the update in the assets.rb file
Diffstat (limited to 'app/views')
-rw-r--r--app/views/calendars/_filters.html.slim2
-rw-r--r--app/views/calendars/index.html.slim6
-rw-r--r--app/views/imports/_filters.html.slim6
-rw-r--r--app/views/imports/index.html.slim2
-rw-r--r--app/views/time_tables/index.html.slim2
-rw-r--r--app/views/workbenches/show.html.slim2
6 files changed, 14 insertions, 6 deletions
diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim
index 4c30f69dc..b5283c1e8 100644
--- a/app/views/calendars/_filters.html.slim
+++ b/app/views/calendars/_filters.html.slim
@@ -19,4 +19,4 @@
.actions
= link_to 'Effacer', calendars_path, class: 'btn btn-link'
- = f.submit 'Filtrer', id: 'filter_btn', class: 'btn btn-default'
+ = f.submit 'Filtrer', id: 'calendar_filter_btn', class: 'btn btn-default'
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index 1e38786b9..56232b0af 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -13,7 +13,7 @@
.row
.col-lg-12
= render 'filters'
-
+
- if @calendars.any?
.row
.col-lg-12
@@ -39,8 +39,10 @@
cls: 'table has-filter'
= new_pagination @calendars, 'pull-right'
-
+
- unless @calendars.any?
.row.mt-xs
.col-lg-12
= replacement_msg t('calendars.search_no_results')
+
+= javascript_include_tag 'filters/calendar.js'
diff --git a/app/views/imports/_filters.html.slim b/app/views/imports/_filters.html.slim
index 99fcb0232..a216019b6 100644
--- a/app/views/imports/_filters.html.slim
+++ b/app/views/imports/_filters.html.slim
@@ -9,13 +9,13 @@
.ffg-row
.form-group.togglable
= f.label Import.human_attribute_name(:status), required: false, class: 'control-label'
- = f.input :status_eq_any, collection: @imports.map(&:status).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
+ = f.input :status_eq_any, collection: @imports.map(&:status).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + import_status(l) + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}, input_html: { checked: true}
.form-group.togglable
= f.label Import.human_attribute_name(:started_at), required: false, class: 'control-label'
.filter_menu
- = f.input :started_at_eq, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, include_blank: true
+ = f.input :started_on_date, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, include_blank: true
.actions
= link_to t('actions.erase'), workbench_imports_path(@workbench), class: 'btn btn-link'
- = f.submit t('actions.filter'), class: 'btn btn-default'
+ = f.submit t('actions.filter'), id: 'import_filter_btn', class: 'btn btn-default'
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index 37ae3b3c1..2203d3584 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -47,3 +47,5 @@
.row.mt-xs
.col-lg-12
= replacement_msg t('imports.search_no_results')
+
+= javascript_include_tag 'filters/import.js'
diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim
index 1ea5256aa..a1b9c4e09 100644
--- a/app/views/time_tables/index.html.slim
+++ b/app/views/time_tables/index.html.slim
@@ -68,3 +68,5 @@
= javascript_tag do
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
+
+= javascript_include_tag 'filters/timetable.js'
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index 80451ec34..50c719d12 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -77,3 +77,5 @@
= javascript_tag do
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
+
+= javascript_include_tag 'filters/workbench.js'