👽 我也不知道改了啥:(

pull/1/head
RYAN0UP_ 2018-03-28 21:58:29 +08:00
parent 73ef224233
commit cac1520406
6 changed files with 169 additions and 34 deletions

View File

@ -48,6 +48,9 @@ public class InstallController {
@Autowired
private CommentService commentService;
@Autowired
private MenuService menuService;
/**
*
*
@ -92,9 +95,6 @@ public class InstallController {
}else{
installFile.createNewFile();
}
//保存title设置
optionsService.saveOption("site_title",siteTitle);
optionsService.saveOption("site_url",siteUrl);
//创建新的用户
User user= new User();
@ -144,6 +144,10 @@ public class InstallController {
comment.setIsAdmin(0);
commentService.saveByComment(comment);
//保存博客标题和博客地址设置
optionsService.saveOption("site_title",siteTitle);
optionsService.saveOption("site_url",siteUrl);
//设置默认主题
optionsService.saveOption("theme","halo");
@ -171,6 +175,20 @@ public class InstallController {
)
);
Menu menuIndex = new Menu();
menuIndex.setMenuName("首页");
menuIndex.setMenuUrl("/");
menuIndex.setMenuSort(1);
menuIndex.setMenuIcon("");
menuService.saveByMenu(menuIndex);
Menu menuArchive = new Menu();
menuArchive.setMenuName("归档");
menuArchive.setMenuUrl("/archives");
menuArchive.setMenuSort(2);
menuArchive.setMenuIcon("");
menuService.saveByMenu(menuArchive);
HaloConst.OPTIONS.clear();
HaloConst.OPTIONS = optionsService.findAllOptions();
}catch (Exception e){

View File

@ -9,6 +9,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.util.List;
/**
@ -74,4 +75,19 @@ public class MenuController {
model.addAttribute("options", HaloConst.OPTIONS);
return "/admin/admin_menu";
}
/**
*
* @param menuId menuId
* @return String
*/
@GetMapping(value = "/remove")
public String removeMenu(@PathParam("menuId") Long menuId){
try {
menuService.removeByMenuId(menuId);
}catch (Exception e){
log.error("删除菜单失败:{0}",e.getMessage());
}
return "redirect:/admin/menus";
}
}

View File

@ -56,7 +56,7 @@ public class PageController {
//设置选项
model.addAttribute("options", HaloConst.OPTIONS);
return "admin/admin_link";
return "admin/admin_page_link";
}
/**
@ -75,7 +75,7 @@ public class PageController {
model.addAttribute("links",links);
//设置选项
model.addAttribute("options",HaloConst.OPTIONS);
return "admin/admin_link";
return "admin/admin_page_link";
}
/**

View File

@ -105,7 +105,7 @@
<#else>
<a data-pjax="true" href="/admin/menus/edit?menuId=${menu.menuId}" class="btn btn-primary btn-xs btn-flat">修改</a>
</#if>
<button class="btn btn-danger btn-xs btn-flat" onclick="modelShow()">删除</button>
<button class="btn btn-danger btn-xs btn-flat" onclick="modelShow('/admin/menus/remove?menuId=${menu.menuId}')">删除</button>
</td>
</tr>
</#list>
@ -116,6 +116,33 @@
</div>
</div>
</section>
<!-- 删除确认弹出层 -->
<div class="modal fade" id="removeMenuModal">
<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>您确认要删除吗?</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>
function modelShow(url) {
$('#url').val(url);
$('#removeMenuModal').modal();
}
function removeIt(){
var url=$.trim($("#url").val());
window.location.href=url;
}
</script>
</div>
<#include "module/_footer.ftl">
</div>

View File

@ -9,6 +9,64 @@
<#include "module/_sidebar.ftl">
<div class="content-wrapper">
<link rel="stylesheet" href="/static/plugins/toast/css/jquery.toast.min.css">
<style>
.tag-cloud .label{
padding: .3em .9em .45em;
font-size: 100%;
font-weight: 400;
}
.tag-cloud{
margin-bottom: 11px;
margin-right: 3px;
display: inline-block;
float: left;
}
.bg-color-1{
background-color: #3c8dbc;
}
.bg-color-2{
background-color: #00a65a;
}
.bg-color-3{
background-color: #001f3f;
}
.bg-color-4{
background-color: #39cccc;
}
.bg-color-5{
background-color: #3d9970;
}
.bg-color-6{
background-color: #01ff70;
}
.bg-color-7{
background-color: #ff851b;
}
.bg-color-8{
background-color: #f012be;
}
.bg-color-9{
background-color: #605ca8;
}
.bg-color-10{
background-color: #d81b60;
}
.bg-color-11{
background-color: #dd4b39;
}
.bg-color-12{
background-color: #f39c12;
}
.bg-color-13{
background-color: #00c0ef;
}
.bg-color-14{
background-color: #0073b7;
}
.bg-color-15{
background-color: #111111;
}
</style>
<section class="content-header">
<h1>
标签
@ -76,40 +134,56 @@
<h3 class="box-title">所有标签</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>路径</th>
<th>总数</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<#list tags as tag>
<tr>
<td>${tag.tagName}</td>
<td>${tag.tagUrl}</td>
<td>2</td>
<td>
<#if updateTag ?? && tag.tagId==updateTag.tagId>
<a class="btn btn-primary btn-xs btn-flat" href="#" disabled>正在修改</a>
<#else >
<a data-pjax="true" class="btn btn-primary btn-xs btn-flat" href="/admin/tag/edit?tagId=${tag.tagId}">修改</a>
</#if>
<button class="btn btn-danger btn-xs btn-flat" onclick="modelShow('/admin/tag/remove?tagId=${tag.tagId}')">删除</button>
</td>
</tr>
</#list>
</tbody>
</table>
<#--<table class="table table-hover">-->
<#--<thead>-->
<#--<tr>-->
<#--<th>名称</th>-->
<#--<th>路径</th>-->
<#--<th>总数</th>-->
<#--<th>操作</th>-->
<#--</tr>-->
<#--</thead>-->
<#--<tbody>-->
<#--<#list tags as tag>-->
<#--<tr>-->
<#--<td>${tag.tagName}</td>-->
<#--<td>${tag.tagUrl}</td>-->
<#--<td>2</td>-->
<#--<td>-->
<#--<#if updateTag ?? && tag.tagId==updateTag.tagId>-->
<#--<a class="btn btn-primary btn-xs btn-flat" href="#" disabled>正在修改</a>-->
<#--<#else >-->
<#--<a data-pjax="true" class="btn btn-primary btn-xs btn-flat" href="/admin/tag/edit?tagId=${tag.tagId}">修改</a>-->
<#--</#if>-->
<#--<button class="btn btn-danger btn-xs btn-flat" onclick="modelShow('/admin/tag/remove?tagId=${tag.tagId}')">删除</button>-->
<#--</td>-->
<#--</tr>-->
<#--</#list>-->
<#--</tbody>-->
<#--</table>-->
<#list tags as tag>
<div class="tag-cloud">
<a class="tag-link" data-pjax="true" href="/admin/tag/edit?tagId=${tag.tagId}">
<span class="label">${tag.tagName}(2)</span>
</a>
</div>
</#list>
<script>
var randomNum;
var tagLabel = $('.tag-link');
for(var i = 0; i < ${tags?size}; i++) {
randomNum = Math.floor(Math. random() * 15 + 1);
tagLabel.children('.label').addClass("bg-color-"+randomNum);
tagLabel = tagLabel.next();
}
</script>
</div>
</div>
</div>
</div>
</section>
<!-- 删除确认弹出层 -->
<div class="modal fade" id="removeCateModal">
<div class="modal fade label-primary" id="removeCateModal">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">