twitter-bootstrap-rails-confirm 0.0.4 → 0.0.5
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.
data/README.md
CHANGED
@@ -9,6 +9,25 @@ The normal confirm dialog shows a text with buttons 'ok' and 'cancel'. More info
|
|
9
9
|
* data-confirm-proceed (default: 'ok')
|
10
10
|
* data-confirm-proceed-class (default: 'brn-primary')
|
11
11
|
|
12
|
+
This behaviour is similar to that of a "regular" confirm box in ways that it uses the same title and button labels. Defaults are set when the DOM has been loaded and can be changed in two ways:
|
13
|
+
|
14
|
+
Chaning all default values:
|
15
|
+
|
16
|
+
$(document).ready(function() {
|
17
|
+
$.fn.twitter_bootstrap_confirmbox.defaults = {
|
18
|
+
title: null, // if title equals null window.top.location.origin is used
|
19
|
+
cancel: "Cancel",
|
20
|
+
proceed: "OK",
|
21
|
+
proceed_class: "btn proceed btn-primary"
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
Only chaning the proceed_class default:
|
26
|
+
|
27
|
+
$(document).ready(function() {
|
28
|
+
$.fn.twitter_bootstrap_confirmbox.defaults.proceed_class = "btn proceed btn-success"
|
29
|
+
});
|
30
|
+
|
12
31
|
## Installation
|
13
32
|
|
14
33
|
Add this line to your application's Gemfile:
|
@@ -1,4 +1,11 @@
|
|
1
1
|
$ ->
|
2
|
+
$.fn.twitter_bootstrap_confirmbox =
|
3
|
+
defaults:
|
4
|
+
title: null
|
5
|
+
cancel: "Cancel"
|
6
|
+
proceed: "OK"
|
7
|
+
proceed_class: "btn proceed btn-primary"
|
8
|
+
|
2
9
|
TwitterBootstrapConfirmBox = (message, element, callback) ->
|
3
10
|
$(document.body).append($('
|
4
11
|
<div class="modal hide" id="confirmation_dialog">
|
@@ -9,9 +16,9 @@ $ ->
|
|
9
16
|
'))
|
10
17
|
|
11
18
|
$("#confirmation_dialog .modal-body").html(message)
|
12
|
-
$("#confirmation_dialog .modal-header h3").html(element.data("confirm-title") || window.top.location.origin)
|
13
|
-
$("#confirmation_dialog .modal-footer .cancel").html(element.data("confirm-cancel") ||
|
14
|
-
$("#confirmation_dialog .modal-footer .proceed").html(element.data("confirm-proceed") ||
|
19
|
+
$("#confirmation_dialog .modal-header h3").html(element.data("confirm-title") || $.fn.twitter_bootstrap_confirmbox.defaults.title || window.top.location.origin)
|
20
|
+
$("#confirmation_dialog .modal-footer .cancel").html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel)
|
21
|
+
$("#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"))
|
15
22
|
$("#confirmation_dialog").modal "show"
|
16
23
|
|
17
24
|
$("#confirmation_dialog .proceed").click ->
|
@@ -30,7 +37,6 @@ $ ->
|
|
30
37
|
|
31
38
|
if $.rails.fire(element, "confirm")
|
32
39
|
TwitterBootstrapConfirmBox message, element, ->
|
33
|
-
#callback = $.rails.fire(element, "confirm:complete", [answer])
|
34
40
|
if $.rails.fire(element, "confirm:complete", [answer])
|
35
41
|
allowAction = $.rails.allowAction
|
36
42
|
|
metadata
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootstrap-rails-confirm
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Rene van Lieshout
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2012-11-15 00:00:00 Z
|
13
19
|
dependencies: []
|
20
|
+
|
14
21
|
description: Confirm dialogs using Twitter Bootstrap
|
15
|
-
email:
|
22
|
+
email:
|
16
23
|
- rene@bluerail.nl
|
17
24
|
executables: []
|
25
|
+
|
18
26
|
extensions: []
|
27
|
+
|
19
28
|
extra_rdoc_files: []
|
20
|
-
|
29
|
+
|
30
|
+
files:
|
21
31
|
- .gitignore
|
22
32
|
- Gemfile
|
23
33
|
- LICENSE
|
@@ -30,27 +40,37 @@ files:
|
|
30
40
|
- vendor/assets/javascripts/twitter/bootstrap/rails/confirm.coffee
|
31
41
|
homepage: https://github.com/bluerail/twitter-bootstrap-rails-confirm
|
32
42
|
licenses: []
|
43
|
+
|
33
44
|
post_install_message:
|
34
45
|
rdoc_options: []
|
35
|
-
|
46
|
+
|
47
|
+
require_paths:
|
36
48
|
- lib
|
37
49
|
- vendor
|
38
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
51
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
60
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
50
68
|
requirements: []
|
69
|
+
|
51
70
|
rubyforge_project:
|
52
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.24
|
53
72
|
signing_key:
|
54
73
|
specification_version: 3
|
55
74
|
summary: Applies a custom confirm dialog for elements with a data-confirm attribute.
|
56
75
|
test_files: []
|
76
|
+
|