Commit 766bd3b7 authored by ibuler's avatar ibuler

Move js to jumpserver.js

parent b2444c2a
......@@ -17,7 +17,6 @@ from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import TemplateView
from django.http import HttpResponseRedirect
urlpatterns = [
......
......@@ -214,4 +214,30 @@ function APIUpdateAttr(props) {
return true;
}
// Sweet Alert for Delete
function objectDelete(obj, name, url){
swal({
title: 'Are you sure delete ?',
text: "【" + name + "】",
type: "warning",
showCancelButton: true,
cancelButtonText: 'Cancel',
confirmButtonColor: "#DD6B55",
confirmButtonText: 'Yes, delete it!',
closeOnConfirm: false
}, function () {
$.ajax({
type : "post",
url : url,
data : {
},
dataType : "text",
success : function(data) {
swal('Deleted!' , "【"+name+"】"+"has been deleted.", "success");
$(obj).parent().parent().remove();
}
})
});
}
var jumpserver = {};
......@@ -16,32 +16,4 @@
$('textarea').attr('rows', 5);
});
// Sweet Alert for Delete
// Todo: Change name to objectDelete(obj, name, url)
function objectDelete(obj, name, url){
swal({
title: "{% trans 'Are you sure delete ?' %}",
text: "【" + name + "】",
type: "warning",
showCancelButton: true,
cancelButtonText: "{% trans 'Cancel' %}",
confirmButtonColor: "#DD6B55",
confirmButtonText: "{% trans 'Yes, delete it!' %}",
closeOnConfirm: false
}, function () {
$.ajax({
type : "post",
url : url,
data : {
},
dataType : "text",
success : function(data) {
swal("{% trans 'Deleted!' %}", "【"+name+"】"+"{% trans 'has been deleted.' %}", "success");
$(obj).parent().parent().remove();
}
})
});
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment