From c159353b68aea20369ae3625987514a64a2ea412 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Fri, 15 Mar 2019 10:21:29 +0800 Subject: [PATCH] complate some page --- .../model/dto/post/PostMinimalOutputDTO.java | 8 +++- .../web/controller/admin/PostController.java | 2 +- .../resources/templates/admin/admin_index.ftl | 18 ++++----- .../resources/templates/admin/admin_post.ftl | 32 ++++++++-------- .../resources/templates/admin/error/404.ftl | 38 +++++++++++++++++++ .../resources/templates/admin/error/500.ftl | 38 +++++++++++++++++++ 6 files changed, 109 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/templates/admin/error/404.ftl create mode 100644 src/main/resources/templates/admin/error/500.ftl diff --git a/src/main/java/cc/ryanc/halo/model/dto/post/PostMinimalOutputDTO.java b/src/main/java/cc/ryanc/halo/model/dto/post/PostMinimalOutputDTO.java index 7332ce78e..2959230cb 100644 --- a/src/main/java/cc/ryanc/halo/model/dto/post/PostMinimalOutputDTO.java +++ b/src/main/java/cc/ryanc/halo/model/dto/post/PostMinimalOutputDTO.java @@ -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 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)); diff --git a/src/main/resources/templates/admin/admin_index.ftl b/src/main/resources/templates/admin/admin_index.ftl index f799954bc..1ea5b5d2a 100755 --- a/src/main/resources/templates/admin/admin_index.ftl +++ b/src/main/resources/templates/admin/admin_index.ftl @@ -9,7 +9,7 @@ @@ -214,15 +214,15 @@ <#if latestPosts??> <#list latestPosts as post> - <#if post.postStatus == 0> - ${post.title} + <#if post.status == 0> + ${post.title} <#else > ${post.title} - <#if post.postStatus==0> + <#if post.status==0> <@spring.message code='common.status.published' /> - <#elseif post.postStatus==1> + <#elseif post.status==1> <@spring.message code='common.status.draft' /> <#else> <@spring.message code='common.status.recycle-bin' /> @@ -266,17 +266,17 @@ ${comment.author!} - <#if comment.post.type=="post"> - ${comment.post.title!} + <#if comment.post.type.getValue()==0> + ${comment.post.title!} <#else> - ${comment.post.title!} + ${comment.post.title!} ${comment.content!} - <#switch comment.commentStatus> + <#switch comment.status> <#case 0> <@spring.message code='common.status.published' /> <#break > diff --git a/src/main/resources/templates/admin/admin_post.ftl b/src/main/resources/templates/admin/admin_post.ftl index 264dd84cf..622479f03 100755 --- a/src/main/resources/templates/admin/admin_post.ftl +++ b/src/main/resources/templates/admin/admin_post.ftl @@ -58,10 +58,10 @@ <#list posts.content as post> - <#if post.postStatus==0> - ${post.postTitle} + <#if post.status==0> + ${post.title!} <#else> - ${post.postTitle} + ${post.title!} @@ -86,29 +86,29 @@ ${post.getComments()?size} - ${post.postViews} + ${post.visits!0} - ${post.postDate!?string("yyyy-MM-dd HH:mm")} + ${post.createTime!?string("yyyy-MM-dd HH:mm")} - <#switch post.postStatus> + <#switch post.status> <#case 0> - <#if post.postPriority == 0> - + <#if post.topPriority == 0> + <#else> - + - <@spring.message code='common.btn.edit' /> - + <@spring.message code='common.btn.edit' /> + <#break > <#case 1> - <@spring.message code="common.btn.edit" /> - - + + <#break > <#case 2> - <@spring.message code='common.btn.reduction' /> - + <@spring.message code='common.btn.reduction' /> + <#break > diff --git a/src/main/resources/templates/admin/error/404.ftl b/src/main/resources/templates/admin/error/404.ftl new file mode 100644 index 000000000..91a8596d5 --- /dev/null +++ b/src/main/resources/templates/admin/error/404.ftl @@ -0,0 +1,38 @@ +<#compress > +<#include "../module/_macro.ftl"> +<@head>${options.blog_title!} | 404 +
+ +
+

+ 404 Error Page +

+ +
+ + +
+
+

404

+ +
+

Oops! Page not found.

+ +

+ We could not find the page you were looking for. + Meanwhile, you may return to dashboard or try using the search form. +

+
+
+
+
+<@footer> + + + diff --git a/src/main/resources/templates/admin/error/500.ftl b/src/main/resources/templates/admin/error/500.ftl new file mode 100644 index 000000000..ef22ca39e --- /dev/null +++ b/src/main/resources/templates/admin/error/500.ftl @@ -0,0 +1,38 @@ +<#compress > +<#include "../module/_macro.ftl"> +<@head>${options.blog_title!} | 500 +
+ +
+

+ 500 Error Page +

+ +
+ + +
+
+

500

+ +
+

Oops! Something went wrong.

+ +

+ We could not find the page you were looking for. + Meanwhile, you may return to dashboard or try using the search form. +

+
+
+
+
+<@footer> + + +