abracadabra 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/app/assets/javascripts/abracadabra.js +13 -11
- data/app/helpers/abracadabra/rails/view_helper.rb +3 -1
- data/lib/abracadabra/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e278480715ec17aca8e37299701755c70cbc868
|
4
|
+
data.tar.gz: c0924415b005bc88e6f6599e526ff9b3754c0f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8d0e0377c5b2d984639fcab19c040b586f53fdb037f1e895d2c647df5f4c3774fe3a6b004dc4fc6e4faaca7acaa5bb8b16af005e2e3f44ba7c335d7d72f83e
|
7
|
+
data.tar.gz: e3b8ab44882e0fb8f3809422abcfca1d03dda31bc9414a329b9154185b709433aef075174af787e46f05c37cf469698e24fafdcd2579c8e21ed248056f0746ce
|
data/README.md
CHANGED
@@ -94,7 +94,7 @@ type: :js
|
|
94
94
|
# Default: :script (:js)
|
95
95
|
|
96
96
|
# IMPORTANT: On ajax:success, this will remove the specific abracadabra instance from
|
97
|
-
# the DOM entirely.
|
97
|
+
# the DOM entirely. ALSO, this will be remote if the main form is remote.
|
98
98
|
deletable: true
|
99
99
|
# Boolean: DELETE will be submitted without a confirmation dialog
|
100
100
|
# OR
|
@@ -109,6 +109,11 @@ deletable_path: user_path(@user)
|
|
109
109
|
# Description: Specifies where the form will be submitted.
|
110
110
|
# Default: path (uses the same path as the main form if `deletable_path` isn't declared).
|
111
111
|
|
112
|
+
deletable_type: :js
|
113
|
+
# Description: Deletable content type -- responds to any content type (:js and :script
|
114
|
+
# can both be used to respond with Javascript).
|
115
|
+
# Default: :script (:js)
|
116
|
+
|
112
117
|
# Boolean: Open the next abracadabra instance after successful form submission (main
|
113
118
|
# form, not the DELETE link's submission) by using `.abracadabra` as the selector.
|
114
119
|
tab_to_next: true
|
@@ -116,7 +121,7 @@ tab_to_next: true
|
|
116
121
|
tab_to_next: ".my-class"
|
117
122
|
# IMPORTANT: If this is a class, this abracadabra instance MUST have the same class
|
118
123
|
# as well.
|
119
|
-
# String: The class or ID of the next abracadabra instance to open on
|
124
|
+
# String: The class or ID of the next abracadabra instance to open on successful form
|
120
125
|
# submission. Use `.` before a class selector or `#` before a an ID selector just as you
|
121
126
|
# would when finding an element in Javascript.
|
122
127
|
# Description: Puts a link to DELETE the object (obviously, it always uses DELETE as the
|
@@ -153,6 +153,18 @@ $(function() {
|
|
153
153
|
}
|
154
154
|
/* /Check if button classes have been manually overridden elsewhere */
|
155
155
|
|
156
|
+
/* AJAX? */
|
157
|
+
if(remote == "") {
|
158
|
+
authToken = "<input name=\"authenticity_token\" type=\"hidden\" value=\"" + $("meta[name=\"csrf-token\"]").attr("content") + "\">";
|
159
|
+
type = "";
|
160
|
+
deletableType = "";
|
161
|
+
} else {
|
162
|
+
authToken = "";
|
163
|
+
type = " data-type=\"" + link.data("type") + "\"";
|
164
|
+
deletableType = " data-type=\"" + link.data("deletable-type") + "\"";
|
165
|
+
}
|
166
|
+
/* /AJAX? */
|
167
|
+
|
156
168
|
/* Deletable? */
|
157
169
|
if(link.data("deletable") !== false) {
|
158
170
|
deletablePath = link.data("deletable-path");
|
@@ -162,7 +174,7 @@ $(function() {
|
|
162
174
|
} else {
|
163
175
|
deletableConfirm = " data-confirm=\"" + deletableConfirm + "\"";
|
164
176
|
}
|
165
|
-
deletable = "<span class=\"abracadabra-delete-container\"><a href=\"" + deletablePath + "\" class=\"abracadabra-delete\" data-method=\"delete\"" + deletableConfirm + remote + " rel=\"nofollow\"><i class=\"" + abracadabraDeleteIcon + "\"></i></a></span>";
|
177
|
+
deletable = "<span class=\"abracadabra-delete-container\"><a href=\"" + deletablePath + "\" class=\"abracadabra-delete\" data-method=\"delete\"" + deletableConfirm + remote + deletableType + " rel=\"nofollow\"><i class=\"" + abracadabraDeleteIcon + "\"></i></a></span>";
|
166
178
|
} else {
|
167
179
|
deletable = "";
|
168
180
|
}
|
@@ -187,16 +199,6 @@ $(function() {
|
|
187
199
|
}
|
188
200
|
/* /Submit on blur? */
|
189
201
|
|
190
|
-
/* AJAX? */
|
191
|
-
if(remote == "") {
|
192
|
-
authToken = "<input name=\"authenticity_token\" type=\"hidden\" value=\"" + $("meta[name=\"csrf-token\"]").attr("content") + "\">";
|
193
|
-
type = "";
|
194
|
-
} else {
|
195
|
-
authToken = "";
|
196
|
-
type = " data-type=\"" + link.data("type") + "\"";
|
197
|
-
}
|
198
|
-
/* /AJAX? */
|
199
|
-
|
200
202
|
/* Show buttons? */
|
201
203
|
if(link.data("buttonless") == true) {
|
202
204
|
buttons = "";
|
@@ -10,7 +10,7 @@ module Abracadabra
|
|
10
10
|
path = options[:path]
|
11
11
|
buttonless = options[:buttonless] || false
|
12
12
|
deletable = options[:deletable] || false
|
13
|
-
deletable_path = options[:deletable_path] || path
|
13
|
+
deletable_path = options[:deletable_path] || path
|
14
14
|
submit_on_blur = options[:submit_on_blur] || false
|
15
15
|
|
16
16
|
if options[:tab_to_next] || options[:tab_to_next] != false
|
@@ -30,6 +30,7 @@ module Abracadabra
|
|
30
30
|
end
|
31
31
|
|
32
32
|
data_type = options[:type].to_s.gsub(/^j+s+$/, "script") || "script"
|
33
|
+
deletable_type = options[:deletable_type].to_s.gsub(/^j+s+$/, "script") || "script"
|
33
34
|
|
34
35
|
link_to(
|
35
36
|
value,
|
@@ -45,6 +46,7 @@ module Abracadabra
|
|
45
46
|
buttonless: buttonless,
|
46
47
|
deletable: deletable,
|
47
48
|
deletable_path: deletable_path,
|
49
|
+
deletable_type: deletable_type.to_sym,
|
48
50
|
tab_to_next: tab_to_next,
|
49
51
|
submit_on_blur: submit_on_blur
|
50
52
|
},
|
data/lib/abracadabra/version.rb
CHANGED