twitter-bootstrap-rails-confirm 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c8d3c67c7d3310a0c8a501c54dfa55df5ac0eed
4
- data.tar.gz: c1b607e10d288da91216f56ade8f1e742f12389a
3
+ metadata.gz: bcec1c805c2d1e36a60f781c6f4e2689e07b911f
4
+ data.tar.gz: b5447bf2e5d9ce915c6bea67a08b5ca5bfe0386d
5
5
  SHA512:
6
- metadata.gz: 624ba343808e818ec3c9e5d04eab263015c49a2307740a4ef7dd6bb198442f9c208c574fcfb8f47dc4782eab01c41109821cafc9976e059f90e9cc81e0de266a
7
- data.tar.gz: 83b7c49d7032f0bdcd0017cb98781fb41171b7727a6b9b920ec41e8eed970b27bcf6f9b757995d30156ab7e341140c6f7eb79b1f8a441bd449a0b07542eaea23
6
+ metadata.gz: 8ef92279b90a1e263e9b4940b5e1056bdb644b9e0f33be36fc37d24fe7e806414749cf1a449843b85c68e9a44ae91385379fa1cd816826ec8bdd050ff2aa9545
7
+ data.tar.gz: 18ce36fe5e2e324e6fc505003fd4d8e0221767bf979596d46988b97603cbc809513458176bd0a884fa2dd6c15f357b8a6b768160d34525ab5cb5eb0423348f11
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Twitter::Bootstrap::Rails::Confirm
2
2
 
3
- This gem adds some javascript to change the default behaviour of data-confirm processing for both Boostrap 2 and Bootstrap 3.
3
+ This gem adds some javascript to change the default behaviour of data-confirm processing for both Boostrap 2, 3 and 4.
4
4
 
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:
5
+ The normal confirm dialog shows a text with buttons 'ok' and 'cancel'. More information is needed here for a user to
6
+ make the right decision. This gem therefore also adds:
6
7
 
7
8
  * data-confirm-fade (default: false)
8
9
  * data-confirm-title (default: window.top.location.origin)
@@ -11,56 +12,76 @@ The normal confirm dialog shows a text with buttons 'ok' and 'cancel'. More info
11
12
  * data-confirm-proceed (default: 'ok')
12
13
  * data-confirm-proceed-class (default: 'btn-primary')
13
14
 
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:
15
+ This behaviour is similar to that of a "regular" confirm box in ways that it uses the same title and button labels.
16
+ Defaults can be changed in two ways:
15
17
 
16
18
  Changing all default values:
17
19
 
18
- $.fn.twitter_bootstrap_confirmbox.defaults = {
19
- fade: false,
20
- title: null, // if title equals null window.top.location.origin is used
21
- cancel: "Cancel",
22
- cancel_class: "btn cancel",
23
- proceed: "OK",
24
- proceed_class: "btn proceed btn-primary",
25
- modal_class: ""
26
- };
20
+ ```javascript
21
+ $.fn.twitter_bootstrap_confirmbox.defaults = {
22
+ fade: false,
23
+ title: null, // if title equals null window.top.location.origin is used
24
+ cancel: "Cancel",
25
+ cancel_class: "btn cancel",
26
+ proceed: "OK",
27
+ proceed_class: "btn proceed btn-primary",
28
+ modal_class: ""
29
+ };
30
+ ```
27
31
 
28
32
  Only changing one default value:
29
33
 
30
- $.fn.twitter_bootstrap_confirmbox.defaults.proceed_class = "btn proceed btn-success";
34
+ ```javascript
35
+ $.fn.twitter_bootstrap_confirmbox.defaults.proceed_class = "btn proceed btn-success";
36
+ ```
31
37
 
32
38
  ## Installation
33
39
 
34
40
  Add this line to your application's Gemfile:
35
41
 
36
- gem 'twitter-bootstrap-rails-confirm'
42
+ ```ruby
43
+ gem 'twitter-bootstrap-rails-confirm'
44
+ ```
37
45
 
