flash_rails_messages 1.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,9 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "simplecov"
6
- gem "appraisal"
7
- gem "coveralls", require: false
8
- gem "rails", "~> 4.2"
5
+ gem "rails", "~> 6.0.0"
9
6
 
10
7
  gemspec path: "../"
@@ -0,0 +1,183 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ flash_rails_messages (2.2.0)
5
+ rails (>= 5.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.3.6)
11
+ actionpack (= 6.0.3.6)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.3.6)
15
+ actionpack (= 6.0.3.6)
16
+ activejob (= 6.0.3.6)
17
+ activerecord (= 6.0.3.6)
18
+ activestorage (= 6.0.3.6)
19
+ activesupport (= 6.0.3.6)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.3.6)
22
+ actionpack (= 6.0.3.6)
23
+ actionview (= 6.0.3.6)
24
+ activejob (= 6.0.3.6)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.3.6)
28
+ actionview (= 6.0.3.6)
29
+ activesupport (= 6.0.3.6)
30
+ rack (~> 2.0, >= 2.0.8)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.3.6)
35
+ actionpack (= 6.0.3.6)
36
+ activerecord (= 6.0.3.6)
37
+ activestorage (= 6.0.3.6)
38
+ activesupport (= 6.0.3.6)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.3.6)
41
+ activesupport (= 6.0.3.6)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.3.6)
47
+ activesupport (= 6.0.3.6)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.3.6)
50
+ activesupport (= 6.0.3.6)
51
+ activerecord (6.0.3.6)
52
+ activemodel (= 6.0.3.6)
53
+ activesupport (= 6.0.3.6)
54
+ activestorage (6.0.3.6)
55
+ actionpack (= 6.0.3.6)
56
+ activejob (= 6.0.3.6)
57
+ activerecord (= 6.0.3.6)
58
+ marcel (~> 1.0.0)
59
+ activesupport (6.0.3.6)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.2, >= 2.2.2)
65
+ appraisal (2.4.0)
66
+ bundler
67
+ rake
68
+ thor (>= 0.14.0)
69
+ builder (3.2.4)
70
+ concurrent-ruby (1.1.8)
71
+ coveralls (0.8.23)
72
+ json (>= 1.8, < 3)
73
+ simplecov (~> 0.16.1)
74
+ term-ansicolor (~> 1.3)
75
+ thor (>= 0.19.4, < 2.0)
76
+ tins (~> 1.6)
77
+ crass (1.0.6)
78
+ diff-lcs (1.4.4)
79
+ docile (1.3.5)
80
+ erubi (1.10.0)
81
+ globalid (0.4.2)
82
+ activesupport (>= 4.2.0)
83
+ i18n (1.8.10)
84
+ concurrent-ruby (~> 1.0)
85
+ json (2.5.1)
86
+ loofah (2.9.0)
87
+ crass (~> 1.0.2)
88
+ nokogiri (>= 1.5.9)
89
+ mail (2.7.1)
90
+ mini_mime (>= 0.1.1)
91
+ marcel (1.0.1)
92
+ method_source (1.0.0)
93
+ mini_mime (1.1.0)
94
+ mini_portile2 (2.5.0)
95
+ minitest (5.14.4)
96
+ nio4r (2.5.7)
97
+ nokogiri (1.11.2)
98
+ mini_portile2 (~> 2.5.0)
99
+ racc (~> 1.4)
100
+ racc (1.5.2)
101
+ rack (2.2.3)
102
+ rack-test (1.1.0)
103
+ rack (>= 1.0, < 3)
104
+ rails (6.0.3.6)
105
+ actioncable (= 6.0.3.6)
106
+ actionmailbox (= 6.0.3.6)
107
+ actionmailer (= 6.0.3.6)
108
+ actionpack (= 6.0.3.6)
109
+ actiontext (= 6.0.3.6)
110
+ actionview (= 6.0.3.6)
111
+ activejob (= 6.0.3.6)
112
+ activemodel (= 6.0.3.6)
113
+ activerecord (= 6.0.3.6)
114
+ activestorage (= 6.0.3.6)
115
+ activesupport (= 6.0.3.6)
116
+ bundler (>= 1.3.0)
117
+ railties (= 6.0.3.6)
118
+ sprockets-rails (>= 2.0.0)
119
+ rails-dom-testing (2.0.3)
120
+ activesupport (>= 4.2.0)
121
+ nokogiri (>= 1.6)
122
+ rails-html-sanitizer (1.3.0)
123
+ loofah (~> 2.3)
124
+ railties (6.0.3.6)
125
+ actionpack (= 6.0.3.6)
126
+ activesupport (= 6.0.3.6)
127
+ method_source
128
+ rake (>= 0.8.7)
129
+ thor (>= 0.20.3, < 2.0)
130
+ rake (13.0.3)
131
+ rspec (3.10.0)
132
+ rspec-core (~> 3.10.0)
133
+ rspec-expectations (~> 3.10.0)
134
+ rspec-mocks (~> 3.10.0)
135
+ rspec-core (3.10.1)
136
+ rspec-support (~> 3.10.0)
137
+ rspec-expectations (3.10.1)
138
+ diff-lcs (>= 1.2.0, < 2.0)
139
+ rspec-support (~> 3.10.0)
140
+ rspec-mocks (3.10.2)
141
+ diff-lcs (>= 1.2.0, < 2.0)
142
+ rspec-support (~> 3.10.0)
143
+ rspec-support (3.10.2)
144
+ simplecov (0.16.1)
145
+ docile (~> 1.1)
146
+ json (>= 1.8, < 3)
147
+ simplecov-html (~> 0.10.0)
148
+ simplecov-html (0.10.2)
149
+ sprockets (4.0.2)
150
+ concurrent-ruby (~> 1.0)
151
+ rack (> 1, < 3)
152
+ sprockets-rails (3.2.2)
153
+ actionpack (>= 4.0)
154
+ activesupport (>= 4.0)
155
+ sprockets (>= 3.0.0)
156
+ sync (0.5.0)
157
+ term-ansicolor (1.7.1)
158
+ tins (~> 1.0)
159
+ thor (1.1.0)
160
+ thread_safe (0.3.6)
161
+ tins (1.28.0)
162
+ sync
163
+ tzinfo (1.2.9)
164
+ thread_safe (~> 0.1)
165
+ websocket-driver (0.7.3)
166
+ websocket-extensions (>= 0.1.0)
167
+ websocket-extensions (0.1.5)
168
+ zeitwerk (2.4.2)
169
+
170
+ PLATFORMS
171
+ ruby
172
+
173
+ DEPENDENCIES
174
+ appraisal (~> 2.4)
175
+ bundler (~> 2.0)
176
+ coveralls (~> 0.8)
177
+ flash_rails_messages!
178
+ rails (~> 6.0.0)
179
+ rake (~> 13.0)
180
+ rspec (~> 3.10)
181
+
182
+ BUNDLED WITH
183
+ 2.2.15
@@ -2,9 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "simplecov"
6
- gem "appraisal"
7
- gem "coveralls", require: false
8
- gem "rails", "~> 5.0.0"
5
+ gem "rails", "~> 6.1.0"
9
6
 
