Skip to content

Commit 5c07153

Browse files
committed
make select bookmark error a configurable callback
1 parent 8755106 commit 5c07153

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/assets/javascripts/blacklight/checkbox_submit.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
progress_label: "Saving...",
2424
//css_class is added to elements added, plus used for id base
2525
css_class: "toggle_my_kinda_form",
26+
error: function() {
27+
#optional callback
28+
},
2629
success: function(after_success_check_state) {
2730
#optional callback
2831
}
@@ -96,9 +99,9 @@
9699
type: form.attr("method").toUpperCase(),
97100
data: form.serialize(),
98101
error: function() {
99-
alert("Error");
100102
label.removeAttr("disabled");
101103
checkbox.removeAttr("disabled");
104+
options.error.call();
102105
},
103106
success: function(data, status, xhr) {
104107
//if app isn't running at all, xhr annoyingly
@@ -110,9 +113,9 @@
110113
checkbox.removeAttr("disabled");
111114
options.success.call(form, checked, xhr.responseJSON);
112115
} else {
113-
alert("Error");
114116
label.removeAttr("disabled");
115117
checkbox.removeAttr("disabled");
118+
options.error.call();
116119
}
117120
}
118121
});
@@ -128,6 +131,9 @@
128131
$.fn.bl_checkbox_submit.defaults = {
129132
//css_class is added to elements added, plus used for id base
130133
css_class: "bl_checkbox_submit",
134+
error: function() {
135+
alert("Error");
136+
},
131137
success: function() {} //callback
132138
};
133139
})(jQuery);

0 commit comments

Comments
 (0)