Current section
Files
Jump to
Current section
Files
web/static/vendor/themes/active_admin/js/jquery-ujs.js.js
// Generated by CoffeeScript 1.9.1
(function() {
jQuery(function() {
var do_confirm;
do_confirm = function(ptr) {
var message;
message = ptr.attr("data-confirm");
if (message === void 0) {
return true;
}
return confirm(message);
};
$("a[data-remote]").click(function(e) {
var csrfToken, href, jthis, method;
e.preventDefault;
jthis = $(this);
if (!do_confirm($(this))) {
return;
}
href = jthis.attr("href") + "?format=js";
method = jthis.attr("data-method");
csrfToken = $("#_csrf_token").attr("content");
$.ajax({
url: href,
dataType: "script"
});
return false;
});
$("a[data-method='delete'").click(function(e) {
var href, id;
e.preventDefault();
if (!do_confirm($(this))) {
return;
}
href = $(this).attr("href");
csrf = $(this).attr("data-csrf");
id = "delete_" + href.replace(/\//g, "_");
$("<form id='" + id + "' method='post' class='link' action='" + href +
"'> <input name='_method' value='delete' type='hidden' /> " +
"<input type='hidden' name='_csrf_token' value='"+csrf+"' /> " +
"</form>").appendTo($(this).parent());
$("#" + id).submit();
return false;
});
$("a[data-method='post'").click(function(e) {
var href, id;
e.preventDefault();
if (!do_confirm($(this))) {
return;
}
href = $(this).attr("href");
id = "post_" + href.replace(/\//g, "_");
$("<form id='" + id + "' method='post' class='link' action='" + href + "'></form>").appendTo($(this).parent());
$("#" + id).submit();
return false;
});
return $("a[data-method='put'").click(function(e) {
var href, id;
e.preventDefault();
if (!do_confirm($(this))) {
return;
}
href = $(this).attr("href");
id = "post_" + href.replace(/\//g, "_");
$("<form id='" + id + "' method='post' class='link' action='" + href + "'> <input name='_method' value='put' type='hidden' /> </form>").appendTo($(this).parent());
$("#" + id).submit();
return false;
});
});
}).call(this);