10
7
  gemspec path: "../"
@@ -0,0 +1,186 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ flash_rails_messages (2.2.0)
5
+ rails (>= 5.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.3.1)
11
+ actionpack (= 6.1.3.1)
12
+ activesupport (= 6.1.3.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.3.1)
16
+ actionpack (= 6.1.3.1)
17
+ activejob (= 6.1.3.1)
18
+ activerecord (= 6.1.3.1)
19
+ activestorage (= 6.1.3.1)
20
+ activesupport (= 6.1.3.1)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.3.1)
23
+ actionpack (= 6.1.3.1)
24
+ actionview (= 6.1.3.1)
25
+ activejob (= 6.1.3.1)
26
+ activesupport (= 6.1.3.1)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.3.1)
30
+ actionview (= 6.1.3.1)
31
+ activesupport (= 6.1.3.1)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.3.1)
37
+ actionpack (= 6.1.3.1)
38
+ activerecord (= 6.1.3.1)
39
+ activestorage (= 6.1.3.1)
40
+ activesupport (= 6.1.3.1)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.3.1)
43
+ activesupport (= 6.1.3.1)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.3.1)
49
+ activesupport (= 6.1.3.1)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.1.3.1)
52
+ activesupport (= 6.1.3.1)
53
+ activerecord (6.1.3.1)
54
+ activemodel (= 6.1.3.1)
55
+ activesupport (= 6.1.3.1)
56
+ activestorage (6.1.3.1)
57
+ actionpack (= 6.1.3.1)
58
+ activejob (= 6.1.3.1)
59
+ activerecord (= 6.1.3.1)
60
+ activesupport (= 6.1.3.1)
61
+ marcel (~> 1.0.0)
62
+ mini_mime (~> 1.0.2)
63
+ activesupport (6.1.3.1)
64
+ concurrent-ruby (~> 1.0, >= 1.0.2)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ appraisal (2.4.0)
70
+ bundler
71
+ rake
72
+ thor (>= 0.14.0)
73
+ builder (3.2.4)
74
+ concurrent-ruby (1.1.8)
75
+ coveralls (0.8.23)
76
+ json (>= 1.8, < 3)
77
+ simplecov (~> 0.16.1)
78
+ term-ansicolor (~> 1.3)
79
+ thor (>= 0.19.4, < 2.0)
80
+ tins (~> 1.6)
81
+ crass (1.0.6)
82
+ diff-lcs (1.4.4)
83
+ docile (1.3.5)
84
+ erubi (1.10.0)
85
+ globalid (0.4.2)
86
+ activesupport (>= 4.2.0)
87
+ i18n (1.8.10)
88
+ concurrent-ruby (~> 1.0)
89
+ json (2.5.1)
90
+ loofah (2.9.0)
91
+ crass (~> 1.0.2)
92
+ nokogiri (>= 1.5.9)
93
+ mail (2.7.1)
94
+ mini_mime (>= 0.1.1)
95
+ marcel (1.0.1)
96
+ method_source (1.0.0)
97
+ mini_mime (1.0.3)
98
+ mini_portile2 (2.5.0)
99
+ minitest (5.14.4)
100
+ nio4r (2.5.7)
101
+ nokogiri (1.11.2)
102
+ mini_portile2 (~> 2.5.0)
103
+ racc (~> 1.4)
104
+ racc (1.5.2)
105
+ rack (2.2.3)
106
+ rack-test (1.1.0)
107
+ rack (>= 1.0, < 3)
108
+ rails (6.1.3.1)
109
+ actioncable (= 6.1.3.1)
110
+ actionmailbox (= 6.1.3.1)
111
+ actionmailer (= 6.1.3.1)
112
+ actionpack (= 6.1.3.1)
113
+ actiontext (= 6.1.3.1)
114
+ actionview (= 6.1.3.1)
115
+ activejob (= 6.1.3.1)
116
+ activemodel (= 6.1.3.1)
117
+ activerecord (= 6.1.3.1)
118
+ activestorage (= 6.1.3.1)
119
+ activesupport (= 6.1.3.1)
120
+ bundler (>= 1.15.0)
121
+ railties (= 6.1.3.1)
122
+ sprockets-rails (>= 2.0.0)
123
+ rails-dom-testing (2.0.3)
124
+ activesupport (>= 4.2.0)
125
+ nokogiri (>= 1.6)
126
+ rails-html-sanitizer (1.3.0)
127
+ loofah (~> 2.3)
128
+ railties (6.1.3.1)
129
+ actionpack (= 6.1.3.1)
130
+ activesupport (= 6.1.3.1)
131
+ method_source
132
+ rake (>= 0.8.7)
133
+ thor (~> 1.0)
134
+ rake (13.0.3)
135
+ rspec (3.10.0)
136
+ rspec-core (~> 3.10.0)
137
+ rspec-expectations (~> 3.10.0)
138
+ rspec-mocks (~> 3.10.0)
139
+ rspec-core (3.10.1)
140
+ rspec-support (~> 3.10.0)
141
+ rspec-expectations (3.10.1)
142
+ diff-lcs (>= 1.2.0, < 2.0)
143
+ rspec-support (~> 3.10.0)
144
+ rspec-mocks (3.10.2)
145
+ diff-lcs (>= 1.2.0, < 2.0)
146
+ rspec-support (~> 3.10.0)
147
+ rspec-support (3.10.2)
148
+ simplecov (0.16.1)
149
+ docile (~> 1.1)
150
+ json (>= 1.8, < 3)
151
+ simplecov-html (~> 0.10.0)
152
+ simplecov-html (0.10.2)
153
+ sprockets (4.0.2)
154
+ concurrent-ruby (~> 1.0)
155
+ rack (> 1, < 3)
156
+ sprockets-rails (3.2.2)
157
+ actionpack (>= 4.0)
158
+ activesupport (>= 4.0)
159
+ sprockets (>= 3.0.0)
160
+ sync (0.5.0)
161
+ term-ansicolor (1.7.1)
162
+ tins (~> 1.0)
163
+ thor (1.1.0)
164
+ tins (1.28.0)
165
+ sync
166
+ tzinfo (2.0.4)
167
+ concurrent-ruby (~> 1.0)
168
+ websocket-driver (0.7.3)
169
+ websocket-extensions (>= 0.1.0)
170
+ websocket-extensions (0.1.5)
171
+ zeitwerk (2.4.2)
172
+
173
+ PLATFORMS
174
+ ruby
175
+
176
+ DEPENDENCIES
177
+ appraisal (~> 2.4)
178
+ bundler (~> 2.0)
179
+ coveralls (~> 0.8)
180
+ flash_rails_messages!
181
+ rails (~> 6.1.0)
182
+ rake (~> 13.0)
183
+ rspec (~> 3.10)
184
+
185
+ BUNDLED WITH
186
+ 2.2.15
@@ -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, class: alert_classes(type) do
15
- close_element + message.html_safe
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,11 +31,26 @@ module FlashRailsMessages
22
31
  end
23
32
  end
24
33
 
34
+ def alert_options(type)
35
+ default_alert_options
36
+ .merge(options.except(:dismissible))
37
+ .merge(class: alert_classes(type))
38
+ end
39
+
25
40
  def alert_classes(type)
26
- "#{default_alert_class} #{alert_type_classes[type]} #{custom_alert_classes}".strip
41
+ [
42
+ default_alert_classes,
43
+ alert_type_classes[type],
44
+ custom_alert_classes,
45
+ options[:class]
46
+ ].compact.join(' ').strip
47
+ end
48
+
49
+ def default_alert_options
50
+ {}
27
51
  end
28
52
 
29
- def default_alert_class
53
+ def default_alert_classes
30
54
  'alert'
31
55
  end
32
56