aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/decorators/import_decorator.rb32
-rw-r--r--app/helpers/table_builder_helper.rb6
-rw-r--r--app/views/imports/index.html.slim12
-rw-r--r--config/locales/imports.en.yml1
-rw-r--r--config/locales/imports.fr.yml1
5 files changed, 29 insertions, 23 deletions
diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb
index 2cf1defc4..4f621f890 100644
--- a/app/decorators/import_decorator.rb
+++ b/app/decorators/import_decorator.rb
@@ -6,17 +6,29 @@ class ImportDecorator < Draper::Decorator
def action_links
links = []
- if h.policy(object).destroy?
- links << Link.new(
- content: t('actions.destroy'),
- href: h.workbench_import_path(
- context[:workbench],
- object
- ),
- method: :delete,
- data: { confirm: h.t('imports.actions.destroy_confirm') }
+ links << Link.new(
+ content: h.t('imports.actions.show'),
+ href: h.workbench_import_path(
+ context[:workbench],
+ object
)
- end
+ )
+
+ links << Link.new(
+ content: "Téléch. fichier source",
+ href: object.file.url
+ )
+
+ # if h.policy(object).destroy?
+ links << Link.new(
+ content: h.destroy_link_content,
+ href: h.workbench_import_path(
+ context[:workbench],
+ object
+ ),
+ method: :delete,
+ data: { confirm: h.t('imports.actions.destroy_confirm') }
+ )
links
end
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb
index 375697bec..b5497b600 100644
--- a/app/helpers/table_builder_helper.rb
+++ b/app/helpers/table_builder_helper.rb
@@ -96,7 +96,9 @@ module TableBuilderHelper
end
# Inserts a blank column for the gear menu
- hcont << content_tag(:th, '') if has_links
+ if has_links || collection.last.try(:action_links).try(:any?)
+ hcont << content_tag(:th, '')
+ end
hcont.join.html_safe
end
@@ -132,7 +134,7 @@ module TableBuilderHelper
end
end
- if links.any?
+ if links.any? || item.try(:action_links).try(:any?)
bcont << content_tag(
:td,
build_links(item, links),
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index fa0109971..2630e5973 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -30,10 +30,8 @@
# attribute: '' \
# ) \
],
- links: [:show, :destroy],
+ links: [],
cls: 'table has-search'
-
- / links to include: show, rapports de controle, dl source, destroy
= new_pagination @imports, 'pull-right'
@@ -41,11 +39,3 @@
.row
.col-lg-12
= replacement_msg t('imports.search_no_results')
-
- .separator
-
- .alert.alert-info
- - @imports.each do |import|
- .import
- li = link_to import.file.file.filename, import.file.url, target: '_blank'
- hr
diff --git a/config/locales/imports.en.yml b/config/locales/imports.en.yml
index a841ac99c..1abd4f380 100644
--- a/config/locales/imports.en.yml
+++ b/config/locales/imports.en.yml
@@ -3,6 +3,7 @@ en:
search_no_results: "No import matching your query"
actions:
new: "New import"
+ show: "Import report"
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 cc41a4f81..36aaef525 100644
--- a/config/locales/imports.fr.yml
+++ b/config/locales/imports.fr.yml
@@ -3,6 +3,7 @@ fr:
search_no_results: "Aucun import ne correspond à votre recherche"
actions:
new: "Nouvel import"
+ show: "Rapport d'import"
destroy: "Supprimer cet import"
destroy_confirm: "Etes vous sûr de supprimer cet import ?"
index: