flash_rails_messages 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac8e089ebf1d9387ddd1c4b94d60e166d33a4911f48bc818551a7c2309b8370
|
4
|
+
data.tar.gz: ac6af14b093fae1c46e76671c6571d0a17ed9352cff64936c915e5e064c6fd14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0342b06783f62263b3f4372810d4b642b8a872ea59784618edfe7e1d6f51f1cece8cefbf208594828854d7210f8d9fca7adb0dcf0e2c57a8aa3e39565bea831d
|
7
|
+
data.tar.gz: b78f1a5e51638e829c65200245732cd59791b21730dd8f35c3808597d3eb7c5814b25bac15a7df378423793d569eaaa21a5903a78b77ac16859740629ca76ae7
|
@@ -1,7 +1,13 @@
|
|
1
1
|
module FlashRailsMessages
|
2
2
|
class Base
|
3
|
-
include ActionView::Helpers::TagHelper
|
4
3
|
include ActionView::Context
|
4
|
+
include ActionView::Helpers::TagHelper
|
5
|
+
|
6
|
+
attr_reader :options
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@options = options
|
10
|
+
end
|
5
11
|
|
6
12
|
def render(flash)
|
7
13
|
flash = Hash[flash].symbolize_keys
|
@@ -11,8 +17,11 @@ module FlashRailsMessages
|
|
11
17
|
private
|
12
18
|
|
13
19
|
def alert_element(type, message)
|
14
|
-
content_tag :div,
|
15
|
-
|
20
|
+
content_tag :div, alert_options(type) do
|
21
|
+
content = ActiveSupport::SafeBuffer.new
|
22
|
+
content += close_element if options.fetch(:dismissible, false)
|
23
|
+
content += message.html_safe
|
24
|
+
content
|
16
25
|
end
|
17
26
|
end
|
18
27
|
|
@@ -22,8 +31,18 @@ module FlashRailsMessages
|
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
34
|
+
def alert_options(type)
|
35
|
+
options.except(:dismissible)
|
36
|
+
.merge(class: alert_classes(type))
|
37
|
+
end
|
38
|
+
|
25
39
|
def alert_classes(type)
|
26
|
-
|
40
|
+
[
|
41
|
+
default_alert_classes,
|
42
|
+
alert_type_classes[type],
|
43
|
+
custom_alert_classes,
|
44
|
+
options[:class]
|
45
|
+
].compact.join(' ').strip
|
27
46
|
end
|
28
47
|
|
29
48
|
def default_alert_classes
|