button_link_to 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/button_link_to.js +24 -7
- data/lib/button_link_to/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16125ebbfdf806e9861579cc672ce88d642caa7d
|
4
|
+
data.tar.gz: d5eecf5357f923488d910774d089052ac81f808c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ea45f6ccdaa2a1cfe53eca6cd4b3d867744b3ab9ee4f8347990fe810364faf740f6569dceeb8783cfb4cdd993c260ecabf3d9b610bcd89b638a0860b71e47f
|
7
|
+
data.tar.gz: 2b02fb7f6da9ecd7519270f59d9f4a359c0017cee44f4119120ff5e54b8ee1b880230c8201572c967642a7471fe1fcdb34d8b11807ebb8b85f2c03d994fadd44
|
@@ -1,5 +1,6 @@
|
|
1
1
|
(function() {
|
2
|
-
|
2
|
+
$document = $(document)
|
3
|
+
|
3
4
|
$(document).on("mouseup", "button[data-remote]", function(e) {
|
4
5
|
// middle button click
|
5
6
|
if(e.which == 2) {
|
@@ -7,14 +8,28 @@
|
|
7
8
|
}
|
8
9
|
});
|
9
10
|
|
10
|
-
$(document).on("click.rails", "button[data-method]", function(e) {
|
11
|
-
if (!$.rails.allowAction($(e.currentTarget))) return $.rails.stopEverything(e);
|
12
|
-
});
|
13
11
|
|
14
|
-
|
15
|
-
$(document).on("click.rails", "button[data-method]", function(e) {
|
12
|
+
$document.on("click.rails", "button[data-method]", function(e) {
|
16
13
|
button = $(e.currentTarget)
|
17
14
|
|
15
|
+
if (button.data('disable-with')) $.rails.disableElement(button);
|
16
|
+
|
17
|
+
if (button.data('method') && button.data('remote') === undefined) {
|
18
|
+
if (!$.rails.allowAction(button)) return $.rails.stopEverything(e);
|
19
|
+
|
20
|
+
handleMethod(button)
|
21
|
+
}
|
22
|
+
|
23
|
+
});
|
24
|
+
|
25
|
+
|
26
|
+
$document.on("ajax:complete", "button[data-disable-with]", function() {
|
27
|
+
$.rails.enableElement($(this));
|
28
|
+
});
|
29
|
+
|
30
|
+
|
31
|
+
var handleMethod = function(button) {
|
32
|
+
|
18
33
|
var url = button.data("url"),
|
19
34
|
method = button.data('method'),
|
20
35
|
target = button.data('target'),
|
@@ -31,6 +46,8 @@
|
|
31
46
|
|
32
47
|
form.hide().append(metadata_input).appendTo('body');
|
33
48
|
form.submit();
|
49
|
+
}
|
50
|
+
|
51
|
+
|
34
52
|
|
35
|
-
});
|
36
53
|
})();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: button_link_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tonilin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|