Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java
pull/137/head
johnniang 2019-03-11 16:56:19 +08:00
commit 97833dacd9
19 changed files with 227 additions and 54 deletions

View File

@ -0,0 +1,19 @@
package cc.ryanc.halo.model.dto;
import cc.ryanc.halo.model.domain.Attachment;
import cc.ryanc.halo.model.dto.base.AbstractOutputConverter;
import lombok.Data;
/**
* @author : RYAN0UP
* @date : 2019-03-10
*/
@Data
public class AttachmentAdminOutputDTO extends AbstractOutputConverter<AttachmentAdminOutputDTO, Attachment> {
private Long attachId;
private String attachPath;
private String attachSmallPath;
}

View File

@ -0,0 +1,34 @@
package cc.ryanc.halo.model.dto;
import cc.ryanc.halo.model.domain.Comment;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.dto.base.AbstractOutputConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @author : RYAN0UP
* @date : 2019-03-09
*/
@Data
public class CommentAdminOutputDTO extends AbstractOutputConverter<CommentAdminOutputDTO, Comment> {
private Long commentId;
private Post post;
private String commentAuthor;
private String commentAuthorUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date commentDate;
private String commentContent;
private Integer commentStatus;
private Integer isAdmin;
}

View File

@ -0,0 +1,44 @@
package cc.ryanc.halo.model.dto;
import cc.ryanc.halo.model.domain.Category;
import cc.ryanc.halo.model.domain.Comment;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.Tag;
import cc.ryanc.halo.model.dto.base.AbstractOutputConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* Post admin output dto.
*
* @author johnniang
*/
@Data
public class PostAdminOutputDTO extends AbstractOutputConverter<PostAdminOutputDTO, Post> {
private Long postId;
private String postTitle;
private String postType;
private String postUrl;
private List<Category> categories;
private List<Tag> tags;
private List<Comment> comments;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date postDate;
private Integer postStatus;
private Long postViews;
private Integer postPriority;
}

View File

@ -0,0 +1,48 @@
package cc.ryanc.halo.model.dto;
import cc.ryanc.halo.model.domain.*;
import cc.ryanc.halo.model.dto.base.AbstractOutputConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* Post output dto for post list
*
* @author johnniang
*/
@Data
public class PostListOutputDTO extends AbstractOutputConverter<PostListOutputDTO, Post> {
private Long postId;
private User user;
private String postTitle;
private String postUrl;
private String postSummary;
private List<Category> categories;
private List<Tag> tags;
private List<Comment> comments;
private String postThumbnail;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date postDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date postUpdate;
private Long postViews;
private Integer allowComment;
private Integer postPriority;
}

View File

