增加清理附件按钮,对悬空无引用的图片/附件进行清理 (#918)

* add attach_clean & change_theme

* add attach_clean & change_theme

* add

* add readme

---------

Co-authored-by: root <root@DESKTOP-L84EQPB.localdomain>
This commit is contained in:
Sharklet
2023-12-19 13:19:31 +08:00
committed by GitHub
parent 0dbb5d7967
commit 71b8e528ff
13 changed files with 200 additions and 18 deletions

View File

@@ -27,8 +27,9 @@
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<div class="box-head" id="attachAll">
<strong class="box-title">{{i18n .Lang "mgr.attachment_mgr"}}</strong>
<button type="button" data-method="clean" class="btn btn-danger btn-sm" data-loading-text="{{i18n $.Lang "message.processing"}}">{{i18n $.Lang "common.clean"}}</button>
</div>
</div>
<div class="box-body">
@@ -104,6 +105,29 @@
}
});
});
$("#attachAll").on("click","button[data-method='clean']",function () {
var $this = $(this);
$(this).button("loading");
$.ajax({
url : "{{urlfor "ManagerController.AttachClean"}}",
type : "post",
dataType : "json",
success : function (res) {
if(res.errcode === 0){
alert("done");
}else {
layer.msg(res.message);
}
},
error : function () {
layer.msg({{i18n .Lang "message.system_error"}});
},
complete : function () {
$this.button("reset");
}
});
});
});
</script>
</body>