Move js to jumpserver.js

pull/530/head
ibuler 8 years ago
parent b2444c2aca
commit 766bd3b76d

@ -17,7 +17,6 @@ from django.conf.urls import url, include
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.http import HttpResponseRedirect
urlpatterns = [ urlpatterns = [

@ -214,4 +214,30 @@ function APIUpdateAttr(props) {
return true; 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 = {}; var jumpserver = {};

@ -16,32 +16,4 @@
$('textarea').attr('rows', 5); $('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> </script>

Loading…
Cancel
Save