@ -1,6 +1,7 @@
package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Attachment;
import cc.ryanc.halo.model.dto.AttachmentAdminOutputDTO;
import cc.ryanc.halo.model.enums.PostTypeEnum;
import cc.ryanc.halo.model.enums.ResultCodeEnum;
import cc.ryanc.halo.model.support.JsonResult;
@ -60,7 +61,8 @@ public class AttachmentController {
@GetMapping
public String attachments(Model model,
@PageableDefault(size = 18, sort = "attachId", direction = Sort.Direction.DESC) Pageable pageable) {
final Page<Attachment> attachments = attachmentService.listAll(pageable);
final Page<AttachmentAdminOutputDTO> attachments = attachmentService.listAll(pageable)
.map(attachment -> new AttachmentAdminOutputDTO().convertFrom(attachment));
model.addAttribute("attachments", attachments);
return "admin/admin_attachment";
}
@ -76,7 +78,8 @@ public class AttachmentController {
@PageableDefault(size = 18, sort = "attachId", direction = Sort.Direction.DESC) Pageable pageable,
@RequestParam(value = "id", defaultValue = "none") String id,
@RequestParam(value = "type", defaultValue = "normal") String type) {
final Page<Attachment> attachments = attachmentService.listAll(pageable);
final Page<AttachmentAdminOutputDTO> attachments = attachmentService.listAll(pageable)
.map(attachment -> new AttachmentAdminOutputDTO().convertFrom(attachment));
model.addAttribute("attachments", attachments);
model.addAttribute("id", id);
if (StrUtil.equals(type, PostTypeEnum.POST_TYPE_POST.getDesc())) {

View File

@ -3,6 +3,7 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Comment;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.CommentAdminOutputDTO;
import cc.ryanc.halo.model.support.JsonResult;
import cc.ryanc.halo.model.enums.*;
import cc.ryanc.halo.service.CommentService;
@ -67,7 +68,8 @@ public class CommentController extends BaseController {
public String comments(Model model,
@PageableDefault(sort = "commentDate", direction = Sort.Direction.DESC) Pageable pageable,
@RequestParam(value = "status", defaultValue = "0") Integer status) {
final Page<Comment> comments = commentService.findAll(status, pageable);
final Page<CommentAdminOutputDTO> comments = commentService.findAll(status, pageable)
.map(comment -> new CommentAdminOutputDTO().convertFrom(comment));
model.addAttribute("comments", comments);
model.addAttribute("publicCount", commentService.getCountByStatus(CommentStatusEnum.PUBLISHED.getCode()));
model.addAttribute("checkCount", commentService.getCountByStatus(CommentStatusEnum.CHECKING.getCode()));

View File

@ -2,13 +2,14 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.PostAdminOutputDTO;
import cc.ryanc.halo.model.dto.PostViewOutputDTO;
import cc.ryanc.halo.model.support.JsonResult;
import cc.ryanc.halo.model.support.LogsRecord;
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
import cc.ryanc.halo.model.enums.PostStatusEnum;
import cc.ryanc.halo.model.enums.PostTypeEnum;
import cc.ryanc.halo.model.enums.ResultCodeEnum;
import cc.ryanc.halo.model.support.JsonResult;
import cc.ryanc.halo.model.support.LogsRecord;
import cc.ryanc.halo.service.LogsService;
import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.utils.BeanUtils;
@ -22,9 +23,10 @@ import cn.hutool.crypto.SecureUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.ServletRequestDataBinder;
@ -92,11 +94,14 @@ public class PostController extends BaseController {
@GetMapping
public String posts(Model model,
@RequestParam(value = "status", defaultValue = "0") Integer status,
@PageableDefault(sort = "postDate", direction = DESC) Pageable pageable) {
final Page<Post> posts = postService.findPostByStatus(status, PostTypeEnum.POST_TYPE_POST.getDesc(), pageable);
Page<PostViewOutputDTO> postViewOutputDTOS = posts.map(post -> new PostViewOutputDTO().convertFrom(post));
@RequestParam(value = "page", defaultValue = "0") Integer page,
@SortDefault.SortDefaults({
@SortDefault(sort = "postPriority", direction = DESC),
@SortDefault(sort = "postDate", direction = DESC)
}) Sort sort) {
final Pageable pageable = PageRequest.of(page, 10, sort);
final Page<PostAdminOutputDTO> posts = postService.findPostByStatus(status, PostTypeEnum.POST_TYPE_POST.getDesc(), pageable)
.map(post -> new PostAdminOutputDTO().convertFrom(post));
model.addAttribute("posts", posts);
model.addAttribute("publishCount", postService.getCountByStatus(PostStatusEnum.PUBLISHED.getCode()));
model.addAttribute("draftCount", postService.getCountByStatus(PostStatusEnum.DRAFT.getCode()));
@ -260,6 +265,22 @@ public class PostController extends BaseController {
return "redirect:/admin/page";
}
/**
* /
*
* @param postId postId
* @param priority priority
* @return JsonResult
*/
@GetMapping(value = "/topPost")
public String topPost(@RequestParam("postId") Long postId,
@RequestParam("priority") Integer priority) {
Post post = postService.getById(postId);
post.setPostPriority(priority);
postService.update(post);
return "redirect:/admin/posts";
}
/**
*
*

View File

@ -3,8 +3,9 @@ package cc.ryanc.halo.web.controller.front;
import cc.ryanc.halo.model.domain.Comment;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.Tag;
import cc.ryanc.halo.model.support.ListPage;
import cc.ryanc.halo.model.dto.PostListOutputDTO;
import cc.ryanc.halo.model.enums.*;
import cc.ryanc.halo.model.support.ListPage;
import cc.ryanc.halo.service.CommentService;
import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.utils.CommentUtil;
@ -79,7 +80,8 @@ public class FrontArchiveController extends BaseController {
@SortDefault(sort = "postDate", direction = DESC) Sort sort) {
//所有文章数据分页material主题适用
final Pageable pageable = PageRequest.of(page - 1, 5, sort);
final Page<Post> posts = postService.findPostByStatus(PostStatusEnum.PUBLISHED.getCode(), PostTypeEnum.POST_TYPE_POST.getDesc(), pageable);
final Page<PostListOutputDTO> posts = postService.findPostByStatus(PostStatusEnum.PUBLISHED.getCode(), PostTypeEnum.POST_TYPE_POST.getDesc(), pageable)
.map(post -> new PostListOutputDTO().convertFrom(post));
if (null == posts) {
return this.renderNotFound();
}
@ -100,7 +102,8 @@ public class FrontArchiveController extends BaseController {
public String archives(Model model,
@PathVariable(value = "year") String year,
@PathVariable(value = "month") String month) {
final Page<Post> posts = postService.findPostByYearAndMonth(year, month, null);
final Page<PostListOutputDTO> posts = postService.findPostByYearAndMonth(year, month, null)
.map(post -> new PostListOutputDTO().convertFrom(post));
if (null == posts) {
return this.renderNotFound();
}

View File

@ -2,6 +2,7 @@ package cc.ryanc.halo.web.controller.front;
import cc.ryanc.halo.model.domain.Category;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.dto.PostListOutputDTO;
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
import cc.ryanc.halo.service.CategoryService;
import cc.ryanc.halo.service.PostService;
@ -91,7 +92,8 @@ public class FrontCategoryController extends BaseController {
size = Integer.parseInt(OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()));
}
final Pageable pageable = PageRequest.of(page - 1, size, sort);
final Page<Post> posts = postService.findPostByCategories(category, pageable);
final Page<PostListOutputDTO> posts = postService.findPostByCategories(category, pageable)
.map(post -> new PostListOutputDTO().convertFrom(post));
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
model.addAttribute("is_categories", true);
model.addAttribute("posts", posts);

View File

@ -1,6 +1,6 @@
package cc.ryanc.halo.web.controller.front;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.dto.PostListOutputDTO;
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.web.controller.core.BaseController;
@ -71,7 +71,8 @@ public class FrontIndexController extends BaseController {
}
//所有文章数据,分页
final Pageable pageable = PageRequest.of(page - 1, size, sort);
final Page<Post> posts = postService.findPostByStatus(pageable);
final Page<PostListOutputDTO> posts = postService.findPostByStatus(pageable)
.map(post -> new PostListOutputDTO().convertFrom(post));
if (null == posts) {
return this.renderNotFound();
}

View File

@ -1,7 +1,7 @@
package cc.ryanc.halo.web.controller.front;
import cc.ryanc.halo.logging.Logger;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.dto.PostListOutputDTO;
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
import cc.ryanc.halo.model.enums.PostStatusEnum;
import cc.ryanc.halo.model.enums.PostTypeEnum;
@ -74,7 +74,8 @@ public class FrontSearchController extends BaseController {
size = Integer.parseInt(OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()));
}
final Pageable pageable = PageRequest.of(page - 1, size, sort);
final Page<Post> posts = postService.searchPosts(HtmlUtil.escape(keyword), PostTypeEnum.POST_TYPE_POST.getDesc(), PostStatusEnum.PUBLISHED.getCode(), pageable);
final Page<PostListOutputDTO> posts = postService.searchPosts(HtmlUtil.escape(keyword), PostTypeEnum.POST_TYPE_POST.getDesc(), PostStatusEnum.PUBLISHED.getCode(), pageable)
.map(post -> new PostListOutputDTO().convertFrom(post));
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
model.addAttribute("is_search", true);
model.addAttribute("keyword", keyword);

View File

@ -2,6 +2,7 @@ package cc.ryanc.halo.web.controller.front;
import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.Tag;
import cc.ryanc.halo.model.dto.PostListOutputDTO;
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.service.TagService;
@ -86,7 +87,8 @@ public class FrontTagController extends BaseController {
size = Integer.parseInt(OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()));
}
final Pageable pageable = PageRequest.of(page - 1, size, sort);
final Page<Post> posts = postService.findPostsByTags(tag, pageable);
final Page<PostListOutputDTO> posts = postService.findPostsByTags(tag, pageable)
.map(post -> new PostListOutputDTO().convertFrom(post));
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
model.addAttribute("is_tags", true);
model.addAttribute("posts", posts);

View File

@ -64,16 +64,16 @@
<#switch comment.commentStatus>
<#case 0>
<button class="btn btn-primary btn-xs " onclick="replyShow('${comment.commentId?c}','${comment.post.postId?c}')" <#if comment.isAdmin==1>disabled</#if>><@spring.message code="common.btn.reply" /></button>
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId?c}&status=0&page=${comments.number}','<@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/comments/throw?commentId=${comment.commentId?c}&status=0&page=${comments.number}','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code="common.btn.recycling" /></button>
<#break >
<#case 1>
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId?c}&status=1"><@spring.message code="common.btn.pass" /></a>
<button class="btn btn-info btn-xs " onclick="replyShow('${comment.commentId?c}','${comment.post.postId?c}')"><@spring.message code="common.btn.pass-reply" /></button>
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId?c}&status=1&page=${comments.number}','<@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/comments/throw?commentId=${comment.commentId?c}&status=1&page=${comments.number}','<@spring.message code="common.text.tips.to-recycle-bin" />')"><@spring.message code="common.btn.recycling" /></button>
<#break >
<#case 2>
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId?c}&status=2"><@spring.message code="common.btn.reduction" /></a>
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/remove?commentId=${comment.commentId?c}&status=2&page=${comments.number}','<@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/comments/remove?commentId=${comment.commentId?c}&status=2&page=${comments.number}','<@spring.message code="common.text.tips.to-delete" />')"><@spring.message code="common.btn.delete" /></button>
<#break >
</#switch>
</td>
@ -164,7 +164,7 @@
maxHeight: '210px',
api:"/static/halo-common/OwO/OwO.min.json"
});
function modelShow(url,message) {
function modalShow(url,message) {
$('#url').val(url);
$('#message').html(message);
$('#removeCommentModal').modal();

View File

@ -176,7 +176,7 @@
<#else>
<a data-pjax="true" href="/admin/menus/edit?menuId=${menu.menuId?c}" class="btn btn-primary btn-xs "><@spring.message code='common.btn.modify' /></a>
</#if>
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/menus/remove?menuId=${menu.menuId?c}')"><@spring.message code='common.btn.delete' /></button>
<button class="btn btn-danger btn-xs " onclick="modalShow('/admin/menus/remove?menuId=${menu.menuId?c}')"><@spring.message code='common.btn.delete' /></button>
</td>
</tr>
</#list>
@ -209,7 +209,7 @@
</div>
<@footer>
<script type="application/javascript" id="footer_script">
function modelShow(url) {
function modalShow(url) {
$('#url').val(url);
$('#removeMenuModal').modal();
}

View File

@ -95,7 +95,7 @@
<td>${page.postDate?string("yyyy-MM-dd HH:mm")}</td>
<td>
<a data-pjax="true" href="/admin/page/edit?pageId=${page.postId?c}" class="btn btn-primary btn-xs "><@spring.message code='common.btn.edit' /></a>
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/remove?postId=${page.postId?c}&postType=${page.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=${page.postId?c}&postType=${page.postType}','<@spring.message code="common.text.tips.to-delete" />')"><@spring.message code='common.btn.delete' /></button>
</td>
</tr>
</#list>
@ -135,7 +135,7 @@
</div>
<@footer>
<script type="application/javascript" id="footer_script">
function modelShow(url,message) {
function modalShow(url,message) {
$('#url').val(url);
$('#message').html(message);
$('#removePostModal').modal();

View File

@ -102,7 +102,7 @@
<#else >
<a data-pjax="true" class="btn btn-primary btn-xs" href="/admin/page/links/edit?linkId=${link.linkId?c}"><@spring.message code='common.btn.modify' /></a>
</#if>
<button class="btn btn-danger btn-xs" onclick="modelShow('/admin/page/links/remove?linkId=${link.linkId?c}')"><@spring.message code='common.btn.delete' /></>
<button class="btn btn-danger btn-xs" onclick="modalShow('/admin/page/links/remove?linkId=${link.linkId?c}')"><@spring.message code='common.btn.delete' /></>
</td>
</tr>
</#list>
@ -135,7 +135,7 @@
</div>
<@footer>
<script type="application/javascript" id="footer_script">
function modelShow(url) {
function modalShow(url) {
$('#url').val(url);
$('#removeLinkModal').modal();
}

View File

@ -92,18 +92,23 @@
<td>
<#switch post.postStatus>
<#case 0>
<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="modelShow('/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>
<#if post.postPriority == 0>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.postId?c}&priority=1','是否置顶该文章?')">置顶</button>
<#else>
<button class="btn btn-primary btn-xs" onclick="modalShow('/admin/posts/topPost?postId=${post.postId?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>
<#break >
<#case 1>
<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-primary btn-xs " onclick="modelShow('/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="modelShow('/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>
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>
<#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="modelShow('/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.postId?c}&postType=${post.postType}','<@spring.message code="common.text.tips.to-delete" />')"><@spring.message code='common.btn.delete' /></button>
<#break >
</#switch>
</td>
@ -154,7 +159,7 @@
<div class="modal-footer">
<input type="hidden" id="url"/>
<button type="button" class="btn btn-default" data-dismiss="modal"><@spring.message code='common.btn.cancel' /></button>
<a onclick="removeIt()" class="btn btn-danger" data-dismiss="modal"><@spring.message code='common.btn.define' /></a>
<a onclick="modalAction()" class="btn btn-danger" data-dismiss="modal"><@spring.message code='common.btn.define' /></a>
</div>
</div>
</div>
@ -162,12 +167,12 @@
</div>
<@footer>
<script type="application/javascript" id="footer_script">
function modelShow(url,message) {
function modalShow(url,message) {
$('#url').val(url);
$('#message').html(message);
$('#removePostModal').modal();
}
function removeIt(){
function modalAction(){
var url=$.trim($("#url").val());
<#if (options.admin_pjax!'true') == 'true'>
pjax.loadUrl(url);

View File

@ -120,18 +120,6 @@
</div>
<@footer>
<script type="application/javascript" id="footer_script">
function modelShow(url) {
$('#url').val(url);
$('#removeCateModal').modal();
}
function removeIt(){
var url=$.trim($("#url").val());
<#if (options.admin_pjax!'true') == 'true'>
pjax.loadUrl(url);
<#else>
window.location.href = url;
</#if>
}
function save() {
var param = $("#tagSaveForm").serialize();
$.post("/admin/tag/save",param,function (data) {

View File

@ -49,7 +49,7 @@
<div class="col-md-6 col-lg-3 col theme-body">
<div class="box box-solid">
<div class="box-body theme-thumbnail" style="background-image: url(/${theme.themeName!}/screenshot.png)">
<div class="pull-right btn-delete" style="display: none" onclick="modelShow('/admin/themes/remove?themeName=${theme.themeName}')"><i class="fa fa-times fa-lg" aria-hidden="true"></i></div>
<div class="pull-right btn-delete" style="display: none" onclick="modalShow('/admin/themes/remove?themeName=${theme.themeName}')"><i class="fa fa-times fa-lg" aria-hidden="true"></i></div>
</div>
<div class="box-footer">
<span class="theme-title">
@ -128,7 +128,7 @@
$(this).find(".theme-thumbnail").css("opacity","1");
$(this).find(".btn-theme-setting,.btn-theme-enable,.btn-theme-update").hide();
});
function modelShow(url) {
function modalShow(url) {
$('#url').val(url);
$('#removeThemeModal').modal();
}