Skip to content

Commit

Permalink
Merge pull request otale#23 from pkwenda/master
Browse files Browse the repository at this point in the history
🦄  optimization of pop
  • Loading branch information
hellokaton authored Feb 26, 2017
2 parents 43e7c01 + fb01398 commit 1f0763a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 123 deletions.
27 changes: 27 additions & 0 deletions src/main/resources/static/admin/js/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var _swal = {
alert_del:function(data){
swal({
title: data.title || '警告信息' ,
text: data.text || "确定删除吗?" ,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post(data.url, data.parame, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
}).catch(swal.noop);
}
};


24 changes: 4 additions & 20 deletions src/main/resources/templates/admin/article_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,11 @@ <h4 class="page-title">文章管理</h4>

<script type="text/javascript">
function delPost(cid) {
swal({
title: '警告信息',
_swal.alert_del({
text: "确定删除这篇文章吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/article/delete', {cid: cid}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
});
url: "/admin/article/delete",
parame: {cid: cid}
})
}
</script>

Expand Down
26 changes: 5 additions & 21 deletions src/main/resources/templates/admin/attach.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,11 @@ <h4 class="page-title">文件管理</h4>
});

function delAttach(id) {
swal({
title: '警告信息',
text: "确定删除这个附件吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/attach/delete', {id: id}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
});
_swal.alert_del({
text: "确定删除该附件吗?",
url: "/admin/attach/delete",
parame: {id: id}
})
}
</script>
</body>
Expand Down
24 changes: 4 additions & 20 deletions src/main/resources/templates/admin/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,11 @@ <h1 class="panel-title">标签列表</h1>

$('.del-category').click(function () {
var mid = $(this).attr('mid');
swal({
title: '警告信息',
_swal.alert_del({
text: "确定删除该项吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/category/delete', {mid: mid}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
});
url: "/admin/category/delete",
parame: {mid: mid}
})
});

</script>
Expand Down
24 changes: 4 additions & 20 deletions src/main/resources/templates/admin/comment_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,11 @@ <h4 class="page-title">评论管理</h4>
}

function delComment(coid) {
swal({
title: '警告信息',
_swal.alert_del({
text: "确定删除该评论吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/comments/delete', {coid: coid}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
});
url: "/admin/comments/delete",
parame: {coid: coid}
})
}

function updateStatus(coid, status) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/templates/admin/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
<script src="//cdn.bootcss.com/jquery/2.2.3/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//cdn.bootcss.com/limonte-sweetalert2/6.4.1/sweetalert2.min.js"></script>
<script src="/static/admin/js/jquery.app.js?v=${version}"></script>
<script src="/static/admin/js/jquery.app.js?v=${version}"></script>
<script src="/static/admin/js/base.js"></script>

25 changes: 5 additions & 20 deletions src/main/resources/templates/admin/links.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,13 @@ <h4 class="page-title">友链管理</h4>
}

function delLink(mid) {
swal({
title: '警告信息',
_swal.alert_del({
text: "确定删除该链接吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/links/delete', {mid: mid}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
});
url: "/admin/links/delete",
parame: {mid: mid}
})
}

</script>
</body>
</html>
27 changes: 6 additions & 21 deletions src/main/resources/templates/admin/page_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,13 @@ <h4 class="page-title">文章管理</h4>

<script type="text/javascript">
function delPost(cid) {
swal({
title: '警告信息',
text: "确定删除这个页面吗?",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
$.post('/admin/page/delete', {cid: cid}, function (result) {
if (result && result.success) {
swal('提示信息', '删除成功', 'success');
setTimeout(function () {
window.location.reload();
}, 2000);
} else {
swal("提示消息", result.msg, 'error');
}
});
}).catch(swal.noop);
_swal.alert_del({
text:"确定删除这个页面吗?",
url:"/admin/page/delete",
parame:{cid: cid}
})
}

</script>

</body>
Expand Down

0 comments on commit 1f0763a

Please sign in to comment.