mirror of https://github.com/halo-dev/halo
👽 细节修改
parent
dba3a5b153
commit
1905b6eb73
|
@ -12,6 +12,7 @@
|
|||
## 目录
|
||||
|
||||
- [Introduction 简介](#Introduction-简介)
|
||||
- [Quickstart 快速开始](#Quickstart-快速开始)
|
||||
- [Demo 演示](#Demo-演示)
|
||||
- [Download 下载](#Download-下载)
|
||||
- [Docs 文档](#Docs-文档)
|
||||
|
@ -26,6 +27,14 @@ Fast,simple,powerful blog system powered by Java.
|
|||
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。<br>
|
||||
轻快,简洁,功能强大,使用Java开发的博客系统。
|
||||
|
||||
## Quickstart 快速开始
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ruibaby/halo.git
|
||||
cd halo
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
## Demo 演示
|
||||
|
||||
[界面预览](PREVIEW.md)
|
||||
|
|
|
@ -316,6 +316,25 @@ public class HaloUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除非空文件夹
|
||||
* @param dir dir
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean removeDir(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i=0; i<children.length; i++) {
|
||||
boolean success = removeDir(new File(dir, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 目录此时为空,可以删除
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
* @return 字符串
|
||||
|
|
|
@ -64,7 +64,7 @@ public class IndexController extends BaseController{
|
|||
* 请求首页
|
||||
*
|
||||
* @param model model
|
||||
* @return freemarker
|
||||
* @return 模板路径
|
||||
*/
|
||||
@GetMapping
|
||||
public String index(Model model){
|
||||
|
@ -76,9 +76,9 @@ public class IndexController extends BaseController{
|
|||
* 首页分页
|
||||
*
|
||||
* @param model model
|
||||
* @param page page
|
||||
* @param size size
|
||||
* @return freemarker
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 模板路径/themes/{theme}/index
|
||||
*/
|
||||
@GetMapping(value = "page/{page}")
|
||||
public String index(Model model,
|
||||
|
@ -124,8 +124,8 @@ public class IndexController extends BaseController{
|
|||
/**
|
||||
* ajax分页
|
||||
*
|
||||
* @param page page
|
||||
* @return list
|
||||
* @param page page 当前页码
|
||||
* @return List<Post>集合</>
|
||||
*/
|
||||
@GetMapping(value = "next")
|
||||
@ResponseBody
|
||||
|
@ -147,9 +147,9 @@ public class IndexController extends BaseController{
|
|||
/**
|
||||
* 渲染文章详情
|
||||
*
|
||||
* @param postId postId
|
||||
* @param postUrl 文章路径名
|
||||
* @param model model
|
||||
* @return String
|
||||
* @return 模板路径/themes/{theme}/post
|
||||
*/
|
||||
@GetMapping(value = {"archives/{postUrl}","post/{postUrl}","article/{postUrl}"})
|
||||
public String getPost(@PathVariable String postUrl, Model model){
|
||||
|
@ -207,8 +207,9 @@ public class IndexController extends BaseController{
|
|||
|
||||
/**
|
||||
* 获取文章的评论
|
||||
* @param postId postId
|
||||
* @return page
|
||||
*
|
||||
* @param postId postId 文章编号
|
||||
* @return List<Comment>集合</>
|
||||
*/
|
||||
@GetMapping(value = "/getComment/{postId}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@ResponseBody
|
||||
|
@ -227,7 +228,7 @@ public class IndexController extends BaseController{
|
|||
* 渲染关于页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径/themes/{theme}/about
|
||||
*/
|
||||
@GetMapping(value = "/about")
|
||||
public String about(Model model){
|
||||
|
@ -243,7 +244,7 @@ public class IndexController extends BaseController{
|
|||
/**
|
||||
* 跳转到图库页面
|
||||
*
|
||||
* @return String
|
||||
* @return 模板路径/themes/{theme}/gallery
|
||||
*/
|
||||
@GetMapping(value = "/gallery")
|
||||
public String gallery(Model model){
|
||||
|
@ -258,7 +259,8 @@ public class IndexController extends BaseController{
|
|||
/**
|
||||
* 友情链接
|
||||
*
|
||||
* @return string
|
||||
* @param model model
|
||||
* @return 模板路径/themes/{theme}/links
|
||||
*/
|
||||
@GetMapping(value = "/links")
|
||||
public String links(Model model){
|
||||
|
@ -297,7 +299,7 @@ public class IndexController extends BaseController{
|
|||
* 标签
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径/themes/{theme}/tags
|
||||
*/
|
||||
@GetMapping(value = "/tags")
|
||||
public String tags(Model model){
|
||||
|
@ -347,7 +349,7 @@ public class IndexController extends BaseController{
|
|||
* 文章归档
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径
|
||||
*/
|
||||
@GetMapping(value = "/archives")
|
||||
public String archives(Model model){
|
||||
|
@ -358,8 +360,8 @@ public class IndexController extends BaseController{
|
|||
* 文章归档分页
|
||||
*
|
||||
* @param model model
|
||||
* @param page page
|
||||
* @return string
|
||||
* @param page page 当前页码
|
||||
* @return 模板路径/themes/{theme}/archives
|
||||
*/
|
||||
@GetMapping(value = "/archives/page/{page}")
|
||||
public String archives(Model model,
|
||||
|
@ -404,9 +406,9 @@ public class IndexController extends BaseController{
|
|||
* 文章归档,根据年月
|
||||
*
|
||||
* @param model model
|
||||
* @param year year
|
||||
* @param month month
|
||||
* @return string
|
||||
* @param year year 年份
|
||||
* @param month month 月份
|
||||
* @return 模板路径/themes/{theme}/archives
|
||||
*/
|
||||
@GetMapping(value = "/archives/{year}/{month}")
|
||||
public String archives(Model model,
|
||||
|
@ -488,14 +490,19 @@ public class IndexController extends BaseController{
|
|||
/**
|
||||
* 提交新评论
|
||||
*
|
||||
* @param comment comment
|
||||
* @return string
|
||||
* @param comment comment实体
|
||||
* @param post post实体
|
||||
* @param request request
|
||||
* @return true:评论成功,false:评论失败
|
||||
*/
|
||||
@PostMapping(value = "/newComment")
|
||||
@ResponseBody
|
||||
public boolean newComment(@ModelAttribute("comment") Comment comment,
|
||||
@ModelAttribute("post") Post post,
|
||||
HttpServletRequest request){
|
||||
if(""==comment.getCommentAuthor() || "".equals(comment.getCommentAuthor())){
|
||||
comment.setCommentAuthor("小猪佩琪");
|
||||
}
|
||||
comment.setCommentAuthorEmail(comment.getCommentAuthorEmail().toLowerCase());
|
||||
comment.setPost(post);
|
||||
comment.setCommentDate(new Date());
|
||||
|
|
|
@ -54,7 +54,8 @@ public class InstallController {
|
|||
/**
|
||||
* 渲染安装页面
|
||||
*
|
||||
* @return string
|
||||
* @param model model
|
||||
* @return 模板路径
|
||||
*/
|
||||
@GetMapping
|
||||
public String install(Model model){
|
||||
|
@ -75,7 +76,14 @@ public class InstallController {
|
|||
/**
|
||||
* 执行安装
|
||||
*
|
||||
* @return boolean
|
||||
* @param siteTitle 博客标题
|
||||
* @param siteUrl 博客网址
|
||||
* @param userName 用户名
|
||||
* @param userDisplayName 用户名显示名
|
||||
* @param userEmail 用户邮箱
|
||||
* @param userPwd 用户密码
|
||||
* @param request request
|
||||
* @return true:安装成功,false:安装失败
|
||||
*/
|
||||
@PostMapping(value = "/do")
|
||||
@ResponseBody
|
||||
|
|
|
@ -58,7 +58,9 @@ public class AdminController extends BaseController{
|
|||
/**
|
||||
* 请求后台页面
|
||||
*
|
||||
* @return freemarker
|
||||
* @param model model
|
||||
* @param session session
|
||||
* @return 模板路径admin/admin_index
|
||||
*/
|
||||
@GetMapping(value = {"","/index"})
|
||||
public String index(Model model,HttpSession session){
|
||||
|
@ -93,7 +95,8 @@ public class AdminController extends BaseController{
|
|||
/**
|
||||
* 处理跳转到登录页的请求
|
||||
*
|
||||
* @return freemarker
|
||||
* @param session session
|
||||
* @return 模板路径admin/admin_login
|
||||
*/
|
||||
@GetMapping(value = "/login")
|
||||
public String login(HttpSession session){
|
||||
|
@ -108,10 +111,10 @@ public class AdminController extends BaseController{
|
|||
/**
|
||||
* 验证登录信息
|
||||
*
|
||||
* @param loginName loginName
|
||||
* @param loginPwd loginPwd
|
||||
* @param session session
|
||||
* @return String
|
||||
* @param loginName 登录名:邮箱/用户名
|
||||
* @param loginPwd loginPwd 密码
|
||||
* @param session session session
|
||||
* @return String 登录状态
|
||||
*/
|
||||
@PostMapping(value = "/getLogin")
|
||||
@ResponseBody
|
||||
|
@ -158,7 +161,7 @@ public class AdminController extends BaseController{
|
|||
* 退出登录 销毁session
|
||||
*
|
||||
* @param session session
|
||||
* @return string
|
||||
* @return 重定向到/admin/login
|
||||
*/
|
||||
@GetMapping(value = "/logOut")
|
||||
public String logOut(HttpSession session){
|
||||
|
@ -172,10 +175,10 @@ public class AdminController extends BaseController{
|
|||
/**
|
||||
* 查看所有日志
|
||||
*
|
||||
* @param model model
|
||||
* @param page page
|
||||
* @param size size
|
||||
* @return string
|
||||
* @param model model model
|
||||
* @param page page 当前页码
|
||||
* @param size size 每页条数
|
||||
* @return 模板路径admin/widget/_logs-all
|
||||
*/
|
||||
@GetMapping(value = "/logs")
|
||||
public String logs(Model model,
|
||||
|
@ -191,7 +194,7 @@ public class AdminController extends BaseController{
|
|||
/**
|
||||
* 清除所有日志
|
||||
*
|
||||
* @return return
|
||||
* @return 重定向到/admin
|
||||
*/
|
||||
@GetMapping(value = "/logs/clear")
|
||||
public String logsClear(){
|
||||
|
@ -207,7 +210,7 @@ public class AdminController extends BaseController{
|
|||
* 不可描述的页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径admin/admin_halo
|
||||
*/
|
||||
@GetMapping(value = "/halo")
|
||||
public String halo(Model model){
|
||||
|
|
|
@ -58,7 +58,7 @@ public class AttachmentController {
|
|||
* 获取upload的所有图片资源并渲染页面
|
||||
*
|
||||
* @param model model
|
||||
* @return String
|
||||
* @return 模板路径admin/admin_attachment
|
||||
*/
|
||||
@GetMapping
|
||||
public String attachments(Model model,
|
||||
|
@ -78,8 +78,8 @@ public class AttachmentController {
|
|||
* 跳转选择附件页面
|
||||
*
|
||||
* @param model model
|
||||
* @param page page
|
||||
* @return string
|
||||
* @param page page 当前页码
|
||||
* @return 模板路径admin/widget/_attachment-select
|
||||
*/
|
||||
@GetMapping(value = "/select")
|
||||
public String selectAttachment(Model model,
|
||||
|
@ -100,7 +100,9 @@ public class AttachmentController {
|
|||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file file
|
||||
* @param file 文件
|
||||
* @param request request
|
||||
* @return Map
|
||||
*/
|
||||
@PostMapping(value = "/upload",produces = { "application/json;charset=UTF-8" })
|
||||
@ResponseBody
|
||||
|
@ -164,8 +166,9 @@ public class AttachmentController {
|
|||
/**
|
||||
* 处理获取附件详情的请求
|
||||
*
|
||||
* @param attachId attachId
|
||||
* @return string
|
||||
* @param model model
|
||||
* @param attachId 附件编号
|
||||
* @return 模板路径admin/widget/_attachment-detail
|
||||
*/
|
||||
@GetMapping(value = "/attachment")
|
||||
public String attachmentDetail(Model model,@PathParam("attachId") Long attachId){
|
||||
|
@ -180,8 +183,9 @@ public class AttachmentController {
|
|||
/**
|
||||
* 移除附件的请求
|
||||
*
|
||||
* @param attachId attachId
|
||||
* @return string
|
||||
* @param attachId 附件编号
|
||||
* @param request request
|
||||
* @return true:移除附件成功,false:移除附件失败
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
@ResponseBody
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BackupController {
|
|||
* 渲染备份页面
|
||||
*
|
||||
* @param model model
|
||||
* @return return
|
||||
* @return 模板路径admin/admin_backup
|
||||
*/
|
||||
@GetMapping
|
||||
public String backup(Model model){
|
||||
|
@ -46,7 +46,7 @@ public class BackupController {
|
|||
/**
|
||||
* 备份数据库
|
||||
*
|
||||
* @return return
|
||||
* @return 重定向到/admin/backup
|
||||
*/
|
||||
@GetMapping(value = "/backupDb")
|
||||
public String backupDatabase(){
|
||||
|
@ -74,7 +74,7 @@ public class BackupController {
|
|||
/**
|
||||
* 备份文章,导出markdown文件
|
||||
*
|
||||
* @return return
|
||||
* @return 重定向到/admin/backup
|
||||
*/
|
||||
@GetMapping(value = "/backupPost")
|
||||
public String backupPosts(){
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CategoryController {
|
|||
* 查询所有分类并渲染category页面
|
||||
*
|
||||
* @param model model
|
||||
* @return freemarker页面
|
||||
* @return 模板路径admin/admin_category
|
||||
*/
|
||||
@GetMapping
|
||||
public String categories(Model model){
|
||||
|
@ -47,7 +47,7 @@ public class CategoryController {
|
|||
* 新增/修改分类目录
|
||||
*
|
||||
* @param category category对象
|
||||
* @return freemarker页面
|
||||
* @return 重定向到/admin/category
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String saveCategory(@ModelAttribute Category category){
|
||||
|
@ -62,8 +62,8 @@ public class CategoryController {
|
|||
/**
|
||||
* 验证分类目录路径是否已经存在
|
||||
*
|
||||
* @param cateUrl cateUrl
|
||||
* @return string
|
||||
* @param cateUrl 分类路径
|
||||
* @return true:不存在,false:存在
|
||||
*/
|
||||
@GetMapping(value = "/checkUrl")
|
||||
@ResponseBody
|
||||
|
@ -80,7 +80,7 @@ public class CategoryController {
|
|||
* 处理删除分类目录的请求
|
||||
*
|
||||
* @param cateId cateId
|
||||
* @return freemarker
|
||||
* @return 重定向到/admin/category
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
public String removeCategory(@PathParam("cateId") Long cateId){
|
||||
|
@ -98,7 +98,7 @@ public class CategoryController {
|
|||
*
|
||||
* @param cateId cateId
|
||||
* @param model model
|
||||
* @return String
|
||||
* @return 模板路径admin/admin_category
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String toEditCategory(Model model,@PathParam("cateId") Long cateId){
|
||||
|
|
|
@ -56,10 +56,10 @@ public class CommentController extends BaseController{
|
|||
* 渲染评论管理页面
|
||||
*
|
||||
* @param model model
|
||||
* @param status status
|
||||
* @param page page
|
||||
* @param size size
|
||||
* @return string
|
||||
* @param status status 评论状态
|
||||
* @param page page 当前页码
|
||||
* @param size size 每页显示条数
|
||||
* @return 模板路径admin/admin_comment
|
||||
*/
|
||||
@GetMapping
|
||||
public String comments(Model model,
|
||||
|
@ -83,8 +83,9 @@ public class CommentController extends BaseController{
|
|||
/**
|
||||
* 将评论移到回收站
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return string
|
||||
* @param commentId 评论编号
|
||||
* @param session session
|
||||
* @return 重定向到/admin/comments
|
||||
*/
|
||||
@GetMapping(value = "/throw")
|
||||
public String moveToTrash(@PathParam("commentId") Long commentId,
|
||||
|
@ -101,9 +102,10 @@ public class CommentController extends BaseController{
|
|||
/**
|
||||
* 将评论改变为发布状态
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @param status status
|
||||
* @return string
|
||||
* @param commentId 评论编号
|
||||
* @param status 评论状态
|
||||
* @param session session
|
||||
* @return 重定向到/admin/comments
|
||||
*/
|
||||
@GetMapping("/revert")
|
||||
public String moveToPublish(@PathParam("commentId") Long commentId,
|
||||
|
@ -141,10 +143,10 @@ public class CommentController extends BaseController{
|
|||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @param status status
|
||||
* @param session session
|
||||
* @return string
|
||||
* @param commentId commentId 评论编号
|
||||
* @param status status 评论状态
|
||||
* @param session session session
|
||||
* @return string 重定向到/admin/comments
|
||||
*/
|
||||
@GetMapping("/remove")
|
||||
public String moveToAway(@PathParam("commentId") Long commentId,
|
||||
|
@ -165,7 +167,7 @@ public class CommentController extends BaseController{
|
|||
*
|
||||
* @param commentId 被回复的评论
|
||||
* @param commentContent 回复的内容
|
||||
* @return string
|
||||
* @return 重定向到/admin/comments
|
||||
*/
|
||||
@PostMapping("/reply")
|
||||
public String replyComment(@RequestParam("commentId") Long commentId,
|
||||
|
|
|
@ -30,7 +30,7 @@ public class MenuController {
|
|||
* 渲染菜单设置页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径/admin/admin_menu
|
||||
*/
|
||||
@GetMapping
|
||||
public String menus(Model model){
|
||||
|
@ -46,7 +46,7 @@ public class MenuController {
|
|||
* 新增/修改菜单
|
||||
*
|
||||
* @param menu menu
|
||||
* @return string
|
||||
* @return 重定向到/admin/menus
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String saveMenu(@ModelAttribute Menu menu){
|
||||
|
@ -60,9 +60,10 @@ public class MenuController {
|
|||
|
||||
/**
|
||||
* 跳转到修改页面
|
||||
* @param id id
|
||||
*
|
||||
* @param menuId 菜单编号
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径/admin/admin_menu
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String updateMenu(@RequestParam("menuId") Long menuId,Model model){
|
||||
|
@ -78,8 +79,9 @@ public class MenuController {
|
|||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param menuId menuId
|
||||
* @return String
|
||||
*
|
||||
* @param menuId 菜单编号
|
||||
* @return 重定向到/admin/menus
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
public String removeMenu(@PathParam("menuId") Long menuId){
|
||||
|
|
|
@ -26,7 +26,8 @@ public class OptionController {
|
|||
/**
|
||||
* 请求跳转到option页面并完成渲染
|
||||
*
|
||||
* @return freemarker
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_option
|
||||
*/
|
||||
@GetMapping
|
||||
public String options(Model model){
|
||||
|
@ -39,6 +40,7 @@ public class OptionController {
|
|||
* 保存设置选项
|
||||
*
|
||||
* @param options options
|
||||
* @return true:保存成功,false:保存失败
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
@ResponseBody
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PageController {
|
|||
* 页面管理页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径admin/admin_page
|
||||
*/
|
||||
@GetMapping
|
||||
public String pages(Model model){
|
||||
|
@ -51,8 +51,8 @@ public class PageController {
|
|||
/**
|
||||
* 获取友情链接列表并渲染页面
|
||||
*
|
||||
* @param map ModelMap
|
||||
* @return String
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_page_link
|
||||
*/
|
||||
@GetMapping(value = "/links")
|
||||
public String links(Model model){
|
||||
|
@ -69,8 +69,8 @@ public class PageController {
|
|||
* 跳转到修改页面
|
||||
*
|
||||
* @param model model
|
||||
* @param linkId linkId
|
||||
* @return String
|
||||
* @param linkId linkId 友情链接编号
|
||||
* @return String 模板路径admin/admin_page_link
|
||||
*/
|
||||
@GetMapping("/links/edit")
|
||||
public String toEditLink(Model model,@PathParam("linkId") Long linkId){
|
||||
|
@ -87,8 +87,8 @@ public class PageController {
|
|||
/**
|
||||
* 处理添加/修改友链的请求并渲染页面
|
||||
*
|
||||
* @param link Link
|
||||
* @return freemarker
|
||||
* @param link Link实体
|
||||
* @return 重定向到/admin/page/links
|
||||
*/
|
||||
@PostMapping(value = "/links/save")
|
||||
public String saveLink(@ModelAttribute Link link){
|
||||
|
@ -104,8 +104,8 @@ public class PageController {
|
|||
/**
|
||||
* 处理删除友情链接的请求并重定向
|
||||
*
|
||||
* @param linkId linkId
|
||||
* @return String
|
||||
* @param linkId 友情链接编号
|
||||
* @return 重定向到/admin/page/links
|
||||
*/
|
||||
@GetMapping(value = "/links/remove")
|
||||
public String removeLink(@PathParam("linkId") Long linkId){
|
||||
|
@ -121,7 +121,10 @@ public class PageController {
|
|||
/**
|
||||
* 图库管理
|
||||
*
|
||||
* @return String
|
||||
* @param model model
|
||||
* @param page 当前页码
|
||||
* @param size 每页显示的条数
|
||||
* @return 模板路径admin/admin_page_gallery
|
||||
*/
|
||||
@GetMapping(value = "/galleries")
|
||||
public String gallery(Model model,
|
||||
|
@ -139,7 +142,7 @@ public class PageController {
|
|||
* 保存图片
|
||||
*
|
||||
* @param gallery gallery
|
||||
* @return string
|
||||
* @return 重定向到/admin/page/gallery
|
||||
*/
|
||||
@PostMapping(value = "/gallery/save")
|
||||
public String saveGallery(@ModelAttribute Gallery gallery){
|
||||
|
@ -158,8 +161,8 @@ public class PageController {
|
|||
* 处理获取图片详情的请求
|
||||
*
|
||||
* @param model model
|
||||
* @param galleryId galleryId
|
||||
* @return string
|
||||
* @param galleryId 图片编号
|
||||
* @return 模板路径admin/widget/_gallery-detail
|
||||
*/
|
||||
@GetMapping(value = "/gallery")
|
||||
public String gallery(Model model,@PathParam("galleryId") Long galleryId){
|
||||
|
@ -173,8 +176,8 @@ public class PageController {
|
|||
/**
|
||||
* 删除图库中的图片
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return string
|
||||
* @param galleryId 图片编号
|
||||
* @return true:删除成功,false:删除失败
|
||||
*/
|
||||
@GetMapping(value = "/gallery/remove")
|
||||
@ResponseBody
|
||||
|
|
|
@ -54,10 +54,10 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理后台获取文章列表的请求
|
||||
*
|
||||
* @param model Model
|
||||
* @param page Page
|
||||
* @param size Size
|
||||
* @return String
|
||||
* @param model model
|
||||
* @param page 当前页码
|
||||
* @param size 每页显示的条数
|
||||
* @return 模板路径admin/admin_post
|
||||
*/
|
||||
@GetMapping
|
||||
public String posts(Model model,
|
||||
|
@ -83,10 +83,10 @@ public class PostController extends BaseController{
|
|||
* 模糊查询文章
|
||||
*
|
||||
* @param model Model
|
||||
* @param keyword keyword
|
||||
* @param page page
|
||||
* @param size size
|
||||
* @return freemarker
|
||||
* @param keyword keyword 关键字
|
||||
* @param page page 当前页码
|
||||
* @param size size 每页显示条数
|
||||
* @return 模板路径admin/admin_post
|
||||
*/
|
||||
@PostMapping(value="/search")
|
||||
public String searchPost(Model model,
|
||||
|
@ -107,9 +107,9 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理预览文章的请求
|
||||
*
|
||||
* @param postId postId
|
||||
* @param postId 文章编号
|
||||
* @param model model
|
||||
* @return freemarker
|
||||
* @return 模板路径/themes/{theme}/post
|
||||
*/
|
||||
@GetMapping(value = "/view")
|
||||
public String viewPost(@PathParam("postId") Long postId,Model model){
|
||||
|
@ -123,7 +123,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理跳转到新建文章页面
|
||||
*
|
||||
* @return freemarker
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_editor
|
||||
*/
|
||||
@GetMapping(value = "/new")
|
||||
public String newPost(Model model){
|
||||
|
@ -144,7 +145,10 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 添加文章
|
||||
*
|
||||
* @param post Post
|
||||
* @param post Post实体
|
||||
* @param cateList 分类列表
|
||||
* @param tagList 标签列表
|
||||
* @param session session
|
||||
*/
|
||||
@PostMapping(value = "/new/push")
|
||||
@ResponseBody
|
||||
|
@ -178,8 +182,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理移至回收站的请求
|
||||
*
|
||||
* @param postId postId
|
||||
* @return String
|
||||
* @param postId 文章编号
|
||||
* @return 重定向到/admin/posts
|
||||
*/
|
||||
@GetMapping("/throw")
|
||||
public String moveToTrash(@RequestParam("postId") Long postId){
|
||||
|
@ -195,8 +199,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理文章为发布的状态
|
||||
*
|
||||
* @param postId postId
|
||||
* @return String
|
||||
* @param postId 文章编号
|
||||
* @return 重定向到/admin/posts
|
||||
*/
|
||||
@GetMapping("/revert")
|
||||
public String moveToPublish(@RequestParam("postId") Long postId,
|
||||
|
@ -213,8 +217,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理删除文章的请求
|
||||
*
|
||||
* @param postId postId
|
||||
* @return 转发
|
||||
* @param postId 文章编号
|
||||
* @return 重定向到/admin/posts
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
public String removePost(@PathParam("postId") Long postId){
|
||||
|
@ -231,9 +235,9 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 跳转到编辑文章页面
|
||||
*
|
||||
* @param postId postId
|
||||
* @param model Model
|
||||
* @return String
|
||||
* @param postId 文章编号
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_editor
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String editPost(@PathParam("postId") Long postId, Model model){
|
||||
|
@ -254,8 +258,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 更新所有摘要
|
||||
*
|
||||
* @param postSummary postSummary
|
||||
* @return string
|
||||
* @param postSummary 文章摘要字数
|
||||
* @return true:更新成功,false:更新失败
|
||||
*/
|
||||
@GetMapping(value = "/updateSummary")
|
||||
@ResponseBody
|
||||
|
@ -272,8 +276,8 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 验证文章路径是否已经存在
|
||||
*
|
||||
* @param postUrl postUrl
|
||||
* @return String
|
||||
* @param postUrl 文章路径
|
||||
* @return true:不存在,false:已存在
|
||||
*/
|
||||
@GetMapping(value = "/checkUrl")
|
||||
@ResponseBody
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TagController {
|
|||
* 渲染标签管理页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return 模板路径admin/admin_tag
|
||||
*/
|
||||
@GetMapping
|
||||
public String tags(Model model){
|
||||
|
@ -46,7 +46,7 @@ public class TagController {
|
|||
* 新增/修改标签
|
||||
*
|
||||
* @param tag tag
|
||||
* @return string
|
||||
* @return 重定向到/admin/tag
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String saveTag(@ModelAttribute Tag tag){
|
||||
|
@ -61,8 +61,8 @@ public class TagController {
|
|||
/**
|
||||
* 验证是否存在该路径
|
||||
*
|
||||
* @param tagUrl tagUrl
|
||||
* @return string
|
||||
* @param tagUrl 标签路径名
|
||||
* @return true:不存在,false:已存在
|
||||
*/
|
||||
@GetMapping(value = "/checkUrl")
|
||||
@ResponseBody
|
||||
|
@ -78,8 +78,8 @@ public class TagController {
|
|||
/**
|
||||
* 处理删除标签的请求
|
||||
*
|
||||
* @param tagId tagId
|
||||
* @return string
|
||||
* @param tagId 标签编号
|
||||
* @return 重定向到/admin/tag
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
public String removeTag(@PathParam("tagId") Long tagId){
|
||||
|
@ -96,8 +96,8 @@ public class TagController {
|
|||
* 跳转到修改标签页面
|
||||
*
|
||||
* @param model model
|
||||
* @param tagId tagId
|
||||
* @return string
|
||||
* @param tagId 标签编号
|
||||
* @return 模板路径admin/admin_tag
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String toEditTag(Model model,@PathParam("tagId") Long tagId){
|
||||
|
|
|
@ -43,7 +43,8 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 渲染主题设置页面
|
||||
*
|
||||
* @return String
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_theme
|
||||
*/
|
||||
@GetMapping
|
||||
public String themes(Model model){
|
||||
|
@ -59,7 +60,9 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 激活主题
|
||||
*
|
||||
* @param siteTheme siteTheme
|
||||
* @param siteTheme 主题名称
|
||||
* @param request request
|
||||
* @return true:激活成功,false:激活失败
|
||||
*/
|
||||
@GetMapping(value = "/set")
|
||||
@ResponseBody
|
||||
|
@ -85,8 +88,8 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 上传主题
|
||||
*
|
||||
* @param file file
|
||||
* @return String
|
||||
* @param file 文件
|
||||
* @return boolean true:上传成功,false:上传失败
|
||||
*/
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
|
@ -108,14 +111,34 @@ public class ThemeController extends BaseController{
|
|||
HaloConst.THEMES = HaloUtil.getThemes();
|
||||
return true;
|
||||
}else{
|
||||
log.error("上传失败,没有选择文件");
|
||||
log.error("上传主题失败,没有选择文件");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("上传失败:{0}",e.getMessage());
|
||||
log.error("上传主题失败:{0}",e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主题
|
||||
*
|
||||
* @param themeName 主题文件夹名
|
||||
* @return string 重定向到/admin/themes
|
||||
*/
|
||||
@GetMapping(value = "/remove")
|
||||
public String removeTheme(@RequestParam("themeName") String themeName){
|
||||
try{
|
||||
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
File themePath = new File(basePath.getAbsolutePath(),"templates/themes/"+themeName);
|
||||
HaloUtil.removeDir(themePath);
|
||||
HaloConst.THEMES.clear();
|
||||
HaloConst.THEMES = HaloUtil.getThemes();
|
||||
}catch (Exception e){
|
||||
log.error("删除主题失败:{0}",e.getMessage());
|
||||
}
|
||||
return "redirect:/admin/themes";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到主题设置
|
||||
*
|
||||
|
@ -132,7 +155,8 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 编辑主题
|
||||
*
|
||||
* @return string
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_theme-editor
|
||||
*/
|
||||
@GetMapping(value = "/editor")
|
||||
public String editor(Model model){
|
||||
|
@ -146,7 +170,8 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 获取模板文件内容
|
||||
*
|
||||
* @return string
|
||||
* @param tplName 模板文件名
|
||||
* @return 模板内容
|
||||
*/
|
||||
@GetMapping(value = "/getTpl",produces = "text/text;charset=UTF-8")
|
||||
@ResponseBody
|
||||
|
@ -167,9 +192,9 @@ public class ThemeController extends BaseController{
|
|||
/**
|
||||
* 保存修改模板
|
||||
*
|
||||
* @param tplName tplName
|
||||
* @param tplContent tplContent
|
||||
* @return string
|
||||
* @param tplName 模板名称
|
||||
* @param tplContent 模板内容
|
||||
* @return boolean true:修改成功,false:修改失败
|
||||
*/
|
||||
@PostMapping(value = "/editor/save")
|
||||
@ResponseBody
|
||||
|
|
|
@ -29,7 +29,8 @@ public class UserController {
|
|||
/**
|
||||
* 获取用户信息并跳转
|
||||
*
|
||||
* @return string
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_profile
|
||||
*/
|
||||
@GetMapping
|
||||
public String profile(Model model){
|
||||
|
@ -43,7 +44,8 @@ public class UserController {
|
|||
* 处理修改用户资料的请求
|
||||
*
|
||||
* @param user user
|
||||
* @return String
|
||||
* @param session session
|
||||
* @return true:修改成功,false:修改失败
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
|
@ -65,9 +67,11 @@ public class UserController {
|
|||
/**
|
||||
* 处理修改密码的请求
|
||||
*
|
||||
* @param beforePass 之前的密码
|
||||
* @param beforePass 旧密码
|
||||
* @param newPass 新密码
|
||||
* @return String
|
||||
* @param userId 用户编号
|
||||
* @param session session
|
||||
* @return true:修改密码成功,false:修改密码失败
|
||||
*/
|
||||
@PostMapping(value = "changePass")
|
||||
@ResponseBody
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<#if tags??>
|
||||
<option value="">选择添加</option>
|
||||
<#list tags as tag>
|
||||
<option value="${tag.tagName}">${tag.tagName}</option>
|
||||
<option value="${tag.tagName}">${tag.tagName}(${tag.posts?size})</option>
|
||||
</#list>
|
||||
<#else>
|
||||
<option>暂无标签</option>
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
background: #3c8dbc;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-delete:hover{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<section class="content-header">
|
||||
<h1 style="display: inline-block;">主题设置</h1>
|
||||
|
@ -85,7 +88,9 @@
|
|||
<#list themes as theme>
|
||||
<div class="col-md-3">
|
||||
<div class="box box-solid">
|
||||
<div class="box-body theme-thumbnail" style="background-image: url(/${theme.themeName?if_exists}/screenshot.png)"></div>
|
||||
<div class="box-body theme-thumbnail" style="background-image: url(/${theme.themeName?if_exists}/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>
|
||||
<div class="box-footer">
|
||||
<span class="theme-title">${theme.themeName?if_exists?upper_case}</span>
|
||||
<#if theme.hasOptions==true>
|
||||
|
@ -112,6 +117,25 @@
|
|||
</#if>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 删除确认弹出层 -->
|
||||
<div class="modal fade" id="removeThemeModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content message_align">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">提示信息</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="message">你确定要删除该主题?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="hidden" id="url"/>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<a onclick="removeIt()" class="btn btn-danger" data-dismiss="modal">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
|
||||
<script src="/static/plugins/layer/layer.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
@ -203,6 +227,20 @@
|
|||
scrollbar: false
|
||||
});
|
||||
}
|
||||
$('.theme-thumbnail').mouseover(function () {
|
||||
$(this).children('.btn-delete').show();
|
||||
});
|
||||
$('.theme-thumbnail').mouseleave(function () {
|
||||
$(this).children('.btn-delete').hide();
|
||||
});
|
||||
function modelShow(url) {
|
||||
$('#url').val(url);
|
||||
$('#removeThemeModal').modal();
|
||||
}
|
||||
function removeIt(){
|
||||
var url=$.trim($("#url").val());
|
||||
window.location.href=url;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<#include "module/_footer.ftl">
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<#if (options.comment_system!)=='valine'>
|
||||
<#include "../../../common/comment/_valine_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='disqus'>
|
||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='livere'>
|
||||
<#include "../../../common/comment/_livere_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='changyan'>
|
||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='native'>
|
||||
<#switch options.comment_system>
|
||||
<#case "native">
|
||||
<#include "../../../common/comment/_native_comment.ftl">
|
||||
</#if>
|
||||
<#break >
|
||||
<#case "valine">
|
||||
<#include "../../../common/comment/_valine_comment.ftl">
|
||||
<#break >
|
||||
<#case "disqus">
|
||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||
<#break >
|
||||
<#case "livere">
|
||||
<#include "../../../common/comment/_livere_comment.ftl">
|
||||
<#break >
|
||||
<#case "changyan">
|
||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||
<#break >
|
||||
</#switch>
|
|
@ -20,10 +20,12 @@
|
|||
<span class="date">${post.postDate?string("yyyy-MM-dd")}</span>
|
||||
<i class="fa fa-comment-o"></i>
|
||||
<a href="/post/${post.postUrl}#comment_widget">Comments</a>
|
||||
<i class="fa fa-tag"></i>
|
||||
<a href="/tags/App" class="tag"> App</a>
|
||||
<a href="/tags/Evernote" class="tag"> Evernote</a>
|
||||
<a href="/tags/Mac" class="tag"> Mac</a>
|
||||
<if post.tags??>
|
||||
<i class="fa fa-tag"></i>
|
||||
<#list post.tags as tag>
|
||||
<a href="/tags/${tag.tagUrl}" class="tag"> ${tag.tagName}</a>
|
||||
</#list>
|
||||
</if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<a href="/">${options.site_title?default("ANATOLE")}</a>
|
||||
</h3>
|
||||
<div class="description">
|
||||
<p>${user.userDesc?default("A other farbox theme")}</p>
|
||||
<p>${user.userDesc?default("A other Halo theme")}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
<span class="date">${post.postDate?string("yyyy-MM-dd")}</span>
|
||||
<i class="fa fa-comment-o"></i>
|
||||
<a href="/post/${post.postUrl}#comment_widget">Comments</a>
|
||||
<i class="fa fa-tag"></i>
|
||||
<a href="/tags/App" class="tag"> App</a>
|
||||
<a href="/tags/Evernote" class="tag"> Evernote</a>
|
||||
<a href="/tags/Mac" class="tag"> Mac</a>
|
||||
<if post.tags??>
|
||||
<i class="fa fa-tag"></i>
|
||||
<#list post.tags as tag>
|
||||
<a href="/tags/${tag.tagUrl}" class="tag"> ${tag.tagName}</a>
|
||||
</#list>
|
||||
</if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<#if (options.comment_system!)=='valine'>
|
||||
<#include "../../../common/comment/_valine_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='disqus'>
|
||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='livere'>
|
||||
<#include "../../../common/comment/_livere_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='changyan'>
|
||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||
<#elseif (options.comment_system!)=='native'>
|
||||
<#include "../../../common/comment/_native_comment.ftl">
|
||||
</#if>
|
||||
<#switch options.comment_system>
|
||||
<#case "native">
|
||||
<#include "../../../common/comment/_native_comment.ftl">
|
||||
<#break >
|
||||
<#case "valine">
|
||||
<#include "../../../common/comment/_valine_comment.ftl">
|
||||
<#break >
|
||||
<#case "disqus">
|
||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||
<#break >
|
||||
<#case "livere">
|
||||
<#include "../../../common/comment/_livere_comment.ftl">
|
||||
<#break >
|
||||
<#case "changyan">
|
||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||
<#break >
|
||||
</#switch>
|
Loading…
Reference in New Issue