diff options
| author | cedricnjanga | 2018-01-12 14:51:00 +0100 |
|---|---|---|
| committer | cedricnjanga | 2018-01-12 14:56:34 +0100 |
| commit | 907e0300cc2ff77df67171642c7cc5579a34163a (patch) | |
| tree | 8b8eb904f918ad401004f3e1ae160c27c9aaa3df /app | |
| parent | 04e7d217a77e6b2c70a4a5994993bf0c0bbff08e (diff) | |
| download | chouette-core-907e0300cc2ff77df67171642c7cc5579a34163a.tar.bz2 | |
Refs #5163
Add compliance check resource status helper
Add small changes for CSV export
Diffstat (limited to 'app')
4 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/compliance_check_messages_controller.rb b/app/controllers/compliance_check_messages_controller.rb index 73a821e79..1e4fff6e5 100644 --- a/app/controllers/compliance_check_messages_controller.rb +++ b/app/controllers/compliance_check_messages_controller.rb @@ -7,7 +7,7 @@ class ComplianceCheckMessagesController < ChouetteController def index index! do |format| format.csv { - send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => ",") , :filename => "compliance_check_set_errors_#{line_code}_#{Time.now.to_i}.csv" + send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "compliance_check_set_errors_#{line_code}_#{Time.now.to_i}.csv" } end end diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb index 1862d763e..286bb0ce8 100644 --- a/app/controllers/import_messages_controller.rb +++ b/app/controllers/import_messages_controller.rb @@ -9,7 +9,7 @@ class ImportMessagesController < ChouetteController def index index! do |format| format.csv { - send_data ImportMessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => ",") , :filename => "import_errors_#{@import_resource.name.gsub('.xml', '')}_#{Time.now.to_i}.csv" + send_data ImportMessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "import_errors_#{@import_resource.name.gsub('.xml', '')}_#{Time.now.to_i}.csv" } end end diff --git a/app/helpers/compliance_check_resources_helper.rb b/app/helpers/compliance_check_resources_helper.rb new file mode 100644 index 000000000..95cabed88 --- /dev/null +++ b/app/helpers/compliance_check_resources_helper.rb @@ -0,0 +1,12 @@ +module ComplianceCheckResourcesHelper + + # Comlpiance Check Resources statuses helper + def compliance_check_resource_status(status) + cls = '' + cls = 'success' if status == 'OK' + cls = 'warning' if status == 'WARNING' + cls = 'danger' if %w[ERROR IGNORED].include? status + + content_tag :span, '', class: "fa fa-circle text-#{cls}" + end +end diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim index 9644ed5a2..35a60eb52 100644 --- a/app/views/compliance_check_sets/show.html.slim +++ b/app/views/compliance_check_sets/show.html.slim @@ -46,7 +46,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :status, \ - attribute: Proc.new { |n| compliance_check_set_status(n.status) } \ + attribute: Proc.new { |n| compliance_check_resource_status(n.status) } \ ), \ TableBuilderHelper::Column.new( \ key: :metrics, \ |
