flash_notifier 1.1.2 → 1.2.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 +4 -4
- data/README.md +2 -6
- data/lib/flash_notifier/flash_helper.rb +1 -1
- data/lib/flash_notifier/version.rb +1 -1
- data/vendor/assets/javascripts/common.coffee +2 -3
- data/vendor/assets/javascripts/noty_flash.coffee +1 -9
- data/vendor/assets/javascripts/toastr_flash.coffee +3 -4
- 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: a3256228195c8f57bfca429d0abb7a1eee5fae34930f28b0e252909b1a1c1be7
|
4
|
+
data.tar.gz: ab80d59b266672f2971426e57a62cc825bada57e1dd5b0de95e2b1871c3c4432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2251e75db6ee7ec1aabbcefc71347a23a60c22b1f9277d4df9656fe041347367a4a70cad0ef6d8cbe417e0ac50969fe89307ce1f5152e63a1672b32986e7a1c5
|
7
|
+
data.tar.gz: 9ffe5429f0a4dd0f1e4cd860119d2130ffba857b64c5a4e4370a979b640186dffffda1afa80e6f60bfd9eea469cba6c1a68d3717b891fb48a3d3893534207e67
|
data/README.md
CHANGED
@@ -67,14 +67,10 @@ In your layout add this helper method
|
|
67
67
|
<%= build_flash %>
|
68
68
|
|
69
69
|
### Optional Step 3: Pass options to helper method
|
70
|
-
|
71
|
-
For Onscreen positioning of flash message pass param
|
72
|
-
|
73
|
-
<%= build_flash placement: 'topRight' %>
|
74
70
|
|
75
71
|
To manage progress bar pass param
|
76
72
|
|
77
|
-
<%= build_flash
|
73
|
+
<%= build_flash progressBar: true %>
|
78
74
|
|
79
75
|
To set auto hide timeout pass param
|
80
76
|
|
@@ -84,7 +80,7 @@ To set default theme pass param (Note this param works only for Noty JS)
|
|
84
80
|
|
85
81
|
<%= build_flash theme: 'mint' %>
|
86
82
|
|
87
|
-
##### Values for these params can be found here [Noty JS](https://ned.im/noty/#/options), [Toastr JS](https://codeseven.github.io/toastr/demo.html)
|
83
|
+
##### Values for these params and additional config options can be found here [Noty JS](https://ned.im/noty/#/options), [Toastr JS](https://codeseven.github.io/toastr/demo.html)
|
88
84
|
|
89
85
|
## Contributing
|
90
86
|
|
@@ -4,7 +4,7 @@ module FlashHelper
|
|
4
4
|
html = append_options_to_dom options
|
5
5
|
flash.each do |type, message|
|
6
6
|
flash_type = (%w(notice success).include?(type)) ? 'success' : (( %w(alert error).include?(type)) ? 'error' : (%w(warning info).include?(type) ? type : 'info' ))
|
7
|
-
html += content_tag(:div, '' , data: { flash_notifier: '
|
7
|
+
html += content_tag(:div, '' , data: { flash_notifier: '', flash_type: flash_type, flash_msg: escape_javascript(message) })
|
8
8
|
end
|
9
9
|
html.html_safe
|
10
10
|
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
window.
|
1
|
+
window.fetchFlashOptions = ->
|
2
2
|
options = $('[data-flash-notifier-options]').data('flash-notifier-options')
|
3
|
-
|
4
|
-
if option == undefined then defaultValue else option
|
3
|
+
if Object.keys(options).length > 0 then options else {}
|
5
4
|
|
6
5
|
window.initializeFlashNotifier = (method) ->
|
7
6
|
try
|
@@ -1,17 +1,9 @@
|
|
1
1
|
buildNotyFlash = () ->
|
2
|
-
Noty.overrideDefaults(
|
3
|
-
layout: fetchFlashOption('placement','topRight')
|
4
|
-
theme: fetchFlashOption('theme','mint')
|
5
|
-
timeout: fetchFlashOption('timeout','3500')
|
6
|
-
progressBar: fetchFlashOption('progress_bar',false)
|
7
|
-
})
|
2
|
+
Noty.overrideDefaults(fetchFlashOptions())
|
8
3
|
$.each $('[data-flash-notifier]') , (index , val) ->
|
9
4
|
new Noty({
|
10
5
|
text: $(val).data('flash-msg')
|
11
6
|
type: $(val).data('flash-type')
|
12
|
-
theme: 'mint'
|
13
|
-
timeout: 4000
|
14
|
-
progressBar: false
|
15
7
|
}).show()
|
16
8
|
|
17
9
|
initializeFlashNotifier(buildNotyFlash)
|
@@ -1,10 +1,9 @@
|
|
1
1
|
buildFlash = () ->
|
2
|
-
toastr.options =
|
3
|
-
positionClass: fetchFlashOption('placement', 'toast-bottom-right')
|
4
|
-
timeOut: fetchFlashOption('timeout','3500')
|
5
|
-
progressBar: fetchFlashOption('progress_bar',false)
|
2
|
+
toastr.options = fetchFlashOptions()
|
6
3
|
|
7
4
|
$.each $('[data-flash-notifier]'), (index, val) ->
|
8
5
|
eval("toastr.#{$(val).data('flash-type')}('#{$(val).data('flash-msg')}')")
|
9
6
|
|
7
|
+
buildOptions = () ->
|
8
|
+
|
10
9
|
initializeFlashNotifier(buildFlash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fakhir Shad
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|