faw_toast 1.2.0 → 1.2.2
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 +4 -4
- data/README.md +13 -6
- data/app/assets/stylesheets/faw_toast.css +4 -4
- data/app/assets/stylesheets/faw_toast.scss +4 -4
- data/lib/faw_toast/configuration.rb +6 -5
- data/lib/faw_toast/engine.rb +1 -1
- data/lib/faw_toast/version.rb +1 -1
- data/lib/generators/faw_toast/install/install_generator.rb +12 -10
- data/lib/generators/faw_toast/install/templates/faw_toast.rb +5 -5
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97af3db39ecce4321a32c7d9665e315efdf96ba083675608ec3094d97eb202d2
|
4
|
+
data.tar.gz: 6cbe421d337750c6ab154725650b236ac2ac15ec5b118dc1201f1b9b67c1ecb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e509fb2b7809f80aed827af9fe82c8555c0fc63d8513d54723d805ac0ab6fe2c4c8f2f5ba3900eb5a31f35f65be99008a78ecbf54c7fa0e8153f5ebc8652ac8e
|
7
|
+
data.tar.gz: '007483292ba291241a3825cf79e6e8c5a3d9be9c93ac3cef567d970b3030d2f30d0d58911da5a4cea172d05fc220144a7dea4eaa2dbf7ae3043e42f5427f7a91'
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ A simple, configurable toast notification system for Rails applications. FawToas
|
|
9
9
|
- CSS-only animations
|
10
10
|
- Configurable toast duration and position
|
11
11
|
- Customizable CSS classes for different flash types
|
12
|
-
- Support for standard flash types plus additional success and
|
12
|
+
- Support for standard flash types plus additional success, info and danger types
|
13
13
|
- Simple to install and use
|
14
14
|
|
15
15
|
## Installation
|
@@ -66,6 +66,11 @@ def create
|
|
66
66
|
flash[:success] = "Item was successfully created!"
|
67
67
|
redirect_to items_path
|
68
68
|
end
|
69
|
+
|
70
|
+
# using Turbo Streams
|
71
|
+
flash.now[flash_type] = message
|
72
|
+
render turbo_stream: turbo_stream.append("faw-toast-container", partial: "faw_toast/toast"), status: status
|
73
|
+
|
69
74
|
```
|
70
75
|
|
71
76
|
```ruby
|
@@ -83,6 +88,7 @@ Turbo::StreamsChannel.broadcast_append_to(
|
|
83
88
|
FawToast supports the following flash types out of the box:
|
84
89
|
- `:success` - Green border
|
85
90
|
- `:alert` - Red border
|
91
|
+
- `:danger` - Red border (same as alert, but provides semantic difference)
|
86
92
|
- `:info` - Sky blue border
|
87
93
|
- `:notice` - Sky blue border
|
88
94
|
- Any other type will use the default indigo border
|
@@ -102,11 +108,12 @@ FawToast.configure do |config|
|
|
102
108
|
|
103
109
|
# CSS classes for different flash types
|
104
110
|
config.css_classes = {
|
105
|
-
success: 'border-l-10 border-green
|
106
|
-
alert: 'border-l-10 border-red
|
107
|
-
|
108
|
-
|
109
|
-
|
111
|
+
success: 'faw-toast-border-l-10 faw-toast-border-green',
|
112
|
+
alert: 'faw-toast-border-l-10 faw-toast-border-red',
|
113
|
+
danger: 'faw-toast-border-l-10 faw-toast-border-red',
|
114
|
+
info: 'faw-toast-border-l-10 faw-toast-border-sky',
|
115
|
+
notice: 'faw-toast-border-l-10 faw-toast-border-sky',
|
116
|
+
default: 'faw-toast-border-l-10 faw-toast-border-indigo'
|
110
117
|
}
|
111
118
|
end
|
112
119
|
```
|
@@ -41,13 +41,13 @@
|
|
41
41
|
.faw-toast.faw-toast-border-l-10 {
|
42
42
|
border-left-width: 10px;
|
43
43
|
border-left-style: solid; }
|
44
|
-
.faw-toast.faw-toast-border-green
|
44
|
+
.faw-toast.faw-toast-border-green {
|
45
45
|
border-left-color: #10b981; }
|
46
|
-
.faw-toast.faw-toast-border-red
|
46
|
+
.faw-toast.faw-toast-border-red {
|
47
47
|
border-left-color: #ef4444; }
|
48
|
-
.faw-toast.faw-toast-border-sky
|
48
|
+
.faw-toast.faw-toast-border-sky {
|
49
49
|
border-left-color: #0284c7; }
|
50
|
-
.faw-toast.faw-toast-border-indigo
|
50
|
+
.faw-toast.faw-toast-border-indigo {
|
51
51
|
border-left-color: #6366f1; }
|
52
52
|
.faw-toast .faw-toast-content {
|
53
53
|
flex: 1; }
|
@@ -57,19 +57,19 @@
|
|
57
57
|
border-left-style: solid;
|
58
58
|
}
|
59
59
|
|
60
|
-
&.faw-toast-border-green
|
60
|
+
&.faw-toast-border-green {
|
61
61
|
border-left-color: #10b981;
|
62
62
|
}
|
63
63
|
|
64
|
-
&.faw-toast-border-red
|
64
|
+
&.faw-toast-border-red {
|
65
65
|
border-left-color: #ef4444;
|
66
66
|
}
|
67
67
|
|
68
|
-
&.faw-toast-border-sky
|
68
|
+
&.faw-toast-border-sky {
|
69
69
|
border-left-color: #0284c7;
|
70
70
|
}
|
71
71
|
|
72
|
-
&.faw-toast-border-indigo
|
72
|
+
&.faw-toast-border-indigo {
|
73
73
|
border-left-color: #6366f1;
|
74
74
|
}
|
75
75
|
|
@@ -8,11 +8,12 @@ module FawToast
|
|
8
8
|
@duration_seconds = "7s"
|
9
9
|
@position = 'top-right'
|
10
10
|
@css_classes = {
|
11
|
-
success: 'faw-toast-border-l-10 faw-toast-border-green
|
12
|
-
alert: 'faw-toast-border-l-10 faw-toast-border-red
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
success: 'faw-toast-border-l-10 faw-toast-border-green',
|
12
|
+
alert: 'faw-toast-border-l-10 faw-toast-border-red',
|
13
|
+
danger: 'faw-toast-border-l-10 faw-toast-border-red',
|
14
|
+
info: 'faw-toast-border-l-10 faw-toast-border-sky',
|
15
|
+
notice: 'faw-toast-border-l-10 faw-toast-border-sky',
|
16
|
+
default: 'faw-toast-border-l-10 faw-toast-border-indigo'
|
16
17
|
}
|
17
18
|
end
|
18
19
|
end
|
data/lib/faw_toast/engine.rb
CHANGED
data/lib/faw_toast/version.rb
CHANGED
@@ -20,6 +20,18 @@ module FawToast
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def add_stylesheet_tag
|
24
|
+
inject_into_file "app/views/layouts/application.html.erb", after: "<%= stylesheet_link_tag \"application\", \"data-turbo-track\": \"reload\" %>" do
|
25
|
+
"\n <%= stylesheet_link_tag \"faw_toast\", \"data-turbo-track\": \"reload\" %>"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_javascript_tag
|
30
|
+
inject_into_file "app/views/layouts/application.html.erb", before: "</head>" do
|
31
|
+
" <%= javascript_include_tag \"faw_toast\", \"data-turbo-track\": \"reload\" %>\n"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
23
35
|
def add_toast_container_to_layout
|
24
36
|
inject_into_file "app/views/layouts/application.html.erb", before: "</body>" do
|
25
37
|
<<-HTML
|
@@ -27,16 +39,6 @@ module FawToast
|
|
27
39
|
HTML
|
28
40
|
end
|
29
41
|
end
|
30
|
-
|
31
|
-
def add_stylesheet_import
|
32
|
-
if File.exist?("app/assets/stylesheets/application.scss")
|
33
|
-
append_to_file "app/assets/stylesheets/application.scss" do
|
34
|
-
"\n@import \"faw_toast\";\n"
|
35
|
-
end
|
36
|
-
else
|
37
|
-
say "Please manually import the FawToast stylesheet in your application", :red
|
38
|
-
end
|
39
|
-
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -10,10 +10,10 @@ FawToast.configure do |config|
|
|
10
10
|
|
11
11
|
# CSS classes for different flash types
|
12
12
|
# config.css_classes = {
|
13
|
-
# success: 'faw-toast-border-l-10 faw-toast-border-green
|
14
|
-
# alert: 'faw-toast-border-l-10 faw-toast-border-red
|
15
|
-
# info: 'faw-toast-border-l-10 faw-toast-border-sky
|
16
|
-
# notice: 'faw-toast-border-l-10 faw-toast-border-sky
|
17
|
-
# default: 'faw-toast-border-l-10 faw-toast-border-indigo
|
13
|
+
# success: 'faw-toast-border-l-10 faw-toast-border-green',
|
14
|
+
# alert: 'faw-toast-border-l-10 faw-toast-border-red',
|
15
|
+
# info: 'faw-toast-border-l-10 faw-toast-border-sky',
|
16
|
+
# notice: 'faw-toast-border-l-10 faw-toast-border-sky',
|
17
|
+
# default: 'faw-toast-border-l-10 faw-toast-border-indigo'
|
18
18
|
# }
|
19
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faw_toast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexwebgr
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '9.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: sassc
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.4'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.4'
|
33
47
|
description: FawToast provides an easy way to display flash messages as toast notifications
|
34
48
|
in Rails applications
|
35
49
|
email:
|