bootstrap_flash_messages 1.0.1 → 1.1.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
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4009a08cad9e7ed52609e3f7002b19af69a829fff258374fcea188ec18daba45
|
|
4
|
+
data.tar.gz: 969abf35c27433d999b12acd65f80d430e30d9e2cea2526d5b9d77d3831aaee6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3db92aa074dfb64d90321cccd2aa3ee0a4ba5c0cf08bf61bbe0d847d077c8cea0e89328d73b1edd14f214ee42facfdd2f228fc958607b187619376189bc54569
|
|
7
|
+
data.tar.gz: 3cd2784a814488ce84edf01996becf78e68d037117e68acefdd429ca4ef65632c4e2266494848e942b21aabedebc11992f11d0189df4e728d3312aeb45c4b84e
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bootstrap_flash_messages
|
|
2
2
|
|
|
3
|
-
version 1.0
|
|
3
|
+
version 1.1.0
|
|
4
4
|
Robin Brouwer
|
|
5
5
|
|
|
6
6
|
Bootstrap alerts and Rails flash messages combined in one easy-to-use gem.
|
|
@@ -10,9 +10,9 @@ Bootstrap alerts and Rails flash messages combined in one easy-to-use gem.
|
|
|
10
10
|
|
|
11
11
|
You can use this gem by putting the following inside your Gemfile:
|
|
12
12
|
|
|
13
|
-
gem "bootstrap_flash_messages", "~> 1.0
|
|
13
|
+
gem "bootstrap_flash_messages", "~> 1.1.0"
|
|
14
14
|
|
|
15
|
-
When you're using Bootstrap 2, you can use version 0.0.7.
|
|
15
|
+
When you're using Bootstrap 3, you can use version 1.0.2. When you're using Bootstrap 2, you can use version 0.0.7.
|
|
16
16
|
|
|
17
17
|
Now you need flash.en.yml for the flash messages.
|
|
18
18
|
|
|
@@ -23,6 +23,18 @@ And that's it!
|
|
|
23
23
|
|
|
24
24
|
## Changes
|
|
25
25
|
|
|
26
|
+
Version 1.1.0 changes (21/08/2026):
|
|
27
|
+
|
|
28
|
+
- Updated to latest Bootstrap, Ruby & Rails version.
|
|
29
|
+
|
|
30
|
+
Version 1.0.2 changes (05/08/2015):
|
|
31
|
+
|
|
32
|
+
- Added :fade_in.
|
|
33
|
+
|
|
34
|
+
Version 1.0.1 changes (02/08/2015):
|
|
35
|
+
|
|
36
|
+
- Made 'info' the default class.
|
|
37
|
+
|
|
26
38
|
Version 1.0.0 changes (31/01/2014):
|
|
27
39
|
|
|
28
40
|
- Added Boostrap 3 support.
|
|
@@ -75,9 +87,7 @@ Version 0.0.1 changes (08/08/2012):
|
|
|
75
87
|
|
|
76
88
|
## Usage
|
|
77
89
|
|
|
78
|
-
You need [Bootstrap
|
|
79
|
-
|
|
80
|
-
If you're [customizing Bootstrap](http://getbootstrap.com/customize/), make sure to grab the "Alert" and "Component Animations" (the latter one is optional, unless you want the fade-out animation on close).
|
|
90
|
+
You need [Bootstrap 5](http://getbootstrap.com/) for the styling and close button. You can still use it without Bootstrap, but you need to style it yourself. This gem uses the [Bootstrap alerts](https://getbootstrap.com/docs/5.3/components/alerts/).
|
|
81
91
|
|
|
82
92
|
All flash messages are defined inside config/locales/flash.en.yml. They are nested like this:
|
|
83
93
|
|
|
@@ -160,6 +170,16 @@ If you'd like for the flash message to fade out when you click on the close icon
|
|
|
160
170
|
|
|
161
171
|
<%= flash_messages(:close, :fade) %>
|
|
162
172
|
|
|
173
|
+
If you'd like for the flash message to also fade in, you can pass in the `:fade_in` option.
|
|
174
|
+
|
|
175
|
+
<%= flash_messages(:close, :fade, :fade_in) %>
|
|
176
|
+
|
|
177
|
+
# Also add something like this to application.js:
|
|
178
|
+
window.setTimeout(function() {
|
|
179
|
+
$(".alert").addClass("show");
|
|
180
|
+
}, 1000);
|
|
181
|
+
|
|
182
|
+
|
|
163
183
|
Want a heading? Add `:heading`. The headings inside flash.en.yml are used for the headings.
|
|
164
184
|
|
|
165
185
|
<%= flash_messages(:close, :heading) %>
|
|
@@ -228,7 +248,9 @@ I created the [gritter gem](https://github.com/RobinBrouwer/gritter) and used it
|
|
|
228
248
|
I started using Bootstrap and really liked the alerts. I loved the way gritter allowed you to set messages
|
|
229
249
|
and decided to do the same for the Bootstrap alerts. And this is the result!
|
|
230
250
|
|
|
231
|
-
##
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
### The MIT License (MIT)
|
|
232
254
|
|
|
233
255
|
Copyright (C) 2012 Robin Brouwer
|
|
234
256
|
|
|
@@ -248,4 +270,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
248
270
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
249
271
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
250
272
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
251
|
-
SOFTWARE.
|
|
273
|
+
SOFTWARE.
|
|
@@ -8,14 +8,14 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
9
|
s.authors = ["Robin Brouwer"]
|
|
10
10
|
s.email = ["robin@sparkforce.nl"]
|
|
11
|
-
s.homepage = "
|
|
12
|
-
s.summary =
|
|
13
|
-
s.description =
|
|
14
|
-
|
|
15
|
-
s.rubyforge_project = "nowarning"
|
|
11
|
+
s.homepage = "https://github.com/RobinBrouwer/bootstrap_flash_messages"
|
|
12
|
+
s.summary = "Bootstrap alerts for Rails flash messages."
|
|
13
|
+
s.description = "Bootstrap alerts and Rails flash messages combined in one easy-to-use gem."
|
|
14
|
+
s.license = "MIT"
|
|
16
15
|
|
|
17
16
|
s.files = `git ls-files`.split("\n")
|
|
18
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
19
|
s.require_paths = ["lib"]
|
|
20
|
+
s.required_ruby_version = ">= 3.0"
|
|
21
21
|
end
|
|
@@ -49,13 +49,13 @@ module BootstrapFlashMessages
|
|
|
49
49
|
|
|
50
50
|
begin
|
|
51
51
|
options[:raise] = true
|
|
52
|
-
translation = I18n.t(i18n_key, options)
|
|
52
|
+
translation = I18n.t(i18n_key, **options)
|
|
53
53
|
rescue I18n::MissingTranslationData
|
|
54
54
|
begin
|
|
55
|
-
translation = I18n.t(i18n_default_action_key, options)
|
|
55
|
+
translation = I18n.t(i18n_default_action_key, **options)
|
|
56
56
|
rescue I18n::MissingTranslationData
|
|
57
57
|
options[:raise] = false
|
|
58
|
-
translation = I18n.t(i18n_default_key, options)
|
|
58
|
+
translation = I18n.t(i18n_default_key, **options)
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -8,25 +8,27 @@ module BootstrapFlashMessages
|
|
|
8
8
|
unescape_html = args.include?(:html)
|
|
9
9
|
simple_format = args.include?(:simple_format)
|
|
10
10
|
fade = args.include?(:fade)
|
|
11
|
+
fade_in = args.include?(:fade_in)
|
|
11
12
|
|
|
12
13
|
messages = []
|
|
13
|
-
flash.
|
|
14
|
-
|
|
14
|
+
flash_messages = flash.to_hash.with_indifferent_access
|
|
15
|
+
flash_messages.each do |key, value|
|
|
16
|
+
next if key == 'timedout'
|
|
15
17
|
|
|
16
18
|
heading = ""
|
|
17
19
|
if show_heading
|
|
18
20
|
heading_text = I18n.t("flash_messages.headings.#{key}")
|
|
19
|
-
heading = (block ? content_tag(:h4, heading_text, :
|
|
21
|
+
heading = (block ? content_tag(:h4, heading_text, class: "alert-heading") : content_tag(:strong, heading_text))
|
|
20
22
|
end
|
|
21
23
|
close = ""
|
|
22
24
|
if show_close
|
|
23
|
-
close = content_tag(:button,
|
|
25
|
+
close = content_tag(:button, nil, type: "button", class: "btn-close", "data-bs-dismiss" => "alert", "aria-label" => "Close")
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
value = simple_format(value) if simple_format
|
|
27
29
|
value = raw(value) if unescape_html
|
|
28
30
|
|
|
29
|
-
messages << content_tag(:div,
|
|
31
|
+
messages << content_tag(:div, raw(heading + " " + value + close), role: "alert", class: "alert alert-#{BootstrapFlashMessages.alert_class_mapping(key)}#{' alert-dismissible' if show_close}#{" fade#{" show" unless fade_in}" if fade || fade_in}")
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
raw(messages.join)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootstrap_flash_messages
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Brouwer
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Bootstrap alerts and Rails flash messages combined in one easy-to-use
|
|
14
13
|
gem.
|
|
@@ -32,10 +31,10 @@ files:
|
|
|
32
31
|
- lib/generators/bootstrap_flash_messages/USAGE
|
|
33
32
|
- lib/generators/bootstrap_flash_messages/locale_generator.rb
|
|
34
33
|
- lib/generators/bootstrap_flash_messages/templates/flash.en.yml
|
|
35
|
-
homepage:
|
|
36
|
-
licenses:
|
|
34
|
+
homepage: https://github.com/RobinBrouwer/bootstrap_flash_messages
|
|
35
|
+
licenses:
|
|
36
|
+
- MIT
|
|
37
37
|
metadata: {}
|
|
38
|
-
post_install_message:
|
|
39
38
|
rdoc_options: []
|
|
40
39
|
require_paths:
|
|
41
40
|
- lib
|
|
@@ -43,16 +42,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
43
42
|
requirements:
|
|
44
43
|
- - ">="
|
|
45
44
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
45
|
+
version: '3.0'
|
|
47
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
47
|
requirements:
|
|
49
48
|
- - ">="
|
|
50
49
|
- !ruby/object:Gem::Version
|
|
51
50
|
version: '0'
|
|
52
51
|
requirements: []
|
|
53
|
-
|
|
54
|
-
rubygems_version: 2.2.2
|
|
55
|
-
signing_key:
|
|
52
|
+
rubygems_version: 3.6.9
|
|
56
53
|
specification_version: 4
|
|
57
|
-
summary: Bootstrap alerts
|
|
54
|
+
summary: Bootstrap alerts for Rails flash messages.
|
|
58
55
|
test_files: []
|