twitter-bootstrap-rails-confirm 1.0.2 → 1.0.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3ba7f8b59246c9423a9638868574b5804848b692
4
+ data.tar.gz: b050961231c0042715e0002e15c52d0ca1d136eb
5
+ SHA512:
6
+ metadata.gz: d33ffd28ae2866614123985160aca05b99a944a655c57627ce34f088e5b97de4a5b91e55e1970aeef2d7a86b754fb5c9a88a19b41d7ae4e0c1f19402615fef14
7
+ data.tar.gz: f5e669f9bd96d87284481bf4181eb22e0700448ac42bfdac607bc5707b0c4f3f282c54d32f950812ecc17ef16cba08729c4614ed422bfbce9f6403dbf3d39f11
data/README.md CHANGED
@@ -73,9 +73,11 @@ Next... nothing. There is nothing you need to do to get this working. A helper c
73
73
 
74
74
  ## Changelog
75
75
 
76
- ### In active development
76
+ ### 1.0.3 (September 4, 2014)
77
77
 
78
- * Javascript testing using Jasmine
78
+ * [(rvanlieshout)](https://github.com/rvanlieshout) [Problems with using event constructors](https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/18)
79
+ * [(stevelacey)](https://github.com/stevelacey) [Avoid appending custom proceed class to btn-primary, refactored dialog JS](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/17)
80
+ * [(zsy056)](https://github.com/zsy056) [When message is numerical, the call replace on message will cause a TypeError](https://github.com/bluerail/twitter-bootstrap-rails-confirm/pull/22)
79
81
 
80
82
  ### 1.0.2 (Oktober 11, 2013)
81
83
 
@@ -2,7 +2,7 @@ module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
4
  module Confirm
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
8
8
  end
@@ -1,42 +1,65 @@
1
1
  $.fn.twitter_bootstrap_confirmbox =
2
2
  defaults:
3
- fade: false
4
3
  title: null
4
+ proceed: "OK"
5
+ proceed_class: "btn proceed"
5
6
  cancel: "Cancel"
6
7
  cancel_class: "btn cancel"
7
- proceed: "OK"
8
- proceed_class: "btn proceed btn-primary"
8
+ fade: false
9
9
 
10
10
  TwitterBootstrapConfirmBox = (message, element, callback) ->
11
- $(document.body).append(
12
- $(
13
- '<div class="modal hide" id="confirmation_dialog">
14
- <div class="modal-header"><button type="button" class="close" data-dismiss="modal">×</button><h3>...</h3></div>
15
- <div class="modal-body"></div>
16
- <div class="modal-footer"><a href="#" class="btn cancel" data-dismiss="modal">...</a><a href="#" class="btn proceed btn-primary">...</a></div>
17
- </div>'
18
- )
19
- )
11
+ $dialog = $('
12
+ <div class="modal hide" id="confirmation_dialog">
13
+ <div class="modal-header">
14
+ <button type="button" class="close" data-dismiss="modal">×</button>
15
+ <h3>...</h3>
16
+ </div>
17
+ <div class="modal-body"></div>
18
+ <div class="modal-footer"></div>
19
+ </div>
20
+ ')
21
+
22
+ $dialog.addClass("fade") if element.data("confirm-fade") || $.fn.twitter_bootstrap_confirmbox.defaults.fade
20
23
 
21
- $("#confirmation_dialog").addClass("fade") if element.data("confirm-fade") || $.fn.twitter_bootstrap_confirmbox.defaults.fade
22
- $("#confirmation_dialog .modal-body").html(message.replace(/\n/g, "<br />"))
23
- $("#confirmation_dialog .modal-header h3").html(element.data("confirm-title") || $.fn.twitter_bootstrap_confirmbox.defaults.title || window.top.location.origin)
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"))
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"))
26
- $("#confirmation_dialog").modal("show").on("hidden", ->
27
- $(this).remove()
28
- )
24
+ $dialog
25
+ .find(".modal-header")
26
+ .find("h3")
27
+ .html(element.data("confirm-title") || $.fn.twitter_bootstrap_confirmbox.defaults.title || window.top.location.origin)
28
+ .end()
29
+ .end()
29
30
 
30
- $("#confirmation_dialog .proceed").click (event) ->
31
- event.preventDefault()
32
- $("#confirmation_dialog").modal("hide")
33
- callback()
34
- false
31
+ .find(".modal-body")
32
+ .html(message.toString().replace(/\n/g, "<br />"))
33
+ .end()
35
34
 
36
- $("#confirmation_dialog .cancel").click (event) ->
37
- event.preventDefault()
38
- $("#confirmation_dialog").modal("hide")
39
- false
35
+ .find(".modal-footer")
36
+ .append(
37
+ $("<a />", {href: "#", "data-dismiss": "modal"})
38
+ .html(element.data("confirm-cancel") || $.fn.twitter_bootstrap_confirmbox.defaults.cancel)
39
+ .addClass($.fn.twitter_bootstrap_confirmbox.defaults.cancel_class)
40
+ .addClass(element.data("confirm-cancel-class"))
41
+ .click((event) ->
42
+ event.preventDefault()
43
+ $dialog.modal("hide")
44
+ )
45
+ ,
46
+ $("<a />", {href: "#"})
47
+ .html(element.data("confirm-proceed") || $.fn.twitter_bootstrap_confirmbox.defaults.proceed)
48
+ .addClass($.fn.twitter_bootstrap_confirmbox.defaults.proceed_class)
49
+ .addClass(element.data("confirm-proceed-class") || "btn-primary")
50
+ .click((event) ->
51
+ event.preventDefault()
52
+ $dialog.modal("hide")
53
+ callback()
54
+ )
55
+ )
56
+ .end()
57
+
58
+ .on("hidden", -> $(this).remove())
59
+
60
+ .modal("show")
61
+
62
+ .appendTo(document.body)
40
63
 
41
64
  $.rails.allowAction = (element) ->
42
65
  message = element.data("confirm")
@@ -53,25 +76,47 @@ $.rails.allowAction = (element) ->
53
76
 
54
77
  if element.get(0).click
55
78
  element.get(0).click()
56
- else
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
79
+
80
+ else if Event?
81
+ evt = new Event("click", {
82
+ bubbles: true,
83
+ cancelable: true,
84
+ view: window,
85
+ detail: 0,
86
+ screenX: 0,
87
+ screenY: 0,
88
+ clientX: 0,
89
+ clientY: 0,
90
+ ctrlKey: false,
91
+ altKey: false,
92
+ shiftKey: false,
93
+ metaKey: false,
94
+ button: 0,
95
+ relatedTarget: document.body.parentNode
72
96
  })
73
97
  element.get(0).dispatchEvent(evt)
74
98
 
99
+ else if $.isFunction(document.createEvent)
100
+ evt = document.createEvent "MouseEvents"
101
+ evt.initMouseEvent(
102
+ "click",
103
+ true, # e.bubbles,
104
+ true, # e.cancelable,
105
+ window, # e.view,
106
+ 0, # e.detail,
107
+ 0, # e.screenX,
108
+ 0, # e.screenY,
109
+ 0, # e.clientX,
110
+ 0, # e.clientY,
111
+ false, # e.ctrlKey,
112
+ false, # e.altKey,
113
+ false, # e.shiftKey,
114
+ false, # e.metaKey,
115
+ 0, # e.button,
116
+ document.body.parentNode # e.relatedTarget
117
+ )
118
+ element.get(0).dispatchEvent(evt)
119
+
75
120
  $.rails.allowAction = allowAction
76
121
 
77
122
  false
metadata CHANGED
@@ -1,33 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: twitter-bootstrap-rails-confirm
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 2
10
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Rene van Lieshout
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-10-11 00:00:00 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
13
  description: Confirm dialogs using Twitter Bootstrap
22
- email:
14
+ email:
23
15
  - rene@bluerail.nl
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
18
  extra_rdoc_files: []
29
-
30
- files:
19
+ files:
31
20
  - .gitignore
32
21
  - Gemfile
33
22
  - LICENSE
@@ -40,37 +29,26 @@ files:
40
29
  - vendor/assets/javascripts/twitter/bootstrap/rails/confirm.coffee
41
30
  homepage: https://github.com/bluerail/twitter-bootstrap-rails-confirm
42
31
  licenses: []
43
-
32
+ metadata: {}
44
33
  post_install_message:
45
34
  rdoc_options: []
46
-
47
- require_paths:
35
+ require_paths:
48
36
  - lib
49
37
  - vendor
50
- required_ruby_version: !ruby/object:Gem::Requirement
51
- none: false
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
60
- none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- hash: 3
65
- segments:
66
- - 0
67
- version: "0"
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
68
48
  requirements: []
69
-
70
49
  rubyforge_project:
71
- rubygems_version: 1.8.24
50
+ rubygems_version: 2.0.14
72
51
  signing_key:
73
- specification_version: 3
52
+ specification_version: 4
74
53
  summary: Applies a custom confirm dialog for elements with a data-confirm attribute.
75
54
  test_files: []
76
-