sweetify 1.0.0 → 2.0.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 +5 -5
- data/LICENSE +1 -1
- data/README.md +7 -1
- data/app/views/sweetify/_alert.html.erb +2 -2
- data/lib/sweetify.rb +1 -0
- data/lib/sweetify/render.rb +13 -0
- data/lib/sweetify/sweetalert.rb +12 -0
- data/lib/sweetify/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0298cc60600a076a2221e6c3248ac475c19839d738c0c119dc0a17b154b03a8b'
|
4
|
+
data.tar.gz: d4d3ac540f66ad2969cb612be9848a41b144c3f5dad34e9ef74a40c9d33c2824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99fd6a2c17ec8bfbf0287eb7dd9908f66f16e192daff218fbaadfbfbb35348b18f4ddce7fef7db7730a6e76a1d21388dad67688a37d6d0070febfdee5cc6343c
|
7
|
+
data.tar.gz: ab56bf8c72cd0fd408579edb8962a6519afd00fec93bd72a995bde8e03c1dbeb299447984c8e282cb85d723965562d389a798d278dc23bbc5711aa43db25edf6
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/sweetify)
|
4
4
|
|
5
|
-
This gem allows you to use [SweetAlert](http://t4t5.github.io/sweetalert/) for your flash messages.
|
5
|
+
This gem allows you to use [SweetAlert](http://t4t5.github.io/sweetalert/) or [SweetAlert2](https://github.com/limonte/sweetalert2) for your flash messages.
|
6
6
|
_See the examples below, to see how to use it_
|
7
7
|
|
8
8
|
## Installation
|
@@ -19,6 +19,12 @@ And then execute:
|
|
19
19
|
$ bundle
|
20
20
|
```
|
21
21
|
|
22
|
+
Next up, create the file `sweetify.rb` in your initializers to specify the library you are using (SweetAlert or SweetAlert2):
|
23
|
+
```ruby
|
24
|
+
# possible options: 'sweetalert', 'sweetalert2' - default is 'sweetalert2'
|
25
|
+
Sweetify.sweetalert_library = 'sweetalert2'
|
26
|
+
```
|
27
|
+
|
22
28
|
Next add the following line to the bottom of your application's layout file:
|
23
29
|
```html
|
24
30
|
...
|
data/lib/sweetify.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Sweetify
|
2
|
+
class << self
|
3
|
+
attr_writer :sweetalert_library
|
4
|
+
|
5
|
+
def sweetalert_library
|
6
|
+
@sweetalert_library || 'sweetalert2'
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(json)
|
10
|
+
(sweetalert_library == 'sweetalert2' ? "Swal.fire(#{json})" : "swal(#{json})").html_safe
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/sweetify/sweetalert.rb
CHANGED
@@ -33,6 +33,18 @@ module Sweetify
|
|
33
33
|
opts.delete(:persistent)
|
34
34
|
end
|
35
35
|
|
36
|
+
# sweetalert changes
|
37
|
+
if Sweetify.sweetalert_library == 'sweetalert'
|
38
|
+
opts[:icon] = opts.delete(:type)
|
39
|
+
opts[:closeOnClickOutside] = opts.delete(:allowOutsideClick)
|
40
|
+
|
41
|
+
if opts.delete(:showConfirmButton)
|
42
|
+
opts[:button] = opts[:confirmButtonText]
|
43
|
+
else
|
44
|
+
opts[:button] = false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
36
48
|
flash_config(opts)
|
37
49
|
end
|
38
50
|
|
data/lib/sweetify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweetify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: '0'
|
27
27
|
description: Sweetify allows you to easily use SweetAlert within your controllers
|
28
28
|
email:
|
29
|
-
-
|
29
|
+
- hello@atrox.dev
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- app/views/sweetify/_alert.html.erb
|
38
38
|
- lib/sweetify.rb
|
39
39
|
- lib/sweetify/engine.rb
|
40
|
+
- lib/sweetify/render.rb
|
40
41
|
- lib/sweetify/sweetalert.rb
|
41
42
|
- lib/sweetify/version.rb
|
42
43
|
homepage: https://github.com/atrox/sweetify
|
@@ -58,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
59
|
- !ruby/object:Gem::Version
|
59
60
|
version: '0'
|
60
61
|
requirements: []
|
61
|
-
|
62
|
-
rubygems_version: 2.5.2
|
62
|
+
rubygems_version: 3.0.3
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: SweetAlert integrated in Ruby on Rails
|