VoidForum/src/main/resources/templates/account/posts/index.jade

76 lines
2.3 KiB
Plaintext

extends ../layout/account
block content
h1 Posts
hr
a.btn.btn-primary(href="/account/posts/new") Create
.row(style="margin-top: 10px;")
.col-sm-12
table.table.table-bordered.table-hover.table-stripped
thead
tr
th ID
th Deleted
th Censored
th Title
th Format
th Status
th Permalink
th Created At
th Updated At
th.operations Operations
tbody
for post in posts
tr
td #{post.getId()}
td #{post.getDeletedMark()}
td #{post.getCensored()}
td #{post.getTitle()}
td #{post.getPostFormat()}
td #{post.getPostStatus()}
td #{post.getPermalink()}
td #{post.getCreatedAt()}
td #{post.getUpdatedAt()}
td.operations
a.btn.btn-xs.btn-info(href="/posts/#{post.getId()}", target='_blank')
i.fa.fa-eye
a.btn.btn-xs.btn-primary(href="/account/posts/#{post.getId()}/edit")
i.fa.fa-edit
a.btn.btn-xs.btn-danger.btn-delete(href="javascript:deletePost(#{post.id})", postId="#{post.id}")
i.fa.fa-trash-o
form(id="form-#{post.getId()}",style="visibility: hidden", method="post", action="/account/posts/#{post.getId()}/delete")
input(type="hidden", name='_csrf', value='#{_csrf.token}')
.col-sm-12
div#pagination
script
:javascript
function deletePost(postId){
if (confirm("Are you sure to delete post #"+postId)) {
$('#form-'+postId).submit();
}
}
$(function(){
var page = #{page};
// Use bootstrap paginator
// Ref. http://lyonlai.github.io/bootstrap-paginator/
if(page>1){
var options = {
currentPage: #{page} + 1,
totalPages: #{totalPages},
pageUrl: function(type, page, current){
return document.location.pathname+'?page='+page;
}
}
$('#pagination').bootstrapPaginator(options);
}
});