diff options
| author | Zog | 2018-04-24 14:00:17 +0200 |
|---|---|---|
| committer | Zog | 2018-05-07 15:03:07 +0200 |
| commit | 42ac1fa61ea79fe612bcd98f2b38bad5b6f24421 (patch) | |
| tree | 71e1023bde0de16489df1df798f962b8b4d85219 /app/helpers/imports_helper.rb | |
| parent | 3750a1da0650b692046d7422537a310ba5c5bfd6 (diff) | |
| download | chouette-core-42ac1fa61ea79fe612bcd98f2b38bad5b6f24421.tar.bz2 | |
Rework imports to use Resources and make the a little more verbose
Diffstat (limited to 'app/helpers/imports_helper.rb')
| -rw-r--r-- | app/helpers/imports_helper.rb | 24 |
1 files changed, 19 insertions, 5 deletions
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!!! ############################## |
