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.dto.base.OutputConverter;
import cc.ryanc.halo.model.entity.Post; import cc.ryanc.halo.model.entity.Post;
import cc.ryanc.halo.model.enums.PostStatus; import cc.ryanc.halo.model.enums.PostStatus;
import cc.ryanc.halo.model.enums.PostType;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@ -23,7 +24,7 @@ public class PostMinimalOutputDTO implements OutputConverter<PostMinimalOutputDT
private Integer id; private Integer id;
/** /**
* * Post title
*/ */
private String title; private String title;
@ -36,4 +37,9 @@ public class PostMinimalOutputDTO implements OutputConverter<PostMinimalOutputDT
* Post url. * Post url.
*/ */
private String 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) { @RequestParam(value = "status", defaultValue = "published") PostStatus status) {
final Page<PostSimpleOutputDTO> postPage = postService.pageByStatusAndType(status, PostType.POST, pageable); 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("publishedCount", postService.countByStatusAndType(PostStatus.PUBLISHED, PostType.POST));
model.addAttribute("draftCount", postService.countByStatusAndType(PostStatus.DRAFT, PostType.POST)); model.addAttribute("draftCount", postService.countByStatusAndType(PostStatus.DRAFT, PostType.POST));
model.addAttribute("recycleCount", postService.countByStatusAndType(PostStatus.RECYCLE, PostType.POST)); model.addAttribute("recycleCount", postService.countByStatusAndType(PostStatus.RECYCLE, PostType.POST));

View File

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

View File

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