aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/exports_helper.rb2
-rw-r--r--app/helpers/imports_helper.rb24
-rw-r--r--app/helpers/table_builder_helper.rb6
3 files changed, 23 insertions, 9 deletions
diff --git a/app/helpers/exports_helper.rb b/app/helpers/exports_helper.rb
index 2e784ad35..f30a80ed9 100644
--- a/app/helpers/exports_helper.rb
+++ b/app/helpers/exports_helper.rb
@@ -17,7 +17,7 @@ module ExportsHelper
message.message_attributes["text"]
else
t([message.class.name.underscore.gsub('/', '_').pluralize, message.message_key].join('.'), message.message_attributes&.symbolize_keys || {})
- end
+ end.html_safe
end
def fields_for_export_task_format(form)
diff --git a/app/helpers/imports_helper.rb b/app/helpers/imports_helper.rb
index 140660153..a297c2521 100644
--- a/app/helpers/imports_helper.rb
+++ b/app/helpers/imports_helper.rb
@@ -2,33 +2,47 @@
module ImportsHelper
# Import statuses helper
- def import_status(status)
- if %w[new running pending].include? status
+ def import_status(status, verbose: false)
+ status = status.to_s.downcase
+ out = if %w[new running pending].include? status
content_tag :span, '', class: "fa fa-clock-o"
else
cls =''
cls = 'success' if status == 'successful'
+ cls = 'success' if status == 'ok'
cls = 'warning' if status == 'warning'
- cls = 'danger' if %w[failed aborted canceled].include? status
+ cls = 'danger' if %w[failed aborted canceled error].include? status
content_tag :span, '', class: "fa fa-circle text-#{cls}"
end
+ if verbose
+ out += content_tag :span do
+ txt = "imports.status.#{status}".t(fallback: "")
+ end
+ end
+ out
end
# Compliance check set messages
def bootstrap_class_for_message_criticity message_criticity
- case message_criticity
- when "error"
+ case message_criticity.downcase
+ when "error", "aborted"
"alert alert-danger"
when "warning"
"alert alert-warning"
when "info"
"alert alert-info"
+ when "ok", "success"
+ "alert alert-success"
else
message_criticity.to_s
end
end
+ def import_message_content message
+ export_message_content message
+ end
+
##############################
#      TO CLEAN!!!
##############################
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb
index e2aa2e9ea..8c73cb33c 100644
--- a/app/helpers/table_builder_helper.rb
+++ b/app/helpers/table_builder_helper.rb
@@ -153,7 +153,7 @@ module TableBuilderHelper
i = columns.index(column)
if overhead[i].blank?
- if (i > 0) && (overhead[i - 1][:width] > 1)
+ if (i > 0) && overhead[i - 1][:width] && (overhead[i - 1][:width] > 1)
clsArrayH = overhead[i - 1][:cls].split
hcont << content_tag(:th, build_column_header(
@@ -225,7 +225,7 @@ module TableBuilderHelper
if column.linkable?
path = column.link_to(item)
- link = value.present? && path.present? ? link_to(value, path) : ""
+ link = value.present? && path.present? ? link_to(value, path) : value
if overhead.empty?
bcont << content_tag(:td, link, title: 'Voir', class: extra_class)
@@ -234,7 +234,7 @@ module TableBuilderHelper
i = columns.index(column)
if overhead[i].blank?
- if (i > 0) && (overhead[i - 1][:width] > 1)
+ if (i > 0) && overhead[i - 1][:width] && (overhead[i - 1][:width] > 1)
clsArrayAlt = overhead[i - 1][:cls].split
bcont << content_tag(:td, link, title: 'Voir', class: td_cls(clsArrayAlt, extra_class))