{% load i18n %}
{% load static %}
<!-- Mainly scripts -->
<script src="{% static "js/plugins/metisMenu/jquery.metisMenu.js" %}"></script>

<!-- Custom and plugin javascript -->
<script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script>
<script src="{% static "js/inspinia.js" %}"></script>
<script src="{% static "js/jumpserver.js" %}"></script>
<script>
    activeNav();
    $(document).ready(function(){
        setAjaxCSRFToken();

        // Set textarea rows five
        $('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>
