mirror of https://github.com/halo-dev/halo
🍱 添加图库模块
parent
acdc9cd2b1
commit
858e45e76f
|
@ -3,7 +3,7 @@
|
|||
> Halo may be the best Java blog system. | Halo可能是最好的Java博客系统。
|
||||
|
||||
[](#)
|
||||
[](https://github.com/spring-projects/spring-boot)
|
||||
[](https://github.com/spring-projects/spring-boot)
|
||||
[](https://github.com/ruibaby/halo/releases)
|
||||
|
||||
------------------------------
|
||||
|
@ -39,7 +39,7 @@ Fast,simple,powerful blog system powered by Java.
|
|||
|
||||
## Docs 文档
|
||||
|
||||
### [Halo Document]()
|
||||
### [Halo Document](https://halo-doc.ryanc.cc)
|
||||
|
||||
>文档正在整理中。
|
||||
|
||||
|
@ -51,7 +51,7 @@ Fast,simple,powerful blog system powered by Java.
|
|||
|
||||
Halo的诞生离不开下面这些项目:
|
||||
|
||||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/):个人认为强大的Java IDE,没有之一
|
||||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/):个人认为最强大的Java IDE,没有之一
|
||||
- [Spring Boot](https://github.com/spring-projects/spring-boot):Spring的微服务框架
|
||||
- [Freemarker](https://freemarker.apache.org/):模板引擎,使页面静态化
|
||||
- [H2 Database](https://github.com/h2database/h2database):嵌入式数据库,无需安装
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.0.RELEASE</version>
|
||||
<version>2.0.1.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class Gallery implements Serializable {
|
|||
/**
|
||||
* 图片日期/拍摄日期
|
||||
*/
|
||||
private Date galleryDate;
|
||||
private String galleryDate;
|
||||
|
||||
/**
|
||||
* 图片拍摄地点
|
||||
|
|
|
@ -2,9 +2,6 @@ package cc.ryanc.halo.repository;
|
|||
|
||||
import cc.ryanc.halo.model.domain.Menu;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
|
|
@ -5,12 +5,12 @@ import cc.ryanc.halo.repository.CategoryRepository;
|
|||
import cc.ryanc.halo.service.CategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.swing.text.html.Option;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
|
|
@ -5,7 +5,6 @@ import cc.ryanc.halo.repository.LinkRepository;
|
|||
import cc.ryanc.halo.service.LinkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
|
@ -27,15 +27,39 @@ public class CommonController implements ErrorController{
|
|||
* @return string
|
||||
*/
|
||||
@GetMapping(value = ERROR_PATH)
|
||||
public String handleError(HttpServletRequest request, Model model){
|
||||
public String handleError(HttpServletRequest request){
|
||||
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
|
||||
if(statusCode==404) {
|
||||
return "redirect:/404";
|
||||
}else{
|
||||
return "redirect:/500";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染404页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping(value = "/404")
|
||||
public String fourZeroFour(Model model){
|
||||
//设置选项
|
||||
model.addAttribute("options", HaloConst.OPTIONS);
|
||||
if(statusCode==404) {
|
||||
return "common/404";
|
||||
}else{
|
||||
return "common/500";
|
||||
}
|
||||
return "common/404";
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染500页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping(value = "/500")
|
||||
public String fiveZeroZero(Model model){
|
||||
//设置选项
|
||||
model.addAttribute("options", HaloConst.OPTIONS);
|
||||
return "common/500";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package cc.ryanc.halo.web.controller.admin;
|
||||
|
||||
import cc.ryanc.halo.service.GalleryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping(value = "/admin/gallery")
|
||||
public class GalleryController {
|
||||
|
||||
@Autowired
|
||||
private GalleryService galleryService;
|
||||
|
||||
@GetMapping
|
||||
public String gallery(){
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -1,16 +1,19 @@
|
|||
package cc.ryanc.halo.web.controller.admin;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Gallery;
|
||||
import cc.ryanc.halo.model.domain.Link;
|
||||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.service.GalleryService;
|
||||
import cc.ryanc.halo.service.LinkService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
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.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.List;
|
||||
|
@ -30,6 +33,9 @@ public class PageController {
|
|||
@Autowired
|
||||
private LinkService linkService;
|
||||
|
||||
@Autowired
|
||||
private GalleryService galleryService;
|
||||
|
||||
/**
|
||||
* 页面管理页面
|
||||
*
|
||||
|
@ -117,9 +123,68 @@ public class PageController {
|
|||
*
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = "/gallery")
|
||||
public String gallery(Model model){
|
||||
@GetMapping(value = "/galleries")
|
||||
public String gallery(Model model,
|
||||
@RequestParam(value = "page",defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "size",defaultValue = "18") Integer size){
|
||||
Sort sort = new Sort(Sort.Direction.DESC,"galleryId");
|
||||
Pageable pageable = new PageRequest(page,size,sort);
|
||||
Page<Gallery> galleries = galleryService.findAllGalleries(pageable);
|
||||
model.addAttribute("galleries",galleries);
|
||||
model.addAttribute("options",HaloConst.OPTIONS);
|
||||
return "admin/admin_page_gallery";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存图片
|
||||
*
|
||||
* @param gallery gallery
|
||||
* @return string
|
||||
*/
|
||||
@PostMapping(value = "/gallery/save")
|
||||
public String saveGallery(@ModelAttribute Gallery gallery){
|
||||
try {
|
||||
if("".equals(gallery.getGalleryThumbnailUrl()) || ""==gallery.getGalleryThumbnailUrl()){
|
||||
gallery.setGalleryThumbnailUrl(gallery.getGalleryUrl());
|
||||
}
|
||||
galleryService.saveByGallery(gallery);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:/admin/page/gallery";
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理获取图片详情的请求
|
||||
*
|
||||
* @param model model
|
||||
* @param galleryId galleryId
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping(value = "/gallery")
|
||||
public String gallery(Model model,@PathParam("galleryId") Long galleryId){
|
||||
Optional<Gallery> gallery = galleryService.findByGalleryId(galleryId);
|
||||
model.addAttribute("gallery",gallery.get());
|
||||
|
||||
model.addAttribute("options",HaloConst.OPTIONS);
|
||||
return "admin/widget/_gallery-detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图库中的图片
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping(value = "/gallery/remove")
|
||||
@ResponseBody
|
||||
public boolean removeGallery(@RequestParam("galleryId") Long galleryId){
|
||||
try {
|
||||
galleryService.removeByGalleryId(galleryId);
|
||||
}catch (Exception e){
|
||||
log.error("删除图片失败:{0}",e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.swing.text.html.Option;
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
server:
|
||||
port: 8080
|
||||
port: 8090
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
|
|
@ -80,10 +80,10 @@
|
|||
第${comments.number+1}/${comments.totalPages}页
|
||||
</div>
|
||||
<ul class="pagination no-margin pull-right">
|
||||
<li><a class="btn btn-sm <#if !comments.hasPrevious()>disabled</#if>" href="/admin/comments?status=${status}">首页</a> </li>
|
||||
<li><a class="btn btn-sm <#if !comments.hasPrevious()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.number-1}">上页</a></li>
|
||||
<li><a class="btn btn-sm <#if !comments.hasNext()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.number+1}">下页</a></li>
|
||||
<li><a class="btn btn-sm <#if !comments.hasNext()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.totalPages-1}">尾页</a> </li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !comments.hasPrevious()>disabled</#if>" href="/admin/comments?status=${status}">首页</a> </li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !comments.hasPrevious()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.number-1}">上页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !comments.hasNext()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.number+1}">下页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !comments.hasNext()>disabled</#if>" href="/admin/comments?status=${status}&page=${comments.totalPages-1}">尾页</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="menuSort">排序编号</label>
|
||||
<input type="text" class="form-control" id="menuSort" name="menuSort" value="${updateMenu.menuSort}">
|
||||
<input type="number" class="form-control" id="menuSort" name="menuSort" value="${updateMenu.menuSort}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="menuIcon">图标</label>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<div class="form-group">
|
||||
<label for="siteUrl" class="col-sm-2 control-label">博客地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="siteUrl" name="site_url" value="${options.site_url?default('http://localhost:8080')}">
|
||||
<input type="url" class="form-control" id="siteUrl" name="site_url" value="${options.site_url?default('http://localhost:8080')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -153,20 +153,20 @@
|
|||
</span>
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="indexPosts" name="index_posts" value="${options.index_posts?default('10')}">
|
||||
<input type="number" class="form-control" id="indexPosts" name="index_posts" value="${options.index_posts?default('10')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rssPosts" class="col-sm-2 control-label">RSS显示条数:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="rssPosts" name="rss_posts" value="${options.rss_posts?if_exists}">
|
||||
<input type="number" class="form-control" id="rssPosts" name="rss_posts" value="${options.rss_posts?if_exists}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="postSummary" class="col-sm-2 control-label">文章摘要字数:</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="postSummary" name="post_summary" value="${options.post_summary?default('50')}">
|
||||
<input type="number" class="form-control" id="postSummary" name="post_summary" value="${options.post_summary?default('50')}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-flat" id="btn_update_summary" onclick="updateAllSummary()" type="button">更新</button>
|
||||
</span>
|
||||
|
@ -498,7 +498,7 @@
|
|||
<div class="form-group">
|
||||
<label for="emailSmtpUserName" class="col-sm-2 control-label">邮箱账号:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="emailSmtpUserName" name="mail_smtp_username" value="${options.mail_smtp_username?if_exists}">
|
||||
<input type="email" class="form-control" id="emailSmtpUserName" name="mail_smtp_username" value="${options.mail_smtp_username?if_exists}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<td>/gallery</td>
|
||||
<td>
|
||||
<a href="/gallery" class="btn btn-info btn-xs btn-flat" target="_blank">预览</a>
|
||||
<a data-pjax="true" href="/admin/page/gallery" class="btn btn-primary btn-xs btn-flat">配置</a>
|
||||
<a data-pjax="true" href="/admin/page/galleries" class="btn btn-primary btn-xs btn-flat">配置</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
<style type="text/css" rel="stylesheet">
|
||||
#btnNewPicture{margin-left:4px;padding:3px 6px;position:relative;top:-4px;border:1px solid #ccc;border-radius:2px;background:#fff;text-shadow:none;font-weight:600;font-size:12px;line-height:normal;color:#3c8dbc;cursor:pointer;transition:all .2s ease-in-out}
|
||||
#btnNewPicture:hover{background:#3c8dbc;color:#fff}
|
||||
.form-horizontal .control-label{
|
||||
text-align: left;
|
||||
}
|
||||
.div-thumbnail{transition:all .5s ease-in-out;padding:10px}
|
||||
.thumbnail{margin-bottom:0}
|
||||
</style>
|
||||
<section class="content-header">
|
||||
<h1 style="display: inline-block;">图库<small></small></h1>
|
||||
|
@ -32,110 +37,105 @@
|
|||
<div class="box-header with-border">
|
||||
<h3 class="box-title">添加图片</h3>
|
||||
</div>
|
||||
<form class="form-horizontal" id="widgetsOption">
|
||||
<form action="/admin/page/gallery/save" method="post" role="form" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class="form-group">
|
||||
<label for="widgetPostCount" class="col-sm-4 control-label">文章总数:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_postcount" id="widgetPostCount" value="true" ${((options.widget_postcount?default('true'))=='true')?string('checked','')}> 显示
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_postcount" id="widgetPostCount" value="false" ${((options.widget_postcount?default('true'))=='false')?string('checked','')}> 隐藏
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<label for="galleryName" class="col-sm-2 control-label">图片标题:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="galleryName" name="galleryName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryDesc" class="col-sm-2 control-label">图片描述:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="galleryDesc" name="galleryDesc">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryDate" class="col-sm-2 control-label">拍摄日期(如有):</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="date" class="form-control" id="galleryDate" name="galleryDate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryLocation" class="col-sm-2 control-label">拍摄地点(如有):</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="galleryLocation" name="galleryLocation">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryUrl" class="col-sm-2 control-label">图片地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="galleryUrl" name="galleryUrl">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-flat" type="button" onclick="openAttach('galleryUrl')">选择</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="widgetCommentCount" class="col-sm-4 control-label">评论总数:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_commentcount" id="widgetCommentCount" value="true" ${((options.widget_commentcount?default('true'))=='true')?string('checked','')}> 显示
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_commentcount" id="widgetCommentCount" value="false" ${((options.widget_commentcount?default('true'))=='false')?string('checked','')}> 隐藏
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="widgetAttachmentCount" class="col-sm-4 control-label">附件总数:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_attachmentcount" id="widgetAttachmentCount" value="true" ${((options.widget_attachmentcount?default('true'))=='true')?string('checked','')}> 显示
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_attachmentcount" id="widgetAttachmentCount" value="false" ${((options.widget_attachmentcount?default('true'))=='false')?string('checked','')}> 隐藏
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="widgetDayCount" class="col-sm-4 control-label">成立天数:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_daycount" id="widgetDayCount" value="true" ${((options.widget_daycount?default('true'))=='true')?string('checked','')}> 显示
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="widget_daycount" id="widgetDayCount" value="false" ${((options.widget_daycount?default('true'))=='false')?string('checked','')}> 隐藏
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryThumbnailUrl" class="col-sm-2 control-label">缩略图地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="url" class="form-control" id="galleryThumbnailUrl" name="galleryThumbnailUrl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="button" class="btn btn-info pull-right" onclick="saveOptions('widgetsOption')">保存</button>
|
||||
<button type="submit" class="btn btn-primary pull-left">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</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>
|
||||
</div>
|
||||
<div class="row">
|
||||
<#list galleries.content as gallery>
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-6 div-thumbnail" onclick="openDetail(${gallery.galleryId})">
|
||||
<a href="#" class="thumbnail">
|
||||
<img src="${gallery.galleryThumbnailUrl?if_exists}" class="img-responsive">
|
||||
</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>
|
||||
</#list>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="no-margin pull-left">
|
||||
第${galleries.number+1}/${galleries.totalPages}页
|
||||
</div>
|
||||
<ul class="pagination no-margin pull-right">
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !galleries.hasPrevious()>disabled</#if>" href="/admin/page/galleries" >首页</a> </li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !galleries.hasPrevious()>disabled</#if>" href="/admin/page/galleries?page=${galleries.number-1}" >上页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !galleries.hasNext()>disabled</#if>" href="/admin/page/galleries?page=${galleries.number+1}">下页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !galleries.hasNext()>disabled</#if>" href="/admin/page/galleries?page=${galleries.totalPages-1}">尾页</a> </li>
|
||||
</ul>
|
||||
</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>
|
||||
</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="siteStart">1</h3><p>成立天数</p></div>
|
||||
<div class="icon"><i class="ion ion-pie-graph"></i></div>
|
||||
<a href="#" class="small-box-footer">${options.site_start?default('0000-00-00')} <i class="fa fa-star"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</#if>
|
||||
<!-- ./col -->
|
||||
</div>
|
||||
</section>
|
||||
<script src="/static/plugins/layer/layer.js"></script>
|
||||
<script type="application/javascript">
|
||||
$('#btnNewPicture').click(function () {
|
||||
$('#newPicturePanel').slideToggle(400);
|
||||
});
|
||||
function openAttach(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '所有附件',
|
||||
shadeClose: true,
|
||||
shade: 0.5,
|
||||
area: ['90%', '90%'],
|
||||
content: '/admin/attachments/select?id='+id,
|
||||
scrollbar: false
|
||||
});
|
||||
}
|
||||
function openDetail(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '图片详情',
|
||||
shadeClose: true,
|
||||
shade: 0.5,
|
||||
area: ['90%', '90%'],
|
||||
content: '/admin/page/gallery?galleryId='+id,
|
||||
scrollbar: false
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<#include "module/_footer.ftl">
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1">网址</label>
|
||||
<input type="text" class="form-control" id="linkUrl" name="linkUrl" value="${updateLink.linkUrl}">
|
||||
<input type="url" class="form-control" id="linkUrl" name="linkUrl" value="${updateLink.linkUrl}">
|
||||
<small>*需要加上http://或https://</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -104,10 +104,10 @@
|
|||
第${posts.number+1}/${posts.totalPages}页
|
||||
</div>
|
||||
<ul class="pagination no-margin pull-right">
|
||||
<li><a class="btn btn-sm <#if !posts.hasPrevious()>disabled</#if>" href="/admin/posts?status=${status}">首页</a> </li>
|
||||
<li><a class="btn btn-sm <#if !posts.hasPrevious()>disabled</#if>" href="/admin/posts?status=${status}&page=${posts.number-1}">上页</a></li>
|
||||
<li><a class="btn btn-sm <#if !posts.hasNext()>disabled</#if>" href="/admin/posts?status=${status}&page=${posts.number+1}">下页</a></li>
|
||||
<li><a class="btn btn-sm <#if !posts.hasNext()>disabled</#if>" href="/admin/posts?page=${posts.totalPages-1}&status=${status}">尾页</a> </li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !posts.hasPrevious()>disabled</#if>" href="/admin/posts?status=${status}">首页</a> </li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !posts.hasPrevious()>disabled</#if>" href="/admin/posts?status=${status}&page=${posts.number-1}">上页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !posts.hasNext()>disabled</#if>" href="/admin/posts?status=${status}&page=${posts.number+1}">下页</a></li>
|
||||
<li><a data-pjax="true" class="btn btn-sm <#if !posts.hasNext()>disabled</#if>" href="/admin/posts?page=${posts.totalPages-1}&status=${status}">尾页</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/plugins/toast/css/jquery.toast.min.css">
|
||||
<link rel="stylesheet" href="/static/css/AdminLTE.min.css">
|
||||
<style>
|
||||
.attachDesc,.attachImg{padding-top:15px;padding-bottom:15px}
|
||||
.form-horizontal .control-label{text-align:left}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 attachImg">
|
||||
<img src="${gallery.galleryUrl?if_exists}" style="width: 100%;">
|
||||
</div>
|
||||
<div class="col-lg-6 attachDesc">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">详细信息</h3>
|
||||
</div>
|
||||
<form action="/admin/page/gallery/save" method="post" class="form-horizontal" id="galleryForm">
|
||||
<div class="box-body">
|
||||
<input type="hidden" value="${gallery.galleryId}" name="galleryId">
|
||||
<div class="form-group">
|
||||
<label for="galleryName" class="col-sm-2 control-label">图片名称:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="galleryName" name="galleryName" value="${gallery.galleryName}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryDesc" class="col-sm-2 control-label">图片描述:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="galleryDesc" name="galleryDesc" value="${gallery.galleryDesc}" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryDate" class="col-sm-2 control-label">图片日期:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="date" class="form-control" id="galleryDate" name="galleryDate" value="${gallery.galleryDate}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryLocation" class="col-sm-2 control-label">拍摄地点:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="galleryLocation" name="galleryLocation" value="${gallery.galleryLocation}" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="galleryUrl" class="col-sm-2 control-label">图片地址:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="galleryUrl" name="galleryUrl" value="${gallery.galleryUrl}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="button" class="btn btn-danger btn-sm pull-left" onclick="btn_delete()">永久删除</button>
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" onclick="btn_save()">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/static/plugins/jquery/jquery.min.js"></script>
|
||||
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
|
||||
<script src="/static/js/adminlte.min.js"></script>
|
||||
<script src="/static/plugins/layer/layer.js"></script>
|
||||
<script src="/static/js/app.js"></script>
|
||||
<script>
|
||||
function btn_delete() {
|
||||
layer.msg('你确定要删除?', {
|
||||
time: 0
|
||||
,btn: ['删除', '取消']
|
||||
,yes: function(index){
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/admin/page/gallery/remove',
|
||||
async: false,
|
||||
data:{
|
||||
galleryId : ${gallery.galleryId}
|
||||
},
|
||||
success: function (data) {
|
||||
if(data==true){
|
||||
$.toast({
|
||||
text: "删除成功!",
|
||||
heading: '提示',
|
||||
icon: 'success',
|
||||
showHideTransition: 'fade',
|
||||
allowToastClose: true,
|
||||
hideAfter: 1000,
|
||||
stack: 1,
|
||||
position: 'top-center',
|
||||
textAlign: 'left',
|
||||
loader: true,
|
||||
loaderBg: '#ffffff',
|
||||
afterHidden: function () {
|
||||
parent.location.reload();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
showMsg("删除失败","error",2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function btn_save() {
|
||||
$('#galleryForm').submit();
|
||||
}
|
||||
</script>
|
||||
</html>
|
Loading…
Reference in New Issue