38
46
  And then execute:
39
47
 
40
- $ bundle
48
+ ```
49
+ $ bundle
50
+ ```
41
51
 
42
- Note: [jQuery-Rails should be > 2.2.1](https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/27). The exact required version has not yet been determined.
52
+ Note: [jQuery-Rails should be > 2.2.1](https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/27). The exact
53
+ required version has not yet been determined.
43
54
 
44
55
  ## Usage
45
56
 
46
57
  Add it to your application.js, anywhere after you require jquery_ujs:
47
58
 
48
- //= require twitter/bootstrap/rails/confirm
49
-
50
- Next... nothing. There is nothing you need to do to get this working. A helper could be useful for handling large amount of destroy buttons:
51
-
52
- def destroy_link_to(path, options)
53
- link_to t('.destroy'), path,
54
- :method => :delete,
55
- :class => "btn",
56
- :confirm => t('.destroy_confirm.body', :item => options[:item]),
57
- "data-confirm-fade" => true,
58
- "data-confirm-title" => t('.destroy_confirm.title', :item => options[:item]),
59
- "data-confirm-cancel" => t('.destroy_confirm.cancel', :item => options[:item]),
60
- "data-confirm-cancel-class" => "btn-cancel"),
61
- "data-confirm-proceed" => t('.destroy_confirm.proceed', :item => options[:item]),
62
- "data-confirm-proceed-class" => "btn-danger"
63
- end
59
+ ```coffeescript
60
+ //= require twitter/bootstrap/rails/confirm
61
+ ```
62
+
63
+ Next... nothing. There is nothing you need to do to get this working. A helper could be useful for handling large amount
64
+ of destroy buttons:
65
+
66
+ ```ruby
67
+ def destroy_link_to(path, options)
68
+ link_to t('.destroy'), path,
69
+ :method => :delete,
70
+ :class => "btn",
71
+ :confirm => t('.destroy_confirm.body', :item => options[:item]),
72
+ "data-confirm-fade" => true,
73
+ "data-confirm-title" => t('.destroy_confirm.title', :item => options[:item]),
74
+ "data-confirm-cancel" => t('.destroy_confirm.cancel', :item => options[:item]),
75
+ "data-confirm-cancel-class" => "btn-cancel"),
76
+ "data-confirm-proceed" => t('.destroy_confirm.proceed', :item => options[:item]),
77
+ "data-confirm-proceed-class" => "btn-danger"
78
+ end
79
+ ```
80
+
81
+ ## Testing
82
+
83
+ See [Twitter Bootstrap Rails Confirm Test](https://github.com/bluerail/twitter-bootstrap-rails-confirm-test) for a
84
+ simple app that loads Bootstrap and this gem.
64
85
 
65
86
  ## Contributing
66
87
 
@@ -72,6 +93,10 @@ Next... nothing. There is nothing you need to do to get this working. A helper c
72
93
 
73
94
  ## Changelog
74
95
 
96
+ ### 1.0.7 (November 24, 2017)
97
+
98
+ * [(thiesp)](https://github.com/thiesp) [Adding template and setting default cancel class to btn-secondary for bootstrap 4](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/358)
99
+
75
100
  ### 1.0.6 (June 9, 2016)
76
101
 
77
102
  * [(rvanlieshout)](https://github.com/rvanlieshout) [Added proper events for Bootstrap 3](https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/28)
@@ -2,7 +2,7 @@ module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
4
  module Confirm
5
- VERSION = "1.0.6"
5
+ VERSION = "1.0.7"
6
6
  end
7
7
  end
8
8
  end
@@ -9,34 +9,50 @@ $.fn.twitter_bootstrap_confirmbox =
9
9
  modal_class: ""
10
10
 
11
11
  TwitterBootstrapConfirmBox = (message, element, callback) ->
12
- bootstrap_version = if (typeof $().emulateTransitionEnd == 'function') then 3 else 2
12
+ bootstrap_version = if (typeof $().emulateTransitionEnd == 'function') then parseInt($.fn.tooltip.Constructor.VERSION[0]) else 2
13
13
 
14
- if bootstrap_version == 2
15
- $dialog = $('
16
- <div class="modal hide" id="confirmation_dialog">
17
- <div class="modal-header">
18
- <button type="button" class="close" data-dismiss="modal">×</button>
19
- <h3 class="modal-title">...</h3>
14
+ switch bootstrap_version
15
+ when 2
16
+ $dialog = $('
17
+ <div class="modal hide" id="confirmation_dialog">
18
+ <div class="modal-header">
19
+ <button type="button" class="close" data-dismiss="modal">×</button>
20
+ <h3 class="modal-title">...</h3>
21
+ </div>
22
+ <div class="modal-body"></div>
23
+ <div class="modal-footer"></div>
24
+ </div>
25
+ ')
26
+ when 3
27
+ $dialog = $('
28
+ <div class="modal" id="confirmation_dialog" role="dialog">
29
+ <div class="modal-dialog">
30
+ <div class="modal-content">
31
+ <div class="modal-header">
32
+ <button type="button" class="close" data-dismiss="modal">×</button>
33
+ <h4 class="modal-title">...</h4>
34
+ </div>
35
+ <div class="modal-body"></div>
36
+ <div class="modal-footer"></div>
37
+ </div>
38
+ </div>
20
39
  </div>
21
- <div class="modal-body"></div>
22
- <div class="modal-footer"></div>
23
- </div>
24
- ')
25
- else
26
- $dialog = $('
27
- <div class="modal" id="confirmation_dialog" role="dialog">
28
- <div class="modal-dialog">
29
- <div class="modal-content">
30
- <div class="modal-header">
31
- <button type="button" class="close" data-dismiss="modal">×</button>
32
- <h4 class="modal-title">...</h4>
40
+ ')
41
+ else # 4
42
+ $dialog = $('
43
+ <div class="modal" id="confirmation_dialog" role="dialog">
44
+ <div class="modal-dialog">
45
+ <div class="modal-content">
46
+ <div class="modal-header">
47
+ <h4 class="modal-title">...</h4>
48
+ <button type="button" class="close" data-dismiss="modal">×</button>
49
+ </div>
50
+ <div class="modal-body"></div>
51
+ <div class="modal-footer"></div>
33
52
  </div>
34
- <div class="modal-body"></div>
35
- <div class="modal-footer"></div>
36
53
  </div>
37
54
  </div>
38
- </div>
39
- ')
55
+ ')
40
56
 
41
57
  $dialog.addClass(element.data("confirm-modal-class") || $.fn.twitter_bootstrap_confirmbox.defaults.modal_class)
42
58
 
@@ -58,7 +74,7 @@ TwitterBootstrapConfirmBox = (message, element, callback) ->
58
74
  $("<a />", {href: "#", "data-dismiss": "modal"})
59
75
  .html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel)
60
76
  .addClass($.fn.twitter_bootstrap_confirmbox.defaults.cancel_class)
61
- .addClass(element.data("confirm-cancel-class") || "btn-default")
77
+ .addClass(element.data("confirm-cancel-class") || ("btn-secondary" if bootstrap_version == 4) || "btn-default")
62
78
  .click((event) ->
63
79
  event.preventDefault()
64
80
  $dialog.modal("hide")
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.6
4
+ version: 1.0.7
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: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2017-11-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Confirm dialogs using Twitter Bootstrap
14
14
  email:
@@ -17,7 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .gitignore
20
+ - ".gitignore"
21
21
  - Gemfile
22
22
  - LICENSE
23
23
  - README.md
@@ -37,17 +37,17 @@ require_paths:
37
37
  - vendor
38
38
  required_ruby_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 2.0.14.1
50
+ rubygems_version: 2.5.2
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: Applies a custom confirm dialog for elements with a data-confirm attribute.