flash_rails_messages 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/gemfiles/rails_5.2.gemfile.lock +1 -1
- data/gemfiles/rails_6.0.gemfile.lock +1 -1
- data/lib/flash_rails_messages/base.rb +6 -1
- data/lib/flash_rails_messages/version.rb +1 -1
- data/lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb +14 -9
- data/lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_foundation.rb +21 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2718f79c329e822f51f939ba80da9e201e0dd5f69759c151393f62cf46cada5
|
4
|
+
data.tar.gz: 2b8307ed629b532a9d6b1dd864a30fe2ee9825453c37bf4cbd871b55736533c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e988fb5a8b2c4f2a58aaf29baa61d547b533e0a97b07579ecb6486851fcbf74ad8d6da6af24f93f273abd11c09cd2d2bec6555112b70e25e8b2cd9dd6e969c31
|
7
|
+
data.tar.gz: dc44669ea619c2cd527ed7f01b0c7c6e92c94ec1e5caa5064ae6bf6f325d358ed2c30e431dcf87bbc21b644bdf73abdea5f065e5f543ea96f11fdbc0628e7584
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Build Status](https://travis-ci.com/alejandrodevs/flash_rails_messages.svg?branch=master)](https://travis-ci.org/alejandrodevs/flash_rails_messages) [![Coverage Status](https://coveralls.io/repos/github/alejandrodevs/flash_rails_messages/badge.svg?branch=master)](https://coveralls.io/github/alejandrodevs/flash_rails_messages?branch=master)
|
3
3
|
|
4
4
|
This gem provides an easy and simple way to display flash rails messages.
|
5
|
-
This works with [Bootstrap](http://getbootstrap.com/) and [Zurb Foundation
|
5
|
+
This works with [Bootstrap 4+](http://getbootstrap.com/) and [Zurb Foundation 6+](http://foundation.zurb.com/) frameworks.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -20,22 +20,22 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install flash_rails_messages
|
22
22
|
|
23
|
-
### Bootstrap
|
23
|
+
### Bootstrap 4+
|
24
24
|
|
25
25
|
To integrate **FlashRailsMessages** with [Bootstrap](http://getbootstrap.com/) run the next:
|
26
26
|
|
27
|
-
```
|
27
|
+
```
|
28
28
|
rails generate flash_rails_messages:install --bootstrap
|
29
29
|
```
|
30
30
|
|
31
31
|
NOTE: Be sure that you added Bootstrap to your application.
|
32
32
|
|
33
33
|
|
34
|
-
### Zurb Foundation
|
34
|
+
### Zurb Foundation 6+
|
35
35
|
|
36
36
|
To integrate **FlashRailsMessages** with [Zurb Foundation 3](http://foundation.zurb.com/) run the next:
|
37
37
|
|
38
|
-
```
|
38
|
+
```
|
39
39
|
rails generate flash_rails_messages:install --foundation
|
40
40
|
```
|
41
41
|
|
@@ -49,6 +49,18 @@ You just need to add the line below in your layout:
|
|
49
49
|
<%= render_flash_messages %>
|
50
50
|
```
|
51
51
|
|
52
|
+
### Dismissible alerts
|
53
|
+
|
54
|
+
```erb
|
55
|
+
<%= render_flash_messages dismissible: true %>
|
56
|
+
```
|
57
|
+
|
58
|
+
### Passing other options
|
59
|
+
|
60
|
+
```erb
|
61
|
+
<%= render_flash_messages dismissible: true, id: 'my-alert', class: 'custom-class' %>
|
62
|
+
```
|
63
|
+
|
52
64
|
## Development
|
53
65
|
|
54
66
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -32,7 +32,8 @@ module FlashRailsMessages
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def alert_options(type)
|
35
|
-
|
35
|
+
default_alert_options
|
36
|
+
.merge(options.except(:dismissible))
|
36
37
|
.merge(class: alert_classes(type))
|
37
38
|
end
|
38
39
|
|
@@ -45,6 +46,10 @@ module FlashRailsMessages
|
|
45
46
|
].compact.join(' ').strip
|
46
47
|
end
|
47
48
|
|
49
|
+
def default_alert_options
|
50
|
+
{}
|
51
|
+
end
|
52
|
+
|
48
53
|
def default_alert_classes
|
49
54
|
'alert'
|
50
55
|
end
|
@@ -3,11 +3,14 @@ module FlashRailsMessages
|
|
3
3
|
# BOOTSTRAP FRAMEWORK
|
4
4
|
# =========================================
|
5
5
|
|
6
|
-
def alert_element(type, message)
|
7
|
-
content_tag :div,
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
# def alert_element(type, message)
|
7
|
+
# content_tag :div, alert_options(type) do
|
8
|
+
# content = ActiveSupport::SafeBuffer.new
|
9
|
+
# content += close_element if options.fetch(:dismissible, false)
|
10
|
+
# content += message.html_safe
|
11
|
+
# content
|
12
|
+
# end
|
13
|
+
# end
|
11
14
|
|
12
15
|
def close_element
|
13
16
|
content_tag :button, type: 'button', class: 'close', 'data-dismiss': 'alert' do
|
@@ -16,9 +19,9 @@ module FlashRailsMessages
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
|
-
def default_alert_classes
|
20
|
-
'alert'
|
21
|
-
end
|
22
|
+
# def default_alert_classes
|
23
|
+
# 'alert'
|
24
|
+
# end
|
22
25
|
|
23
26
|
def alert_type_classes
|
24
27
|
{
|
@@ -30,7 +33,9 @@ module FlashRailsMessages
|
|
30
33
|
end
|
31
34
|
|
32
35
|
def custom_alert_classes
|
33
|
-
|
36
|
+
if options.fetch(:dismissible, false)
|
37
|
+
'alert-dismissible'
|
38
|
+
end
|
34
39
|
end
|
35
40
|
end
|
36
41
|
end
|
@@ -3,33 +3,41 @@ module FlashRailsMessages
|
|
3
3
|
# ZURB FOUNDATION FRAMEWORK
|
4
4
|
# =========================================
|
5
5
|
|
6
|
-
def alert_element(type, message)
|
7
|
-
content_tag :div,
|
8
|
-
|
6
|
+
# def alert_element(type, message)
|
7
|
+
# content_tag :div, alert_options(type) do
|
8
|
+
# content = ActiveSupport::SafeBuffer.new
|
9
|
+
# content += close_element if options.fetch(:dismissible, false)
|
10
|
+
# content += message.html_safe
|
11
|
+
# content
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
|
15
|
+
def close_element
|
16
|
+
content_tag :button, type: 'button', class: 'close-button', 'data-close': '' do
|
17
|
+
content_tag(:span, '×'.html_safe, 'aria-hidden': 'true')
|
9
18
|
end
|
10
19
|
end
|
11
20
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#end
|
21
|
+
def default_alert_options
|
22
|
+
options.fetch(:dismissible, false) ?
|
23
|
+
{ 'data-closable': '' } : {}
|
24
|
+
end
|
17
25
|
|
18
26
|
def default_alert_classes
|
19
|
-
'
|
27
|
+
'callout'
|
20
28
|
end
|
21
29
|
|
22
30
|
def alert_type_classes
|
23
31
|
{
|
24
32
|
success: 'success',
|
25
|
-
notice: '
|
33
|
+
notice: 'success',
|
26
34
|
alert: 'alert',
|
27
35
|
error: 'alert',
|
28
36
|
}
|
29
37
|
end
|
30
38
|
|
31
|
-
#def custom_alert_classes
|
32
|
-
#Add custom alert classes as a string
|
33
|
-
#end
|
39
|
+
# def custom_alert_classes
|
40
|
+
# Add custom alert classes as a string
|
41
|
+
# end
|
34
42
|
end
|
35
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_rails_messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Gutiérrez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|