🎨 翻译部分页面

pull/33/merge
ruibaby 2018-09-14 21:44:30 +08:00
parent 6a4c3df64a
commit 0171365c30
24 changed files with 162 additions and 94 deletions

View File

@ -9,7 +9,7 @@
[![Travis CI](https://img.shields.io/travis/ruibaby/halo.svg)](https://travis-ci.org/ruibaby/halo)
------------------------------
[简体中文](./README.md) | English
🇨🇳[简体中文](./README.md) | 🇺🇸English
## Catalog

View File

@ -9,7 +9,7 @@
[![Travis CI](https://img.shields.io/travis/ruibaby/halo.svg)](https://travis-ci.org/ruibaby/halo)
------------------------------
简体中文 | [English](./README-en-US.md)
🇨🇳简体中文 | 🇺🇸[English](./README-en-US.md)
## 目录

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<version>2.0.4.RELEASE</version>
<relativePath/>
</parent>

View File

@ -190,8 +190,8 @@ public class AdminController extends BaseController {
@GetMapping(value = "/logOut")
public String logOut(HttpSession session) {
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
session.removeAttribute(HaloConst.USER_SESSION_KEY);
logsService.saveByLogs(new Logs(LogsRecord.LOGOUT, user.getUserName(), ServletUtil.getClientIP(request), DateUtil.date()));
session.invalidate();
log.info("用户[{}]退出登录", user.getUserName());
return "redirect:/admin/login";
}

View File

@ -26,7 +26,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.HashMap;
@ -193,7 +192,7 @@ public class AttachmentController {
* @return admin/widget/_attachment-detail
*/
@GetMapping(value = "/attachment")
public String attachmentDetail(Model model, @PathParam("attachId") Long attachId) {
public String attachmentDetail(Model model, @RequestParam("attachId") Long attachId) {
Optional<Attachment> attachment = attachmentService.findByAttachId(attachId);
model.addAttribute("attachment", attachment.get());
return "admin/widget/_attachment-detail";
@ -208,7 +207,7 @@ public class AttachmentController {
*/
@GetMapping(value = "/remove")
@ResponseBody
public JsonResult removeAttachment(@PathParam("attachId") Long attachId,
public JsonResult removeAttachment(@RequestParam("attachId") Long attachId,
HttpServletRequest request) {
Optional<Attachment> attachment = attachmentService.findByAttachId(attachId);
String delFileName = attachment.get().getAttachName();

View File

@ -1,14 +1,16 @@
package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Category;
import cc.ryanc.halo.model.dto.JsonResult;
import cc.ryanc.halo.model.enums.ResultCodeEnum;
import cc.ryanc.halo.service.CategoryService;
import cc.ryanc.halo.utils.LocaleMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.util.Optional;
/**
@ -27,6 +29,9 @@ public class CategoryController {
@Autowired
private CategoryService categoryService;
@Autowired
private LocaleMessageUtil localeMessageUtil;
/**
* category
*
@ -58,13 +63,16 @@ public class CategoryController {
*
*
* @param cateUrl
* @return truefalse
* @return JsonResult
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public boolean checkCateUrlExists(@RequestParam("cateUrl") String cateUrl) {
public JsonResult checkCateUrlExists(@RequestParam("cateUrl") String cateUrl) {
Category category = categoryService.findByCateUrl(cateUrl);
return null != category;
if (null != category) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.url-is-exists"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "");
}
/**
@ -74,9 +82,9 @@ public class CategoryController {
* @return /admin/category
*/
@GetMapping(value = "/remove")
public String removeCategory(@PathParam("cateId") Long cateId) {
public String removeCategory(@RequestParam("cateId") Long cateId) {
try {
Category category = categoryService.removeByCateId(cateId);
categoryService.removeByCateId(cateId);
} catch (Exception e) {
log.error("删除分类失败:{}", e.getMessage());
}
@ -91,7 +99,7 @@ public class CategoryController {
* @return admin/admin_category
*/
@GetMapping(value = "/edit")
public String toEditCategory(Model model, @PathParam("cateId") Long cateId) {
public String toEditCategory(Model model, @RequestParam("cateId") Long cateId) {
Optional<Category> category = categoryService.findByCateId(cateId);
model.addAttribute("updateCategory", category.get());
return "admin/admin_category";

View File

@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.websocket.server.PathParam;
import java.util.HashMap;
import java.util.Map;
@ -93,8 +92,8 @@ public class CommentController extends BaseController {
* @return /admin/comments
*/
@GetMapping(value = "/throw")
public String moveToTrash(@PathParam("commentId") Long commentId,
@PathParam("status") String status,
public String moveToTrash(@RequestParam("commentId") Long commentId,
@RequestParam("status") String status,
@RequestParam(value = "page", defaultValue = "0") Integer page) {
try {
commentService.updateCommentStatus(commentId, CommentStatusEnum.RECYCLE.getCode());
@ -113,8 +112,8 @@ public class CommentController extends BaseController {
* @return /admin/comments
*/
@GetMapping(value = "/revert")
public String moveToPublish(@PathParam("commentId") Long commentId,
@PathParam("status") Integer status,
public String moveToPublish(@RequestParam("commentId") Long commentId,
@RequestParam("status") Integer status,
HttpSession session) {
Comment comment = commentService.updateCommentStatus(commentId, CommentStatusEnum.PUBLISHED.getCode());
Post post = comment.getPost();
@ -134,8 +133,8 @@ public class CommentController extends BaseController {
* @return string /admin/comments
*/
@GetMapping(value = "/remove")
public String moveToAway(@PathParam("commentId") Long commentId,
@PathParam("status") Integer status,
public String moveToAway(@RequestParam("commentId") Long commentId,
@RequestParam("status") Integer status,
@RequestParam(value = "page", defaultValue = "0") Integer page) {
try {
commentService.removeByCommentId(commentId);

View File

@ -8,8 +8,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
/**
* <pre>
*
@ -74,7 +72,7 @@ public class MenuController {
* @return /admin/menus
*/
@GetMapping(value = "/remove")
public String removeMenu(@PathParam("menuId") Long menuId) {
public String removeMenu(@RequestParam("menuId") Long menuId) {
try {
menuService.removeByMenuId(menuId);
} catch (Exception e) {

View File

@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.websocket.server.PathParam;
import java.util.List;
import java.util.Optional;
@ -94,7 +93,7 @@ public class PageController {
* @return String admin/admin_page_link
*/
@GetMapping(value = "/links/edit")
public String toEditLink(Model model, @PathParam("linkId") Long linkId) {
public String toEditLink(Model model, @RequestParam("linkId") Long linkId) {
Optional<Link> link = linkService.findByLinkId(linkId);
model.addAttribute("updateLink", link.get());
return "admin/admin_page_link";
@ -123,7 +122,7 @@ public class PageController {
* @return /admin/page/links
*/
@GetMapping(value = "/links/remove")
public String removeLink(@PathParam("linkId") Long linkId) {
public String removeLink(@RequestParam("linkId") Long linkId) {
try {
linkService.removeByLinkId(linkId);
} catch (Exception e) {
@ -178,7 +177,7 @@ public class PageController {
* @return admin/widget/_gallery-detail
*/
@GetMapping(value = "/gallery")
public String gallery(Model model, @PathParam("galleryId") Long galleryId) {
public String gallery(Model model, @RequestParam("galleryId") Long galleryId) {
Optional<Gallery> gallery = galleryService.findByGalleryId(galleryId);
model.addAttribute("gallery", gallery.get());
return "admin/widget/_gallery-detail";
@ -259,7 +258,7 @@ public class PageController {
* @return admin/admin_page_md_editor
*/
@GetMapping(value = "/edit")
public String editPage(@PathParam("pageId") Long pageId, Model model) {
public String editPage(@RequestParam("pageId") Long pageId, Model model) {
Optional<Post> post = postService.findByPostId(pageId);
model.addAttribute("post", post.get());
return "admin/admin_page_md_editor";
@ -273,10 +272,10 @@ public class PageController {
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public JsonResult checkUrlExists(@PathParam("postUrl") String postUrl) {
public JsonResult checkUrlExists(@RequestParam("postUrl") String postUrl) {
Post post = postService.findByPostUrl(postUrl, PostTypeEnum.POST_TYPE_PAGE.getDesc());
if (null != post) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "该路径已经存在!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.url-is-exists"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "");
}

View File

@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.websocket.server.PathParam;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Optional;
@ -141,7 +140,7 @@ public class PostController extends BaseController {
* @return /themes/{theme}/post
*/
@GetMapping(value = "/view")
public String viewPost(@PathParam("postId") Long postId, Model model) {
public String viewPost(@RequestParam("postId") Long postId, Model model) {
Optional<Post> post = postService.findByPostId(postId);
model.addAttribute("post", post.get());
return this.render("post");
@ -313,7 +312,7 @@ public class PostController extends BaseController {
* @return /admin/posts
*/
@GetMapping(value = "/remove")
public String removePost(@PathParam("postId") Long postId, @PathParam("postType") String postType) {
public String removePost(@RequestParam("postId") Long postId, @RequestParam("postType") String postType) {
try {
Optional<Post> post = postService.findByPostId(postId);
postService.removeByPostId(postId);
@ -335,7 +334,7 @@ public class PostController extends BaseController {
* @return admin/admin_editor
*/
@GetMapping(value = "/edit")
public String editPost(@PathParam("postId") Long postId, Model model) {
public String editPost(@RequestParam("postId") Long postId, Model model) {
Optional<Post> post = postService.findByPostId(postId);
model.addAttribute("post", post.get());
return "admin/admin_post_md_editor";
@ -349,29 +348,32 @@ public class PostController extends BaseController {
*/
@GetMapping(value = "/updateSummary")
@ResponseBody
public JsonResult updateSummary(@PathParam("postSummary") Integer postSummary) {
public JsonResult updateSummary(@RequestParam("postSummary") Integer postSummary) {
try {
postService.updateAllSummary(postSummary);
} catch (Exception e) {
log.error("更新摘要失败:{}", e.getMessage());
e.printStackTrace();
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "更新失败!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.update-failed"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "所有文章摘要更新成功!");
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.update-success"));
}
/**
*
*
* @param postUrl
* @return truefalse
* @return JsonResult
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public boolean checkUrlExists(@PathParam("postUrl") String postUrl) {
public JsonResult checkUrlExists(@RequestParam("postUrl") String postUrl) {
postUrl = urlFilter(postUrl);
Post post = postService.findByPostUrl(postUrl, PostTypeEnum.POST_TYPE_POST.getDesc());
return null != post;
if (null != post) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.url-is-exists"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "");
}
/**
@ -382,9 +384,9 @@ public class PostController extends BaseController {
*/
@GetMapping(value = "/pushAllToBaidu")
@ResponseBody
public JsonResult pushAllToBaidu(@PathParam("baiduToken") String baiduToken) {
public JsonResult pushAllToBaidu(@RequestParam("baiduToken") String baiduToken) {
if (StringUtils.isEmpty(baiduToken)) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "百度推送Token为空");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.post.no-baidu-token"));
}
String blogUrl = HaloConst.OPTIONS.get(BlogPropertiesEnum.BLOG_URL.getProp());
List<Post> posts = postService.findAllPosts(PostTypeEnum.POST_TYPE_POST.getDesc());
@ -397,8 +399,8 @@ public class PostController extends BaseController {
}
String result = HaloUtils.baiduPost(blogUrl, baiduToken, urls.toString());
if (StringUtils.isEmpty(result)) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "推送所有文章成功!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.post.push-to-baidu-failed"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "推送成功!");
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.post.push-to-baidu-success"));
}
}

View File

@ -1,15 +1,16 @@
package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Tag;
import cc.ryanc.halo.model.dto.JsonResult;
import cc.ryanc.halo.model.enums.ResultCodeEnum;
import cc.ryanc.halo.service.TagService;
import cc.ryanc.halo.utils.LocaleMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
/**
* <pre>
*
@ -26,6 +27,9 @@ public class TagController {
@Autowired
private TagService tagService;
@Autowired
private LocaleMessageUtil localeMessageUtil;
/**
*
*
@ -60,9 +64,12 @@ public class TagController {
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public boolean checkTagUrlExists(@RequestParam("tagUrl") String tagUrl) {
public JsonResult checkTagUrlExists(@RequestParam("tagUrl") String tagUrl) {
Tag tag = tagService.findByTagUrl(tagUrl);
return null != tag;
if (null != tag) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.url-is-exists"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "");
}
/**
@ -72,10 +79,9 @@ public class TagController {
* @return /admin/tag
*/
@GetMapping(value = "/remove")
public String removeTag(@PathParam("tagId") Long tagId) {
public String removeTag(@RequestParam("tagId") Long tagId) {
try {
Tag tag = tagService.removeByTagId(tagId);
log.info("删除的标签:" + tag);
tagService.removeByTagId(tagId);
} catch (Exception e) {
log.error("删除标签失败:{}", e.getMessage());
}
@ -90,7 +96,7 @@ public class TagController {
* @return admin/admin_tag
*/
@GetMapping(value = "/edit")
public String toEditTag(Model model, @PathParam("tagId") Long tagId) {
public String toEditTag(Model model, @RequestParam("tagId") Long tagId) {
Tag tag = tagService.findByTagId(tagId).get();
model.addAttribute("updateTag", tag);
return "admin/admin_tag";

View File

@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
@ -84,7 +83,7 @@ public class ThemeController extends BaseController {
@GetMapping(value = "/set")
@ResponseBody
@CacheEvict(value = "posts", allEntries = true, beforeInvocation = true)
public JsonResult activeTheme(@PathParam("siteTheme") String siteTheme,
public JsonResult activeTheme(@RequestParam("siteTheme") String siteTheme,
HttpServletRequest request) {
try {
//保存主题设置项
@ -129,13 +128,13 @@ public class ThemeController extends BaseController {
HaloConst.THEMES = HaloUtils.getThemes();
} else {
log.error("上传主题失败,没有选择文件");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "请选择上传的主题!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.upload-no-file"));
}
} catch (Exception e) {
log.error("上传主题失败:{}", e.getMessage());
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "主题上传失败!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.upload-failed"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "主题上传成功!");
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.theme.upload-success"));
}
/**
@ -180,22 +179,22 @@ public class ThemeController extends BaseController {
public JsonResult cloneFromRemote(@RequestParam(value = "remoteAddr") String remoteAddr,
@RequestParam(value = "themeName") String themeName) {
if (StringUtils.isBlank(remoteAddr) || StringUtils.isBlank(themeName)) {
return new JsonResult(0, "请输入完整信息!");
return new JsonResult(0, localeMessageUtil.getMessage("code.admin.common.info-no-complete"));
}
try {
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
File themePath = new File(basePath.getAbsolutePath(), "templates/themes");
String cmdResult = RuntimeUtil.execForStr("git clone " + remoteAddr + " " + themePath.getAbsolutePath() + "/" + themeName);
if (NOT_FOUND_GIT.equals(cmdResult)) {
return new JsonResult(0, "没有安装Git");
return new JsonResult(0, localeMessageUtil.getMessage("code.admin.theme.no-git"));
}
HaloConst.THEMES.clear();
HaloConst.THEMES = HaloUtils.getThemes();
} catch (FileNotFoundException e) {
log.error("克隆主题失败:{}", e.getMessage());
return new JsonResult(0, "克隆主题失败:" + e.getMessage());
return new JsonResult(0, localeMessageUtil.getMessage("code.admin.theme.clone-theme-failed") + e.getMessage());
}
return new JsonResult(1, "安装成功!");
return new JsonResult(1, localeMessageUtil.getMessage("code.admin.common.install-success"));
}
/**
@ -212,15 +211,15 @@ public class ThemeController extends BaseController {
File themePath = new File(basePath.getAbsolutePath(), "templates/themes");
String cmdResult = RuntimeUtil.execForStr("cd " + themePath.getAbsolutePath() + "/" + themeName + " && git pull");
if (NOT_FOUND_GIT.equals(cmdResult)) {
return new JsonResult(0, "没有安装Git");
return new JsonResult(0, localeMessageUtil.getMessage("code.admin.theme.no-git"));
}
HaloConst.THEMES.clear();
HaloConst.THEMES = HaloUtils.getThemes();
} catch (Exception e) {
log.error("更新主题失败:{}", e.getMessage());
return new JsonResult(0, "更新主题失败:" + e.getMessage());
return new JsonResult(0, localeMessageUtil.getMessage("code.admin.theme.update-theme-failed") + e.getMessage());
}
return new JsonResult(1, "更新成功!");
return new JsonResult(1, localeMessageUtil.getMessage("code.admin.common.update-success"));
}
/**
@ -289,7 +288,7 @@ public class ThemeController extends BaseController {
public JsonResult saveTpl(@RequestParam("tplName") String tplName,
@RequestParam("tplContent") String tplContent) {
if (StringUtils.isBlank(tplContent)) {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "模板不能为空!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.edit.no-content"));
}
try {
//获取项目根路径
@ -300,8 +299,8 @@ public class ThemeController extends BaseController {
fileWriter.write(tplContent);
} catch (Exception e) {
log.error("模板保存失败:{}", e.getMessage());
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "模板保存失败!");
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
}
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "模板保存成功!");
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.save-success"));
}
}

View File

@ -1,6 +1,7 @@
package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.HaloConst;
import cc.ryanc.halo.model.dto.JsonResult;
import cc.ryanc.halo.model.enums.ResultCodeEnum;
import cc.ryanc.halo.service.UserService;
@ -67,7 +68,7 @@ public class UserController {
}
userService.saveByUser(user);
configuration.setSharedVariable("user", userService.findUser());
session.invalidate();
session.removeAttribute(HaloConst.USER_SESSION_KEY);
} catch (Exception e) {
log.error("修改用户资料失败:{}", e.getMessage());
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.edit-failed"));
@ -95,7 +96,7 @@ public class UserController {
if (null != user) {
user.setUserPass(SecureUtil.md5(newPass));
userService.saveByUser(user);
session.invalidate();
session.removeAttribute(HaloConst.USER_SESSION_KEY);
} else {
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.user.old-password-error"));
}

View File

@ -15,12 +15,8 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.util.List;
/**
@ -91,7 +87,7 @@ public class FrontIndexController extends BaseController {
*/
@GetMapping(value = "next")
@ResponseBody
public List<Post> ajaxIndex(@PathParam(value = "page") Integer page) {
public List<Post> ajaxIndex(@RequestParam(value = "page") Integer page) {
Sort sort = new Sort(Sort.Direction.DESC, "postDate");
//默认显示10条
Integer size = 10;
@ -114,7 +110,7 @@ public class FrontIndexController extends BaseController {
* @return /themes/{theme}/index
*/
@GetMapping(value = "search")
public String search(@PathParam("keyword") String keyword, Model model) {
public String search(@RequestParam("keyword") String keyword, Model model) {
Page<Post> posts = postService.searchByKeywords(keyword, null);
model.addAttribute("posts", posts);
return this.render("index");

View File

@ -72,6 +72,11 @@ admin.index.widgets.logs-lastest = 最新日志
admin.index.widgets.btn.clear-logs = 清空日志
admin.index.blog-data.motto = 加油!不要因为走的太远,而忘了当初为什么出发。
admin.index.blog-data.during = 在此期间:
admin.index.blog-data.posts-count-text = 累计发表了 {0} 篇文章。
admin.index.blog-data.tags-count-text = 累计创建了 {0} 个标签。
admin.index.blog-data.comments-count-text = 累计获得了 {0} 条评论。
admin.index.blog-data.links-count-text = 累计添加了 {0} 个友链。
admin.index.blog-data.views-count-text = 文章总访问 {0} 次。
# 附件管理页面
admin.attachments.title = 附件管理
@ -155,6 +160,7 @@ admin.user.profile.form.desc.tips = 部分主题可在页面上显示这段话
admin.user.profile.form.old-password = 原密码:
admin.user.profile.form.new-password = 新密码:
admin.user.profile.form.confirm-password = 确认密码:
admin.user.profile.form.password.no-same = 两次密码不一样!
# 标签管理页面
admin.tags.title = 标签
@ -229,7 +235,7 @@ common.th.file-type = 文件类型
common.status.published = 已发布
common.status.checking = 待审核
common.status.recycle-bin = 回收站
common.status.draft = &emsp;稿
common.status.draft = 稿
common.text.no-data = 暂无数据
common.text.tips = 提示
@ -239,7 +245,7 @@ common.text.tips.to-release-post = 确定发布该文章?
# js
common.js.all-attachment = 所有附件
common.js.info-no-complate = 请输入完整信息!
common.js.info-no-complete = 请输入完整信息!
# 分页信息
admin.pageinfo.text.no =
@ -265,6 +271,21 @@ code.admin.backup.have-new-backup = 有新的备份!
code.admin.theme.change-success = 主题已设置为{0}
code.admin.theme.change-failed = 主题设置失败!
code.admin.theme.upload-failed = 主题上传失败!
code.admin.theme.upload-success = 主题上传成功!
code.admin.theme.upload-no-file = 请选择上传的主题!
code.admin.theme.no-git = 没有安装Git
code.admin.theme.clone-theme-failed = 克隆主题失败:
code.admin.theme.update-theme-failed = 更新主题失败:
code.admin.theme.edit.no-content = 模板不能为空!
code.admin.user.old-password-error = 原密码错误!
code.admin.user.update-password-failed = 修改密码失败!
code.admin.user.update-password-success = 修改密码成功!
code.admin.post.push-to-baidu-success = 推送成功!
code.admin.post.push-to-baidu-failed = 推送失败!
code.admin.post.no-baidu-token = 百度推送Token为空
code.admin.common.delete-success = 删除成功!
code.admin.common.delete-failed = 删除失败!
@ -272,3 +293,11 @@ code.admin.common.no-post = 发信邮箱没有配置!
code.admin.common.save-success = 保存成功!
code.admin.common.save-failed = 保存失败!
code.admin.common.update-success = 更新成功!
code.admin.common.update-failed = 更新失败!
code.admin.common.edit-success = 修改成功!
code.admin.common.edit-failed = 修改失败!
code.admin.common.info-no-complete = 请输入完整信息!
code.admin.common.install-success = 安装成功!
code.admin.common.url-is-exists = 该路径已经存在!

View File

@ -160,6 +160,7 @@ admin.user.profile.form.desc.tips = Some themes can display this passage on the
admin.user.profile.form.old-password = Old password:
admin.user.profile.form.new-password = New password:
admin.user.profile.form.confirm-password = Confirm password:
admin.user.profile.form.password.no-same = The two passwords are different!
# tags page
admin.tags.title = Tags
@ -244,7 +245,7 @@ common.text.tips.to-release-post = Are you sure you want to publish this article
# js
common.js.all-attachment = All attachments
common.js.info-no-complate = Please enter full information!
common.js.info-no-complete = Please enter full information!
# Page info
admin.pageinfo.text.no = (
@ -270,11 +271,22 @@ code.admin.backup.have-new-backup = Have a new backup!
code.admin.theme.change-success = Theme has been set to {0}
code.admin.theme.change-failed = Theme settings failed!
code.admin.theme.upload-failed = Theme upload failed!
code.admin.theme.upload-success = Theme uploaded successfully!
code.admin.theme.upload-no-file = Please select the theme you uploaded!
code.admin.theme.no-git = No Git installed!
code.admin.theme.clone-theme-failed = Cloning the theme failed:
code.admin.theme.update-theme-failed = Update theme failed:
code.admin.theme.edit.no-content = Template can't be empty!
code.admin.user.old-password-error = The original password is wrong!
code.admin.user.update-password-failed = Failed to change password!
code.admin.user.update-password-success = Password has been updated!
code.admin.post.push-to-baidu-success = Push successful!
code.admin.post.push-to-baidu-failed = Push failed!
code.admin.post.no-baidu-token = Baidu push Token is empty!
code.admin.common.delete-success = Deleted successfully!
code.admin.common.delete-failed = Deleted Failed!
code.admin.common.no-post = The mailing mailbox is not configured!
@ -282,6 +294,10 @@ code.admin.common.no-post = The mailing mailbox is not configured!
code.admin.common.save-success = Saved successfully!
code.admin.common.save-failed = Save failed!
code.admin.common.update-success = Updated successfully!
code.admin.common.update-failed = Update failed
code.admin.common.edit-success = Successfully modified!
code.admin.common.edit-failed = Fail to update!
code.admin.common.info-no-complete = Please enter full information!
code.admin.common.install-success = Successful installation!
code.admin.common.url-is-exists = The url already exists!

View File

@ -160,6 +160,7 @@ admin.user.profile.form.desc.tips = 部分主题可在页面上显示这段话
admin.user.profile.form.old-password = 原密码:
admin.user.profile.form.new-password = 新密码:
admin.user.profile.form.confirm-password = 确认密码:
admin.user.profile.form.password.no-same = 两次密码不一样!
# 标签管理页面
admin.tags.title = 标签
@ -244,7 +245,7 @@ common.text.tips.to-release-post = 确定发布该文章?
# js
common.js.all-attachment = 所有附件
common.js.info-no-complate = 请输入完整信息!
common.js.info-no-complete = 请输入完整信息!
# 分页信息
admin.pageinfo.text.no =
@ -270,11 +271,22 @@ code.admin.backup.have-new-backup = 有新的备份!
code.admin.theme.change-success = 主题已设置为{0}
code.admin.theme.change-failed = 主题设置失败!
code.admin.theme.upload-failed = 主题上传失败!
code.admin.theme.upload-success = 主题上传成功!
code.admin.theme.upload-no-file = 请选择上传的主题!
code.admin.theme.no-git = 没有安装Git
code.admin.theme.clone-theme-failed = 克隆主题失败:
code.admin.theme.update-theme-failed = 更新主题失败:
code.admin.theme.edit.no-content = 模板不能为空!
code.admin.user.old-password-error = 原密码错误!
code.admin.user.update-password-failed = 修改密码失败!
code.admin.user.update-password-success = 修改密码成功!
code.admin.post.push-to-baidu-success = 推送成功!
code.admin.post.push-to-baidu-failed = 推送失败!
code.admin.post.no-baidu-token = 百度推送Token为空
code.admin.common.delete-success = 删除成功!
code.admin.common.delete-failed = 删除失败!
code.admin.common.no-post = 发信邮箱没有配置!
@ -282,6 +294,10 @@ code.admin.common.no-post = 发信邮箱没有配置!
code.admin.common.save-success = 保存成功!
code.admin.common.save-failed = 保存失败!
code.admin.common.update-success = 更新成功!
code.admin.common.update-failed = 更新失败!
code.admin.common.edit-success = 修改成功!
code.admin.common.edit-failed = 修改失败!
code.admin.common.info-no-complete = 请输入完整信息!
code.admin.common.install-success = 安装成功!
code.admin.common.url-is-exists = 该路径已经存在!

View File

@ -162,7 +162,7 @@
var desc = $('#cateDesc').val();
var result = true;
if(name==""||url==""||desc==""){
showMsg("<@spring.message code='common.js.info-no-complate' />","info",2000);
showMsg("<@spring.message code='common.js.info-no-complete' />","info",2000);
result = false;
}
$.ajax({
@ -173,8 +173,8 @@
'cateUrl' : url
},
success: function (data) {
if(data==true){
showMsg("该路径已经存在!","info",2000);
if(data.code==0){
showMsg(data.msg,"error",2000);
result = false;
}
}

View File

@ -147,7 +147,7 @@
var name = $('#linkName').val();
var url = $('#linkUrl').val();
if(name==""||url==""){
showMsg("<@spring.message code='common.js.info-no-complate' />","info",2000);
showMsg("<@spring.message code='common.js.info-no-complete' />","info",2000);
return false;
}
}

View File

@ -190,7 +190,7 @@
},
success: function (data) {
if(data.code==0){
showMsg("该路径已经存在!","info",2000);
showMsg(data.msg,"error",2000);
return;
}else{
$('#postUrl').html($('#newPostUrl').val());

View File

@ -290,8 +290,8 @@
'postUrl': $('#newPostUrl').val()
},
success: function (data) {
if(data==true){
showMsg("该路径已经存在!","info",2000);
if(data.code==0){
showMsg(data.msg,"error",2000);
return;
}else{
$('#postUrl').html($('#newPostUrl').val());

View File

@ -183,11 +183,11 @@
var newPass = $('#newPass').val();
var reNewPass = $('#reNewPass').val();
if(beforePass==""||newPass==""||reNewPass==""){
showMsg("<@spring.message code='common.js.info-no-complate' />","info",2000);
showMsg("<@spring.message code='common.js.info-no-complete' />","info",2000);
return;
}
if(newPass!=reNewPass){
showMsg("两次密码不一样!","error",2000);
showMsg("<@spring.message code='admin.user.profile.form.password.no-same' />","error",2000);
return;
}
var param = $('#passForm').serialize();

View File

@ -136,7 +136,7 @@
var url = $('#tagUrl').val();
var result = true;
if(name==""||url==""){
showMsg("<@spring.message code='common.js.info-no-complate' />","info",2000);
showMsg("<@spring.message code='common.js.info-no-complete' />","info",2000);
result = false;
}
$.ajax({
@ -147,8 +147,8 @@
'tagUrl' : url
},
success: function (data) {
if(data==true){
showMsg("该路径已经存在!","info",2000);
if(data.code==0){
showMsg(data.msg,"error",2000);
result = false;
}
}

View File

@ -143,7 +143,7 @@
var themeName = $("#themeName").val();
if(remoteAddr==null || themeName==null){
$.toast({
text: "<@spring.message code='common.js.info-no-complate' />",
text: "<@spring.message code='common.js.info-no-complete' />",
heading: '<@spring.message code="common.text.tips" />',
icon: 'error',
showHideTransition: 'fade',