aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2017-08-17 14:31:32 +0200
committerjpl2017-08-17 14:31:39 +0200
commit42a008e294717f91ba4af3d65d4c007b116d37a6 (patch)
treefbe4d6849387936f31a63ad8b57897b35d1d85d1
parent8176b98b2e84ce62299f79a048156c0ec443e49e (diff)
downloadchouette-core-42a008e294717f91ba4af3d65d4c007b116d37a6.tar.bz2
Refs #4256: Adding filters on imports#index
-rw-r--r--app/decorators/import_decorator.rb2
-rw-r--r--app/views/imports/_filters.html.slim16
-rw-r--r--app/views/imports/index.html.slim5
-rw-r--r--config/locales/imports.en.yml1
-rw-r--r--config/locales/imports.fr.yml1
5 files changed, 24 insertions, 1 deletions
diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb
index 4f621f890..eb6a34a13 100644
--- a/app/decorators/import_decorator.rb
+++ b/app/decorators/import_decorator.rb
@@ -15,7 +15,7 @@ class ImportDecorator < Draper::Decorator
)
links << Link.new(
- content: "Téléch. fichier source",
+ content: h.t('imports.actions.download'),
href: object.file.url
)
diff --git a/app/views/imports/_filters.html.slim b/app/views/imports/_filters.html.slim
new file mode 100644
index 000000000..4ff0a1799
--- /dev/null
+++ b/app/views/imports/_filters.html.slim
@@ -0,0 +1,16 @@
+= search_form_for @q, url: workbench_imports_path(@workbench), html: { method: :get, class: 'form form-filter' } do |f|
+ .ffg-row
+ .input-group.search_bar
+ = f.search_field :name_cont, class: 'form-control', placeholder: "Indiquez un nom d'importation..."
+ span.input-group-btn
+ button.btn.btn-default#search_btn type='submit'
+ span.fa.fa-search
+
+ .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'}
+
+ .actions
+ = link_to t('actions.erase'), workbench_imports_path(@workbench), class: 'btn btn-link'
+ = f.submit t('actions.filter'), class: 'btn btn-default'
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index 2630e5973..59991ebac 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -8,6 +8,11 @@
/ PageContent
.page_content
.container-fluid
+ - if params[:q].present? or @imports.any?
+ .row
+ .col-lg-12
+ = render 'filters'
+
- if @imports.any?
.row
.col-lg-12
diff --git a/config/locales/imports.en.yml b/config/locales/imports.en.yml
index 1abd4f380..58cad3839 100644
--- a/config/locales/imports.en.yml
+++ b/config/locales/imports.en.yml
@@ -4,6 +4,7 @@ en:
actions:
new: "New import"
show: "Import report"
+ download: "Download original file"
destroy: "Destroy"
destroy_confirm: "Are you sure you want destroy this import?"
index:
diff --git a/config/locales/imports.fr.yml b/config/locales/imports.fr.yml
index 36aaef525..3a367c6e0 100644
--- a/config/locales/imports.fr.yml
+++ b/config/locales/imports.fr.yml
@@ -4,6 +4,7 @@ fr:
actions:
new: "Nouvel import"
show: "Rapport d'import"
+ download: "Téléch. fichier source"
destroy: "Supprimer cet import"
destroy_confirm: "Etes vous sûr de supprimer cet import ?"
index: