sweet-alert-confirm 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Gemfile +2 -6
- data/README.md +12 -0
- data/lib/assets/javascripts/sweet-alert-confirm.js +19 -7
- data/lib/sweet-alert-confirm/version.rb +1 -1
- data/sweet-alert-confirm.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea4f5c077671637ba0c4834240d4a6bbb692939a
|
4
|
+
data.tar.gz: eecc5b36bf90b5eb522339722c4f04c15b2e7505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f276753badf6959713cc8737e45c462411ec8685417339644e16923d0c3096ab57750279e66f8a9243a92d7f06d9995f3059a8b3f2fda0093f03c68c3b6eee2f
|
7
|
+
data.tar.gz: af003c3f71308c49a7f1a4e78033e54bd9dea6be5b79fbb6112ab4d1304e6c0202bb2b3ce6689afae2801bd14e5ca582c09866aa0293137e6c69dc0588213dbd
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -29,13 +29,9 @@ gem "turbolinks"
|
|
29
29
|
|
30
30
|
group :development, :test do
|
31
31
|
gem "jquery-rails"
|
32
|
-
|
33
|
-
gem 'sass-rails', github: 'rails/sass-rails'
|
34
|
-
else
|
35
|
-
gem 'sass-rails'
|
36
|
-
end
|
32
|
+
gem 'sass-rails'
|
37
33
|
gem "sweet-alert"
|
38
34
|
gem "capybara"
|
39
|
-
gem "poltergeist"
|
35
|
+
gem "poltergeist", git: 'https://github.com/teampoltergeist/poltergeist.git'
|
40
36
|
gem "rake"
|
41
37
|
end
|
data/README.md
CHANGED
@@ -69,6 +69,18 @@ You can pass options in `data:`
|
|
69
69
|
|
70
70
|
![Custom confirm](https://cloud.githubusercontent.com/assets/5833678/4653700/14389916-54b0-11e4-9850-14ee970e9345.png)
|
71
71
|
|
72
|
+
Default options that will be used application wide so it is not nessecary to set the option on each link. Put this object inside your app to override default options with `sweetAlertConfirmConfig` object.
|
73
|
+
|
74
|
+
```Javascript
|
75
|
+
var sweetAlertConfirmConfig = {
|
76
|
+
title: 'Are you sure?',
|
77
|
+
type: 'warning',
|
78
|
+
showCancelButton: true,
|
79
|
+
confirmButtonColor: '#DD6B55',
|
80
|
+
confirmButtonText: 'Ok'
|
81
|
+
};
|
82
|
+
```
|
83
|
+
|
72
84
|
## Contribute
|
73
85
|
|
74
86
|
Fork the repo & pull request you fix/feature
|
@@ -1,12 +1,19 @@
|
|
1
|
+
var sweetAlertConfirmConfig = sweetAlertConfirmConfig || {}; // Add default config object
|
2
|
+
|
1
3
|
(function( $ ) {
|
2
4
|
var sweetAlertConfirm = function(event) {
|
5
|
+
|
3
6
|
swalDefaultOptions = {
|
4
|
-
title: 'Are you sure?',
|
5
|
-
type: 'warning',
|
6
|
-
showCancelButton: true,
|
7
|
-
confirmButtonColor: "#DD6B55",
|
8
|
-
|
9
|
-
|
7
|
+
title: sweetAlertConfirmConfig.title || 'Are you sure?',
|
8
|
+
type: sweetAlertConfirmConfig.type || 'warning',
|
9
|
+
showCancelButton: sweetAlertConfirmConfig.showCancelButton || true,
|
10
|
+
//confirmButtonColor: sweetAlertConfirmConfig.confirmButtonColor || null, //"#DD6B55" removed by Noc, do not apply default color as it triggers inline styles on buttons
|
11
|
+
//Null causes javascript errors when hover is fired on confirm buttons
|
12
|
+
confirmButtonText: sweetAlertConfirmConfig.confirmButtonText || "Ok",
|
13
|
+
cancelButtonText: sweetAlertConfirmConfig.cancelButtonText || "Cancel"
|
14
|
+
}
|
15
|
+
if (sweetAlertConfirmConfig.confirmButtonColor !== null) {
|
16
|
+
swalDefaultOptions.confirmButtonColor = sweetAlertConfirmConfig.confirmButtonColor
|
10
17
|
}
|
11
18
|
|
12
19
|
$linkToVerify = $(this)
|
@@ -24,7 +31,8 @@
|
|
24
31
|
'imageUrl',
|
25
32
|
'allowOutsideClick',
|
26
33
|
'remote',
|
27
|
-
'method'
|
34
|
+
'method',
|
35
|
+
'function'
|
28
36
|
]
|
29
37
|
|
30
38
|
$.each($linkToVerify.data(), function(key, val){
|
@@ -37,9 +45,13 @@
|
|
37
45
|
}
|
38
46
|
})
|
39
47
|
|
48
|
+
var nameFunction = swalOptions['function'];
|
40
49
|
message = $linkToVerify.attr('data-sweet-alert-confirm')
|
41
50
|
swalOptions['title'] = message
|
42
51
|
swal(swalOptions, function(r){
|
52
|
+
if (nameFunction) {
|
53
|
+
window[nameFunction]();
|
54
|
+
}
|
43
55
|
if (swalOptions['remote'] === true) {
|
44
56
|
if (r === false) {
|
45
57
|
return false;
|
data/sweet-alert-confirm.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency "rails", ">=3.1"
|
21
21
|
s.add_development_dependency "rspec-rails"
|
22
22
|
s.add_development_dependency "capybara", "~> 2.1"
|
23
|
-
s.add_development_dependency "poltergeist"
|
24
23
|
s.add_development_dependency "pry"
|
25
24
|
s.files = `git ls-files`.split("\n")
|
26
25
|
s.require_paths = ['lib']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweet-alert-confirm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moises Viloria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: poltergeist
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: pry
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|