aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2018-01-03 16:21:22 +0100
committerLuc Donnet2018-01-03 16:21:22 +0100
commitc29270e53191723dafd12461a3bb4c054c1602fd (patch)
tree0aa129d69e6b357c53942d115de645bcfb52d2e4
parente3b26ccda3f18661538e411c66a9c47d7bfe04ea (diff)
downloadchouette-core-c29270e53191723dafd12461a3bb4c054c1602fd.tar.bz2
Fix import messages style Refs #4473 @2
-rw-r--r--app/assets/stylesheets/modules/import_messages.sass37
-rw-r--r--app/helpers/imports_helper.rb14
-rw-r--r--app/views/imports/_import_messages.html.slim11
-rw-r--r--spec/views/imports/show.html.slim_spec.rb5
4 files changed, 20 insertions, 47 deletions
diff --git a/app/assets/stylesheets/modules/import_messages.sass b/app/assets/stylesheets/modules/import_messages.sass
index 6a088dc06..cde903b00 100644
--- a/app/assets/stylesheets/modules/import_messages.sass
+++ b/app/assets/stylesheets/modules/import_messages.sass
@@ -4,40 +4,5 @@
h1
padding-bottom: 20px
-
-.import_message-list
+ul.list-unstyled
padding-bottom: 20px
-
- .import_messages-head
- display: block
- font-size: 1.8rem
- font-weight: 700
- border-bottom: 2px solid #4b4b4b
- padding: 5px 15px 6px 15px
-
- dl
- dd, dt
- display: inline-block
- letter-spacing: normal
- word-spacing: normal
- text-rendering: auto
- vertical-align: top
- padding: 5px 15px 6px 15px
-
- dt
- position: relative
- width: 7%
- font-weight: 700
-
- &:before
- content: ""
- display: block
- position: absolute
- z-index: 1
- top: 0
- left: 0
- width: 250%
- border-bottom: 1px solid rgba(164, 164, 164, 0.5)
-
- dd
- width: 93% \ No newline at end of file
diff --git a/app/helpers/imports_helper.rb b/app/helpers/imports_helper.rb
index 1c4549e50..140660153 100644
--- a/app/helpers/imports_helper.rb
+++ b/app/helpers/imports_helper.rb
@@ -15,6 +15,20 @@ module ImportsHelper
end
end
+ # Compliance check set messages
+ def bootstrap_class_for_message_criticity message_criticity
+ case message_criticity
+ when "error"
+ "alert alert-danger"
+ when "warning"
+ "alert alert-warning"
+ when "info"
+ "alert alert-info"
+ else
+ message_criticity.to_s
+ end
+ end
+
##############################
#      TO CLEAN!!!
##############################
diff --git a/app/views/imports/_import_messages.html.slim b/app/views/imports/_import_messages.html.slim
index a10dce065..af10b23e5 100644
--- a/app/views/imports/_import_messages.html.slim
+++ b/app/views/imports/_import_messages.html.slim
@@ -1,11 +1,8 @@
- if import_messages.any?
- .import_message-list
- .import_messages-head Messages
- dl
- - import_messages.each do | import_message |
- dt.criticity
- = import_message.criticity
- dd
+ ul.list-unstyled.import_message-list
+ - import_messages.each do | import_message |
+ li
+ span(class="#{bootstrap_class_for_message_criticity import_message.criticity}")
= t( ['import_messages',
'compliance_check_messages',
import_message.message_key].join('.'), import_message.message_attributes.symbolize_keys)
diff --git a/spec/views/imports/show.html.slim_spec.rb b/spec/views/imports/show.html.slim_spec.rb
index 7a046d1a2..faf473758 100644
--- a/spec/views/imports/show.html.slim_spec.rb
+++ b/spec/views/imports/show.html.slim_spec.rb
@@ -22,10 +22,7 @@ RSpec.describe '/imports/show', type: :view do
messages.each do | message |
# require 'htmlbeautifier'
# b = HtmlBeautifier.beautify(rendered, indent: ' ')
- expect(rendered).to have_selector('.import_message-list dl dt.criticity') do
- with_text message.criticity
- end
- expect(rendered).to have_selector('.import_message-list dl dd') do
+ expect(rendered).to have_selector('.import_message-list li') do
with_text rendered_message( message )
end
end