87 lines
2.8 KiB
HTML
87 lines
2.8 KiB
HTML
{{template "member/top.html" .}}
|
|
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "Single"}}</h3></div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-8">
|
|
<section class="panel panel-default">
|
|
<div class="panel-body">
|
|
<p>
|
|
{{msg $ "singleTips"}}
|
|
<a href="/member/blog/addOrUpdateSingle" id="addBtn" class="btn btn-success">{{msg $ "addSingle"}}</a>
|
|
</p>
|
|
<ul class="list-group gutter list-group-lg list-group-sp sortable">
|
|
{{range .singles}}
|
|
<li class="list-group-item" draggable="true" data-id="{{.SingleId}}">
|
|
<span class="pull-left media-xs"><i class="fa fa-sort text-muted fa m-r-sm"></i></span>
|
|
<span class="pull-right">
|
|
<a href="/member/blog/addOrUpdateSingle?singleId={{.SingleId}}"><i class="fa fa-pencil icon-muted fa-fw m-r-xs page-edit" data-id="{{.SingleId}}"></i></a>
|
|
<a href="#"><i class="fa fa-times icon-muted fa-fw page-delete" data-id="{{.SingleId}}"></i></a>
|
|
</span>
|
|
<div class="pull-right" style="margin-right: 10px">
|
|
{{msg $ "permanentLink"}}: /single/<input data-id="{{.SingleId}}" class="url-title" type="text" value="{{if .UrlTitle}}{{.UrlTitle|decodeUrlValue}}{{else}}{{.SingleId}}{{end}}"/>
|
|
</div>
|
|
<div class="clear">
|
|
{{.Title}}
|
|
</div>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</div>
|
|
{{if .singles}}
|
|
<footer class="panel-footer text-right bg-light lter">
|
|
<button type="submit" id="baseBtn" class="btn btn-success">{{msg . "saveSort"}}</button>
|
|
</footer>
|
|
{{end}}
|
|
</section>
|
|
</div>
|
|
|
|
</div>
|
|
{{template "member/footer.html" .}}
|
|
<script type="text/javascript" src="/public/member/js/jquery.sortable.js"></script>
|
|
<script>
|
|
$(function() {
|
|
$("#baseBtn").click(function(){
|
|
var ids = [];
|
|
$(".list-group-item").each(function() {
|
|
ids.push($(this).data("id"));
|
|
});
|
|
ajaxPost("/member/blog/sortSingles", {singleIds: ids}, function(re){
|
|
if(reIsOk(re)) {
|
|
art.tips(getMsg("Success"));
|
|
} else {
|
|
art.alert(re.Msg || getMsg("Error"));
|
|
}
|
|
});
|
|
});
|
|
|
|
$(".page-delete").click(function() {
|
|
var singleId = $(this).data('id');
|
|
art.confirm(getMsg("Are you sure ?"), function() {
|
|
ajaxPost("/member/blog/deleteSingle", {singleId: singleId}, function(re){
|
|
if(reIsOk(re)) {
|
|
art.tips(getMsg("Success"));
|
|
location.reload();
|
|
} else {
|
|
art.alert(re.Msg || getMsg("Error"));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
$(".url-title").change(function(){
|
|
var $t = $(this);
|
|
var url = $t.val();
|
|
var singleId = $t.data('id');
|
|
ajaxPost("/member/blog/updateSingleUrlTitle", {singleId: singleId, urlTitle: url}, function(re){
|
|
if(reIsOk(re)) {
|
|
$t.val(re.Item);
|
|
} else {
|
|
art.alert(re.Msg || getMsg("Error"));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
{{template "member/end.html" .}}
|