From 8ee9d02ffca75b4a9199a223a3c34f5b417444e4 Mon Sep 17 00:00:00 2001
From: Webb <343306138@qq.com>
Date: Fri, 24 Feb 2017 21:29:11 +0800
Subject: [PATCH] fixed html
---
.../assets/_asset_bulk_update_modal.html | 4 ---
apps/assets/templates/assets/asset_list.html | 36 +++++++++++++++++--
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/apps/assets/templates/assets/_asset_bulk_update_modal.html b/apps/assets/templates/assets/_asset_bulk_update_modal.html
index 391fc5361..9ff3d2973 100644
--- a/apps/assets/templates/assets/_asset_bulk_update_modal.html
+++ b/apps/assets/templates/assets/_asset_bulk_update_modal.html
@@ -77,10 +77,6 @@
-
-
-
-
{% endblock %}
{% block modal_confirm_id %}btn_asset_bulk_update{% endblock %}
\ No newline at end of file
diff --git a/apps/assets/templates/assets/asset_list.html b/apps/assets/templates/assets/asset_list.html
index 66542986b..34924d7f7 100644
--- a/apps/assets/templates/assets/asset_list.html
+++ b/apps/assets/templates/assets/asset_list.html
@@ -32,7 +32,7 @@
{% for tag in tag_list %}
{% else %}
class="tagBtn2 label label-default">
@@ -104,6 +104,38 @@ function tagShow() {
}
} //onload;
+function objDelete(obj, name, url) {
+ function doDelete() {
+ var body = {};
+ var success = function() {
+ swal('Deleted!', "[ "+name+"]"+" has been deleted ", "success");
+ $(obj).parent().parent().remove();
+ };
+ var fail = function() {
+ swal("Failed", "Delete"+"[ "+name+" ]"+"failed", "error");
+ };
+ APIUpdateAttr({
+ url: url,
+ body: JSON.stringify(body),
+ method: 'DELETE',
+ success: success,
+ error: fail
+ });
+ }
+ swal({
+ title: 'Are you sure delete ?',
+ text: " [" + name + "] ",
+ type: "warning",
+ showCancelButton: true,
+ cancelButtonText: 'Cancel',
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: 'Confirm',
+ closeOnConfirm: false
+ }, function () {
+ doDelete()
+ });
+}
+
$(document).ready(function(){
var options = {
ele: $('#asset_list_table'),
@@ -186,7 +218,7 @@ $(document).ready(function(){
var name = $(this).closest("tr").find(":nth-child(2)").children('a').html();
var uid = $this.data('uid');
var the_url = '{% url "api-assets:asset-detail" pk=99991937 %}'.replace('99991937', uid);
- objectDelete($this, name, the_url);
+ objDelete($this, name, the_url);
$data_table.ajax.reload();
})