diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/exports_helper.rb | 2 | ||||
| -rw-r--r-- | app/helpers/imports_helper.rb | 26 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 26 | 
3 files changed, 45 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..f06d77eca 100644 --- a/app/helpers/imports_helper.rb +++ b/app/helpers/imports_helper.rb @@ -2,33 +2,49 @@  module ImportsHelper    # Import statuses helper -  def import_status(status) -    if %w[new running pending].include? status +  def import_status(status, verbose: false, default_status: nil) +    status ||= default_status +    return unless status +    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..0b24a9c05 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -153,7 +153,17 @@ module TableBuilderHelper              i = columns.index(column)              if overhead[i].blank? -              if (i > 0) && (overhead[i - 1][:width] > 1) +              prev = nil +              if i > 0 +                (i-1..0).each do |j| +                  o = overhead[j] +                  if (j + o[:width].to_i) >= i +                    prev = o +                    break +                  end +                end +              end +              if prev                  clsArrayH = overhead[i - 1][:cls].split                  hcont << content_tag(:th, build_column_header( @@ -225,7 +235,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 +244,17 @@ module TableBuilderHelper              i = columns.index(column)              if overhead[i].blank? -              if (i > 0) && (overhead[i - 1][:width] > 1) +              prev = nil +              if i > 0 +                (i-1..0).each do |j| +                  o = overhead[j] +                  if (j + o[:width].to_i) >= i +                    prev = o +                    break +                  end +                end +              end +              if prev                  clsArrayAlt = overhead[i - 1][:cls].split                  bcont << content_tag(:td, link, title: 'Voir', class: td_cls(clsArrayAlt, extra_class)) | 
