🐛 修复Anatole主题菜单高亮问题

pull/1/head
RYAN0UP_ 2018-04-24 17:56:21 +08:00
parent f00877c8de
commit 602059fb2a
5 changed files with 100 additions and 93 deletions

View File

@ -3,7 +3,6 @@
> Halo may be the best Java blog system. | Halo可能是最好的Java博客系统。
[![JDK](https://img.shields.io/badge/JDK-1.8-yellow.svg)](#)
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.0.1-green.svg)](https://github.com/spring-projects/spring-boot)
[![GitHub release](https://img.shields.io/github/release/ruibaby/halo.svg)](https://github.com/ruibaby/halo/releases)
[![Travis CI](https://img.shields.io/travis/ruibaby/halo.svg)](https://travis-ci.org/ruibaby/halo)

14
pom.xml
View File

@ -13,7 +13,7 @@
<developers>
<developer>
<id>RYAN0UP</id>
<id>ruibaby</id>
<name>Ryan Wang</name>
<email>i@ryanc.cc</email>
<url>https://ryanc.cc</url>
@ -94,12 +94,12 @@
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- ehCache -->
<dependency>

View File

@ -249,6 +249,8 @@ public class IndexController extends BaseController{
User user = userService.findUser();
model.addAttribute("user",user);
model.addAttribute("is_gallery",true);
//设置选项
model.addAttribute("options",HaloConst.OPTIONS);
return this.render("gallery");

View File

@ -126,39 +126,33 @@
</div>
<#if options.widget_postcount?default("true")=="true">
<div class="col-lg-3 col-xs-6" id="widgetPostCountBody">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner"><h3>${postCount?default(0)}</h3><p>文章</p></div>
<div class="icon"><i class="ion ion-bag"></i></div>
<a href="/admin/posts" class="small-box-footer">查看所有 <i class="fa fa-arrow-circle-right"></i></a>
<a data-pjax="true" href="/admin/posts" class="small-box-footer">查看所有 <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</#if>
<#if options.widget_commentcount?default("true")=="true">
<div class="col-lg-3 col-xs-6" id="widgetCommentCountBody">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner"><h3>${commentCount?default(0)}</h3><p>评论</p></div>
<div class="icon"><i class="ion ion-stats-bars"></i></div>
<a href="/admin/comments" class="small-box-footer">查看所有 <i class="fa fa-arrow-circle-right"></i></a>
<a data-pjax="true" href="/admin/comments" class="small-box-footer">查看所有 <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</#if>
<!-- ./col -->
<#if options.widget_attachmentcount?default("true")=="true">
<div class="col-lg-3 col-xs-6" id="widgetAttachmentCountBody">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner"><h3>${mediaCount?default(0)}</h3><p>媒体库</p></div>
<div class="icon"><i class="ion ion-person-add"></i></div>
<a href="/admin/attachments" class="small-box-footer">上传图片 <i class="fa fa-arrow-circle-right"></i></a>
<a data-pjax="true" href="/admin/attachments" class="small-box-footer">上传图片 <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</#if>
<!-- ./col -->
<#if options.widget_daycount?default("true")=="true">
<div class="col-lg-3 col-xs-6" id="widgetDayCountBody">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner"><h3 id="blogStart">1</h3><p>成立天数</p></div>
<div class="icon"><i class="ion ion-pie-graph"></i></div>
@ -166,7 +160,6 @@
</div>
</div>
</#if>
<!-- ./col -->
</div>
<div class="row">
@ -192,27 +185,25 @@
</thead>
<tbody>
<#if postTopFive??>
<tr>
<#list postTopFive as post>
<tr>
<#if post.postStatus == 0>
<td><a target="_blank" href="/archives/${post.postUrl}">${post.postTitle}</a></td>
<#else >
<td>${post.postTitle}</td>
<#list postTopFive as post>
<tr>
<#if post.postStatus == 0>
<td><a target="_blank" href="/archives/${post.postUrl}">${post.postTitle}</a></td>
<#else >
<td>${post.postTitle}</td>
</#if>
<td class="text-center">
<#if post.postStatus==0>
<span class="label bg-green">已发布</span>
<#elseif post.postStatus==1>
<span class="label bg-yellow">草&emsp;稿</span>
<#else>
<span class="label bg-red">回收站</span>
</#if>
<td class="text-center">
<#if post.postStatus==0>
<span class="label bg-green">已发布</span>
<#elseif post.postStatus==1>
<span class="label bg-yellow">草&emsp;稿</span>
<#else>
<span class="label bg-red">回收站</span>
</#if>
</td>
<td>${post.postDate?if_exists?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
</tr>
</td>
<td>${post.postDate?if_exists?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
<#else>
<tr><td>暂无数据</td></tr>
</#if>
@ -236,51 +227,51 @@
<div class="box-body table-responsive">
<table class="table table-bordered table-hover text-center">
<thead>
<th>评论者</th>
<th>评论页面</th>
<th>内容</th>
<th>状态</th>
<th>时间</th>
<tr>
<th>评论者</th>
<th>评论页面</th>
<th>内容</th>
<th>状态</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<#if comments??>
<tr>
<#list comments as comment>
<tr>
<td>${comment.commentAuthor}</td>
<td>
<a target="_blank" href="/archives/${comment.post.getPostUrl()}">${comment.post.postTitle}</a>
</td>
<td>
<#switch comment.commentStatus>
<#case 0>
<a href="/admin/comments">${comment.commentContent}</a>
<#break>
<#case 1>
<a href="/admin/comments?status=1">${comment.commentContent}</a>
<#break>
<#case 2>
<a href="/admin/comments?status=2">${comment.commentContent}</a>
<#break>
</#switch>
</td>
<td>
<#switch comment.commentStatus>
<#list comments as comment>
<tr>
<td>${comment.commentAuthor}</td>
<td>
<a target="_blank" href="/archives/${comment.post.getPostUrl()}">${comment.post.postTitle}</a>
</td>
<td>
<#switch comment.commentStatus>
<#case 0>
<span class="label bg-green">已发布</span>
<#break >
<a href="/admin/comments">${comment.commentContent}</a>
<#break>
<#case 1>
<span class="label bg-yellow">待审核</span>
<#break >
<a href="/admin/comments?status=1">${comment.commentContent}</a>
<#break>
<#case 2>
<span class="label bg-red">回收站</span>
<#break >
</#switch>
</td>
<td>${comment.commentDate?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
</tr>
<a href="/admin/comments?status=2">${comment.commentContent}</a>
<#break>
</#switch>
</td>
<td>
<#switch comment.commentStatus>
<#case 0>
<span class="label bg-green">已发布</span>
<#break >
<#case 1>
<span class="label bg-yellow">待审核</span>
<#break >
<#case 2>
<span class="label bg-red">回收站</span>
<#break >
</#switch>
</td>
<td>${comment.commentDate?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
<#else>
<tr><td>暂无数据</td></tr>
</#if>
@ -312,23 +303,23 @@
<div class="box-body table-responsive">
<table class="table table-bordered table-hover text-center">
<thead>
<th>事件</th>
<th>结果</th>
<th>IP</th>
<th>时间</th>
<tr>
<th>事件</th>
<th>结果</th>
<th>IP</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<#if logs??>
<tr>
<#list logs as log>
<tr>
<td>${log.logTitle}</td>
<td>${log.logContent}</td>
<td>${log.logIp}</td>
<td>${log.logCreated?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
</tr>
<#list logs as log>
<tr>
<td>${log.logTitle}</td>
<td>${log.logContent}</td>
<td>${log.logIp}</td>
<td>${log.logCreated?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
<#else>
<tr><td>暂无数据</td></tr>
</#if>

View File

@ -9,8 +9,8 @@
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<meta name="renderer" content="webkit">
<meta name="author" content="${keywords?default("Anatole")}" />
<meta name="keywords" content=""/>
<meta name="author" content="" />
<meta name="keywords" content="${keywords?default("Anatole")}"/>
<meta name="description" content="${description?default("Anatole")}" />
<link rel="shortcut icon" href="/anatole/source/images/favicon.png" type="image/x-icon" />
<link href="/anatole/source/css/font-awesome.min.css" type="text/css" rel="stylesheet"/>
@ -24,6 +24,21 @@
<script type="text/javascript" src="/anatole/source/js/jquery.js"></script>
<script type="text/javascript" src="/anatole/source/js/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="/anatole/source/js/jquery.appear.js"></script>
<script type="text/javascript">
var url = location.href;
var urlstatus = false;
$(".nav li a").each(function () {
if ((url + '/').indexOf($(this).attr('href')) > -1 && $(this).attr('href') != '/') {
$(this).addClass('current');
urlstatus = true;
} else {
$(this).removeClass('current');
}
});
if (!urlstatus) {
$(".nav li a").eq(0).addClass('current');
}
</script>
</body>
</html>
</#macro>