complate some page

pull/137/head
ruibaby 2019-03-15 10:21:29 +08:00
parent b2c933fe8b
commit c159353b68
6 changed files with 109 additions and 27 deletions

View File

@ -3,6 +3,7 @@ package cc.ryanc.halo.model.dto.post;
import cc.ryanc.halo.model.dto.base.OutputConverter;
import cc.ryanc.halo.model.entity.Post;
import cc.ryanc.halo.model.enums.PostStatus;
import cc.ryanc.halo.model.enums.PostType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ -23,7 +24,7 @@ public class PostMinimalOutputDTO implements OutputConverter<PostMinimalOutputDT
private Integer id;
/**
*
* Post title
*/
private String title;
@ -36,4 +37,9 @@ public class PostMinimalOutputDTO implements OutputConverter<PostMinimalOutputDT
* Post url.
*/
private String url;
/**
* Post type
*/
private PostType type;
}

View File

@ -45,7 +45,7 @@ public class PostController {
@RequestParam(value = "status", defaultValue = "published") PostStatus status) {
final Page<PostSimpleOutputDTO> postPage = postService.pageByStatusAndType(status, PostType.POST, pageable);
model.addAttribute("posts", postPage.getContent());
model.addAttribute("posts", postPage);
model.addAttribute("publishedCount", postService.countByStatusAndType(PostStatus.PUBLISHED, PostType.POST));
model.addAttribute("draftCount", postService.countByStatusAndType(PostStatus.DRAFT, PostType.POST));
model.addAttribute("recycleCount", postService.countByStatusAndType(PostStatus.RECYCLE, PostType.POST));

View File

@ -9,7 +9,7 @@
</a>
<ol class="breadcrumb">
<li>
<a href="/admin"><i class="fa fa-dashboard"></i> <@spring.message code='admin.index.bread.index' /></a>
<a href="/admin/"><i class="fa fa-dashboard"></i> <@spring.message code='admin.index.bread.index' /></a>
</li>
<li class="active"><@spring.message code='admin.index.bread.active' /></li>
</ol>
@ -214,15 +214,15 @@
<#if latestPosts??>
<#list latestPosts as post>
<tr>
<#if post.postStatus == 0>
<td><a target="_blank" href="/archives/${post.postUrl}">${post.title}</a></td>
<#if post.status == 0>
<td><a target="_blank" href="/archives/${post.url}">${post.title}</a></td>
<#else >
<td>${post.title}</td>
</#if>
<td class="text-center">
<#if post.postStatus==0>
<#if post.status==0>
<span class="label bg-green"><@spring.message code='common.status.published' /></span>
<#elseif post.postStatus==1>
<#elseif post.status==1>
<span class="label bg-yellow"><@spring.message code='common.status.draft' /></span>
<#else>
<span class="label bg-red"><@spring.message code='common.status.recycle-bin' /></span>
@ -266,17 +266,17 @@
<tr>
<td>${comment.author!}</td>
<td>
<#if comment.post.type=="post">
<a target="_blank" href="/archives/${comment.post.getPostUrl()}">${comment.post.title!}</a>
<#if comment.post.type.getValue()==0>
<a target="_blank" href="/archives/${comment.post.url}">${comment.post.title!}</a>
<#else>
<a target="_blank" href="/p/${comment.post.getPostUrl()}">${comment.post.title!}</a>
<a target="_blank" href="/p/${comment.post.url}">${comment.post.title!}</a>
</#if>
</td>
<td>
${comment.content!}
</td>
<td>
<#switch comment.commentStatus>
<#switch comment.status>
<#case 0>
<span class="label bg-green"><@spring.message code='common.status.published' /></span>
<#break >

View File

@ -58,10 +58,10 @@
<#list posts.content as post>
<tr>
<td>
<#if post.postStatus==0>
<a target="_blank" href="/archives/${post.postUrl}">${post.postTitle}</a>
<#if post.status==0>
<a target="_blank" href="/archives/${post.url!}">${post.title!}</a>
<#else>
${post.postTitle}
${post.title!}
</#if>
</td>
<td>
@ -86,29 +86,29 @@
<span class="label" style="background-color: #d6cdcd;">${post.getComments()?size}</span>
</td>
<td>
<span class="label" style="background-color: #d6cdcd;">${post.postViews}</span>
<span class="label" style="background-color: #d6cdcd;">${post.visits!0}</span>
</td>
<td>${post.postDate!?string("yyyy-MM-dd HH:mm")}</td>
<td>${post.createTime!?string("yyyy-MM-dd HH:mm")}</td>
<td>
<#switch post.postStatus>
<#switch post.status>
<#case 0>
<#if post.postPriority == 0>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.postId?c}&priority=1','是否置顶该文章?')">置顶</button>
<#if post.topPriority == 0>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.id?c}&priority=1','是否置顶该文章?')">置顶</button>
<#else>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.postId?c}&priority=0','是否取消置顶该文章?')">取消置顶</button>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.id?c}&priority=0','是否取消置顶该文章?')">取消置顶</button>
</#if>
<a data-pjax="true" href="/admin/posts/edit?postId=${post.postId?c}" class="btn btn-info btn-xs"><@spring.message code='common.btn.edit' /></a>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/throw?postId=${post.postId?c}&status=0','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code='common.btn.recycling' /></button>
<a data-pjax="true" href="/admin/posts/edit?postId=${post.id?c}" class="btn btn-info btn-xs"><@spring.message code='common.btn.edit' /></a>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/throw?postId=${post.id?c}&status=0','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code='common.btn.recycling' /></button>
<#break >
<#case 1>
<a data-pjax="true" href="/admin/posts/edit?postId=${post.postId?c}"
<a data-pjax="true" href="/admin/posts/edit?postId=${post.id?c}"
class="btn btn-info btn-xs"><@spring.message code="common.btn.edit" /></a>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/revert?postId=${post.postId?c}&status=1','<@spring.message code="common.text.tips.to-release-post" />')"><@spring.message code='common.btn.release' /></button>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/throw?postId=${post.postId?c}&status=1','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code='common.btn.recycling' /></button>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/revert?postId=${post.id?c}&status=1','<@spring.message code="common.text.tips.to-release-post" />')"><@spring.message code='common.btn.release' /></button>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/throw?postId=${post.id?c}&status=1','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code='common.btn.recycling' /></button>
<#break >
<#case 2>
<a data-pjax="true" href="/admin/posts/revert?postId=${post.postId?c}&status=2" class="btn btn-primary btn-xs "><@spring.message code='common.btn.reduction' /></a>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/remove?postId=${post.postId?c}&postType=${post.postType}','<@spring.message code="common.text.tips.to-delete" />')"><@spring.message code='common.btn.delete' /></button>
<a data-pjax="true" href="/admin/posts/revert?postId=${post.id?c}&status=2" class="btn btn-primary btn-xs "><@spring.message code='common.btn.reduction' /></a>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/posts/remove?postId=${post.id?c}&postType=${post.type}','<@spring.message code="common.text.tips.to-delete" />')"><@spring.message code='common.btn.delete' /></button>
<#break >
</#switch>
</td>

View File

@ -0,0 +1,38 @@
<#compress >
<#include "../module/_macro.ftl">
<@head>${options.blog_title!} | 404</@head>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
404 Error Page
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Error</a></li>
<li class="active">404 error</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="error-page">
<h2 class="headline text-yellow"> 404</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Page not found.</h3>
<p>
We could not find the page you were looking for.
Meanwhile, you may <a href="/admin/">return to dashboard</a> or try using the search form.
</p>
</div>
</div>
</section>
</div>
<@footer>
<script type="application/javascript" id="footer_script">
</script>
</@footer>
</#compress>

View File

@ -0,0 +1,38 @@
<#compress >
<#include "../module/_macro.ftl">
<@head>${options.blog_title!} | 500</@head>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
500 Error Page
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Error</a></li>
<li class="active">500 error</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="error-page">
<h2 class="headline text-yellow"> 500</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Something went wrong.</h3>
<p>
We could not find the page you were looking for.
Meanwhile, you may <a href="/admin/">return to dashboard</a> or try using the search form.
</p>
</div>
</div>
</section>
</div>
<@footer>
<script type="application/javascript" id="footer_script">
</script>
</@footer>
</#compress>