twitter-bootstrap-rails-confirm 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8bd30ec1e2653ab77da911c4a74a28f41e55b6
|
4
|
+
data.tar.gz: 989b0d3308c31bc53e408928de07489fd23697f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b753fc8675862f2a51f4d31986b23533ac1d2a188bc1713c0ebf08a523a672ff1ca496e51c654132dc49d88a7a3c65983509c41c42bdd764406a947819207813
|
7
|
+
data.tar.gz: c87aa22cc7b9f16c2a5a8927872f6d2f697ffa59beac9eeaafb4da122318c114954eb9faf4a6626661be29969a34d98f20c7b4f97e5c29cadf357c9416e439dc
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Twitter::Bootstrap::Rails::Confirm
|
2
2
|
|
3
|
-
This gem adds some javascript to change the default behaviour of data-confirm processing.
|
3
|
+
This gem adds some javascript to change the default behaviour of data-confirm processing for both Boostrap 2 and Bootstrap 3.
|
4
4
|
|
5
5
|
The normal confirm dialog shows a text with buttons 'ok' and 'cancel'. More information is needed here for a user to make the right decision. This gem therefore also adds:
|
6
6
|
|
@@ -34,10 +34,6 @@ Add this line to your application's Gemfile:
|
|
34
34
|
|
35
35
|
gem 'twitter-bootstrap-rails-confirm'
|
36
36
|
|
37
|
-
Or for Bootstrap 3 support:
|
38
|
-
|
39
|
-
gem 'twitter-bootstrap-rails-confirm', github: 'bluerail/twitter-bootstrap-rails-confirm', branch: 'bootstrap3'
|
40
|
-
|
41
37
|
And then execute:
|
42
38
|
|
43
39
|
$ bundle
|
@@ -73,6 +69,10 @@ Next... nothing. There is nothing you need to do to get this working. A helper c
|
|
73
69
|
|
74
70
|
## Changelog
|
75
71
|
|
72
|
+
### 1.0.4 (November 25, 2014)
|
73
|
+
|
74
|
+
* [(rvanlieshout)](https://github.com/rvanlieshout) Added bootstrap 3 support
|
75
|
+
|
76
76
|
### 1.0.3 (September 4, 2014)
|
77
77
|
|
78
78
|
* [(rvanlieshout)](https://github.com/rvanlieshout) [Problems with using event constructors](https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/18)
|
@@ -8,22 +8,40 @@ $.fn.twitter_bootstrap_confirmbox =
|
|
8
8
|
fade: false
|
9
9
|
|
10
10
|
TwitterBootstrapConfirmBox = (message, element, callback) ->
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
bootstrap_version = if (typeof $().emulateTransitionEnd == 'function') then 3 else 2
|
12
|
+
|
13
|
+
if bootstrap_version == 2
|
14
|
+
$dialog = $('
|
15
|
+
<div class="modal hide" id="confirmation_dialog">
|
16
|
+
<div class="modal-header">
|
17
|
+
<button type="button" class="close" data-dismiss="modal">×</button>
|
18
|
+
<h3 class="modal-title">...</h3>
|
19
|
+
</div>
|
20
|
+
<div class="modal-body"></div>
|
21
|
+
<div class="modal-footer"></div>
|
22
|
+
</div>
|
23
|
+
')
|
24
|
+
else
|
25
|
+
$dialog = $('
|
26
|
+
<div class="modal" id="confirmation_dialog" role="dialog">
|
27
|
+
<div class="modal-dialog">
|
28
|
+
<div class="modal-content">
|
29
|
+
<div class="modal-header">
|
30
|
+
<button type="button" class="close" data-dismiss="modal">×</button>
|
31
|
+
<h4 class="modal-title">...</h4>
|
32
|
+
</div>
|
33
|
+
<div class="modal-body"></div>
|
34
|
+
<div class="modal-footer"></div>
|
35
|
+
</div>
|
36
|
+
</div>
|
16
37
|
</div>
|
17
|
-
|
18
|
-
<div class="modal-footer"></div>
|
19
|
-
</div>
|
20
|
-
')
|
38
|
+
')
|
21
39
|
|
22
40
|
$dialog.addClass("fade") if element.data("confirm-fade") || $.fn.twitter_bootstrap_confirmbox.defaults.fade
|
23
41
|
|
24
42
|
$dialog
|
25
43
|
.find(".modal-header")
|
26
|
-
.find("
|
44
|
+
.find(".modal-title")
|
27
45
|
.html(element.data("confirm-title") || $.fn.twitter_bootstrap_confirmbox.defaults.title || window.top.location.origin)
|
28
46
|
.end()
|
29
47
|
.end()
|
@@ -37,7 +55,7 @@ TwitterBootstrapConfirmBox = (message, element, callback) ->
|
|
37
55
|
$("<a />", {href: "#", "data-dismiss": "modal"})
|
38
56
|
.html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel)
|
39
57
|
.addClass($.fn.twitter_bootstrap_confirmbox.defaults.cancel_class)
|
40
|
-
.addClass(element.data("confirm-cancel-class"))
|
58
|
+
.addClass(element.data("confirm-cancel-class") || "btn-default")
|
41
59
|
.click((event) ->
|
42
60
|
event.preventDefault()
|
43
61
|
$dialog.modal("hide")
|
@@ -61,62 +79,63 @@ TwitterBootstrapConfirmBox = (message, element, callback) ->
|
|
61
79
|
|
62
80
|
.appendTo(document.body)
|
63
81
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
82
|
+
if (typeof $().modal == 'function') # test if bootstrap is loaded
|
83
|
+
$.rails.allowAction = (element) ->
|
84
|
+
message = element.data("confirm")
|
85
|
+
answer = false
|
86
|
+
return true unless message
|
68
87
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
88
|
+
if $.rails.fire(element, "confirm")
|
89
|
+
TwitterBootstrapConfirmBox message, element, ->
|
90
|
+
if $.rails.fire(element, "confirm:complete", [answer])
|
91
|
+
allowAction = $.rails.allowAction
|
73
92
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
if element.get(0).click
|
78
|
-
element.get(0).click()
|
93
|
+
$.rails.allowAction = ->
|
94
|
+
true
|
79
95
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
if element.get(0).click
|
97
|
+
element.get(0).click()
|
98
|
+
|
99
|
+
else if Event?
|
100
|
+
evt = new Event("click", {
|
101
|
+
bubbles: true,
|
102
|
+
cancelable: true,
|
103
|
+
view: window,
|
104
|
+
detail: 0,
|
105
|
+
screenX: 0,
|
106
|
+
screenY: 0,
|
107
|
+
clientX: 0,
|
108
|
+
clientY: 0,
|
109
|
+
ctrlKey: false,
|
110
|
+
altKey: false,
|
111
|
+
shiftKey: false,
|
112
|
+
metaKey: false,
|
113
|
+
button: 0,
|
114
|
+
relatedTarget: document.body.parentNode
|
115
|
+
})
|
116
|
+
element.get(0).dispatchEvent(evt)
|
98
117
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
118
|
+
else if $.isFunction(document.createEvent)
|
119
|
+
evt = document.createEvent "MouseEvents"
|
120
|
+
evt.initMouseEvent(
|
121
|
+
"click",
|
122
|
+
true, # e.bubbles,
|
123
|
+
true, # e.cancelable,
|
124
|
+
window, # e.view,
|
125
|
+
0, # e.detail,
|
126
|
+
0, # e.screenX,
|
127
|
+
0, # e.screenY,
|
128
|
+
0, # e.clientX,
|
129
|
+
0, # e.clientY,
|
130
|
+
false, # e.ctrlKey,
|
131
|
+
false, # e.altKey,
|
132
|
+
false, # e.shiftKey,
|
133
|
+
false, # e.metaKey,
|
134
|
+
0, # e.button,
|
135
|
+
document.body.parentNode # e.relatedTarget
|
136
|
+
)
|
137
|
+
element.get(0).dispatchEvent(evt)
|
119
138
|
|
120
|
-
|
121
|
-
|
122
|
-
|
139
|
+
$.rails.allowAction = allowAction
|
140
|
+
|
141
|
+
false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootstrap-rails-confirm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rene van Lieshout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Confirm dialogs using Twitter Bootstrap
|
14
14
|
email:
|