twitter-bootstrap-rails-confirm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -7,8 +7,9 @@ The normal confirm dialog shows a text with buttons 'ok' and 'cancel'. More info
|
|
7
7
|
* data-confirm-fade (default: false)
|
8
8
|
* data-confirm-title (default: window.top.location.origin)
|
9
9
|
* data-confirm-cancel (default: 'cancel')
|
10
|
+
* data-confirm-cancel-class (default: 'btn cancel')
|
10
11
|
* data-confirm-proceed (default: 'ok')
|
11
|
-
* data-confirm-proceed-class (default: '
|
12
|
+
* data-confirm-proceed-class (default: 'btn-primary')
|
12
13
|
|
13
14
|
This behaviour is similar to that of a "regular" confirm box in ways that it uses the same title and button labels. Defaults can be changed in two ways:
|
14
15
|
|
@@ -18,6 +19,7 @@ Changing all default values:
|
|
18
19
|
fade: false,
|
19
20
|
title: null, // if title equals null window.top.location.origin is used
|
20
21
|
cancel: "Cancel",
|
22
|
+
cancel_class: "btn cancel",
|
21
23
|
proceed: "OK",
|
22
24
|
proceed_class: "btn proceed btn-primary"
|
23
25
|
};
|
@@ -26,20 +28,19 @@ Only changing one default value:
|
|
26
28
|
|
27
29
|
$.fn.twitter_bootstrap_confirmbox.defaults.proceed_class = "btn proceed btn-success";
|
28
30
|
|
29
|
-
|
30
31
|
## Installation
|
31
32
|
|
32
33
|
Add this line to your application's Gemfile:
|
33
34
|
|
34
35
|
gem 'twitter-bootstrap-rails-confirm'
|
35
36
|
|
36
|
-
|
37
|
+
Or for Bootstrap 3 support:
|
37
38
|
|
38
|
-
|
39
|
+
gem 'twitter-bootstrap-rails-confirm', github: 'bluerail/twitter-bootstrap-rails-confirm', branch: 'bootstrap3'
|
39
40
|
|
40
|
-
|
41
|
+
And then execute:
|
41
42
|
|
42
|
-
$
|
43
|
+
$ bundle
|
43
44
|
|
44
45
|
## Usage
|
45
46
|
|
@@ -57,6 +58,7 @@ Next... nothing. There is nothing you need to do to get this working. A helper c
|
|
57
58
|
"data-confirm-fade" => true,
|
58
59
|
"data-confirm-title" => t('.destroy_confirm.title', :item => options[:item]),
|
59
60
|
"data-confirm-cancel" => t('.destroy_confirm.cancel', :item => options[:item]),
|
61
|
+
"data-confirm-cancel-class" => "btn-cancel"),
|
60
62
|
"data-confirm-proceed" => t('.destroy_confirm.proceed', :item => options[:item]),
|
61
63
|
"data-confirm-proceed-class" => "btn-danger"
|
62
64
|
end
|
@@ -71,13 +73,24 @@ Next... nothing. There is nothing you need to do to get this working. A helper c
|
|
71
73
|
|
72
74
|
## Changelog
|
73
75
|
|
76
|
+
### In active development
|
77
|
+
|
78
|
+
* Javascript testing using Jasmine
|
79
|
+
|
80
|
+
### 1.0.2 (Oktober 11, 2013)
|
81
|
+
|
82
|
+
* [(kramerc)](https://github.com/kramerc) [Prevent the default action on the modal's buttons.](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/9)
|
83
|
+
* [(taavo)](https://github.com/taavo) [click handler returns false](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/6)
|
84
|
+
* [(stevelacey)](https://github.com/stevelacey) [Swap out new lines for br's in message](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/16)
|
85
|
+
* [(DavyCardinaal)](https://github.com/DavyCardinaal) [Confirmbox defaults: Cancel button btn-default](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/15) (Bootstrap 3 only)
|
86
|
+
* [(digitalfrost)](https://github.com/digitalfrost) [Create "click" event using an event constructor](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/14)
|
87
|
+
|
74
88
|
### 1.0.1 (April 23, 2013)
|
75
89
|
|
76
|
-
* (kramerc) Add an option for including the fade class.
|
77
|
-
* (taavo)
|
78
|
-
* (taavo) don't wait for dom to load
|
90
|
+
* [(kramerc)](https://github.com/kramerc) [Add an option for including the fade class](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/8)
|
91
|
+
* [(taavo)](https://github.com/taavo) [Load asap](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/5)
|
79
92
|
|
80
93
|
### 1.0.0 (February 22, 2013)
|
81
94
|
|
82
95
|
* First 'official' release
|
83
|
-
* Many thanks to taavo for his contributions
|
96
|
+
* Many thanks to [taavo](https://github.com/taavo) for his contributions
|
@@ -3,6 +3,7 @@ $.fn.twitter_bootstrap_confirmbox =
|
|
3
3
|
fade: false
|
4
4
|
title: null
|
5
5
|
cancel: "Cancel"
|
6
|
+
cancel_class: "btn cancel"
|
6
7
|
proceed: "OK"
|
7
8
|
proceed_class: "btn proceed btn-primary"
|
8
9
|
|
@@ -18,20 +19,22 @@ TwitterBootstrapConfirmBox = (message, element, callback) ->
|
|
18
19
|
)
|
19
20
|
|
20
21
|
$("#confirmation_dialog").addClass("fade") if element.data("confirm-fade") || $.fn.twitter_bootstrap_confirmbox.defaults.fade
|
21
|
-
$("#confirmation_dialog .modal-body").html(message)
|
22
|
+
$("#confirmation_dialog .modal-body").html(message.replace(/\n/g, "<br />"))
|
22
23
|
$("#confirmation_dialog .modal-header h3").html(element.data("confirm-title") || $.fn.twitter_bootstrap_confirmbox.defaults.title || window.top.location.origin)
|
23
|
-
$("#confirmation_dialog .modal-footer .cancel").html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel)
|
24
|
+
$("#confirmation_dialog .modal-footer .cancel").html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel).attr("class", $.fn.twitter_bootstrap_confirmbox.defaults.cancel_class).addClass(element.data("confirm-cancel-class"))
|
24
25
|
$("#confirmation_dialog .modal-footer .proceed").html(element.data("confirm-proceed") || $.fn.twitter_bootstrap_confirmbox.defaults.proceed).attr("class", $.fn.twitter_bootstrap_confirmbox.defaults.proceed_class).addClass(element.data("confirm-proceed-class"))
|
25
26
|
$("#confirmation_dialog").modal("show").on("hidden", ->
|
26
27
|
$(this).remove()
|
27
28
|
)
|
28
29
|
|
29
|
-
$("#confirmation_dialog .proceed").click ->
|
30
|
+
$("#confirmation_dialog .proceed").click (event) ->
|
31
|
+
event.preventDefault()
|
30
32
|
$("#confirmation_dialog").modal("hide")
|
31
33
|
callback()
|
32
|
-
|
34
|
+
false
|
33
35
|
|
34
|
-
$("#confirmation_dialog .cancel").click ->
|
36
|
+
$("#confirmation_dialog .cancel").click (event) ->
|
37
|
+
event.preventDefault()
|
35
38
|
$("#confirmation_dialog").modal("hide")
|
36
39
|
false
|
37
40
|
|
@@ -50,29 +53,25 @@ $.rails.allowAction = (element) ->
|
|
50
53
|
|
51
54
|
if element.get(0).click
|
52
55
|
element.get(0).click()
|
53
|
-
else if $.isFunction(document.createEvent)
|
54
|
-
evt = document.createEvent "MouseEvents"
|
55
|
-
evt.initMouseEvent(
|
56
|
-
"click",
|
57
|
-
true, # e.bubbles,
|
58
|
-
true, #e.cancelable,
|
59
|
-
window, #e.view,
|
60
|
-
0, #e.detail,
|
61
|
-
0, #e.screenX,
|
62
|
-
0, #e.screenY,
|
63
|
-
0, #e.clientX,
|
64
|
-
0, #e.clientY,
|
65
|
-
false, #e.ctrlKey,
|
66
|
-
false, #e.altKey,
|
67
|
-
false, #e.shiftKey,
|
68
|
-
false, #e.metaKey,
|
69
|
-
0, #e.button,
|
70
|
-
document.body.parentNode #e.relatedTarget
|
71
|
-
)
|
72
|
-
element.get(0).dispatchEvent(evt)
|
73
56
|
else
|
74
|
-
|
57
|
+
evt = new MouseEvents("click", {
|
58
|
+
bubbles : true,
|
59
|
+
cancelable : true,
|
60
|
+
view : window,
|
61
|
+
detail : 0,
|
62
|
+
screenX : 0,
|
63
|
+
screenY : 0,
|
64
|
+
clientX : 0,
|
65
|
+
clientY : 0,
|
66
|
+
ctrlKey : false,
|
67
|
+
altKey : false,
|
68
|
+
shiftKey : false,
|
69
|
+
metaKey : false,
|
70
|
+
button : 0,
|
71
|
+
relatedTarget : document.body.parentNode
|
72
|
+
})
|
73
|
+
element.get(0).dispatchEvent(evt)
|
75
74
|
|
76
75
|
$.rails.allowAction = allowAction
|
77
76
|
|
78
|
-
false
|
77
|
+
false
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootstrap-rails-confirm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rene van Lieshout
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-10-11 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Confirm dialogs using Twitter Bootstrap
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements: []
|
69
69
|
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.24
|
72
72
|
signing_key:
|
73
73
|
specification_version: 3
|
74
74
|
summary: Applies a custom confirm dialog for elements with a data-confirm attribute.
|