优化部分显示效果

This commit is contained in:
Minho 2018-01-27 13:34:48 +08:00
parent dc2a920acc
commit 55c0854be1
7 changed files with 33 additions and 36 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/lifei6671/mindoc/models"
"io"
"strings"
"github.com/russross/blackfriday"
)
type BaseController struct {
@ -42,7 +43,8 @@ func (c *BaseController) Prepare() {
c.Option = make(map[string]string, len(options))
for _, item := range options {
c.Data[item.OptionName] = item.OptionValue
c.Option[item.OptionName] = item.OptionValue
c.Option[item.OptionName] = string(blackfriday.MarkdownBasic([]byte(item.OptionValue)))
if strings.EqualFold(item.OptionName, "ENABLE_ANONYMOUS") && item.OptionValue == "true" {
c.EnableAnonymous = true
}

View File

@ -140,10 +140,6 @@ func (c *DocumentController) Index() {
c.Data["Result"] = template.HTML(tree)
c.Data["Title"] = "概要"
c.Data["Content"] = template.HTML(blackfriday.MarkdownBasic([]byte(bookResult.Description)))
c.Data["Info"] = ""
c.Data["DocumentId"] = "0" // added by dandycheung, 2017-12-08, for exporting
beego.Info("DocumentController.Index(): c.Data[\"DocumentId\"] = ", 0)
}
// 阅读文档

View File

@ -137,13 +137,23 @@ func (m *Option) Init() error {
}
if !o.QueryTable(m.TableNameWithPrefix()).Filter("option_name", "SITE_NAME").Exist() {
option := NewOption()
option.OptionValue = "MinDoc"
option.OptionValue = "MinDoc文档管理系统"
option.OptionName = "SITE_NAME"
option.OptionTitle = "站点名称"
if _, err := o.Insert(option); err != nil {
return err
}
}
if !o.QueryTable(m.TableNameWithPrefix()).Filter("option_name", "site_description").Exist() {
option := NewOption()
option.OptionValue = "MinDoc 是一款针对IT团队开发的简单好用的文档管理系统可以用来储存日常接口文档数据库字典手册说明等文档。内置项目管理用户管理权限管理等功能支持Markdown和富文本两种编辑器能够满足大部分中小团队的文档管理需求。"
option.OptionName = "site_description"
option.OptionTitle = "站点描述"
if _, err := o.Insert(option); err != nil {
return err
}
}
return nil
}

View File

@ -56,7 +56,7 @@ textarea{
background-color: #fff;
border-bottom: 0;
box-shadow: rgba(0,0,0,.1)0 1px 5px;
border-top: 3px solid #009a61
border-top: 1px solid #009a61;
}
.manual-header .navbar-brand,.manual-header a {
font-weight: 500;

View File

@ -1,11 +1,17 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>{{.Model.BookName}} - Powered by MinDoc</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Model.BookName}} - Powered by MinDoc</title>
<meta name="renderer" content="webkit">
<meta name="author" content="Minho" />
<meta name="site" content="https://www.iminho.me" />
<meta name="keywords" content="{{.Model.BookName}}">
<meta name="description" content="{{.Model.Description}}">
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -133,7 +139,6 @@
</div>
<div class="col-md-8 text-center">
<h1 id="article-title">{{.Title}}</h1>
{{/*<h3 id="article-info" class="article-info">{{.Info}}</h3>*/}}
</div>
<div class="col-md-2">
</div>
@ -273,13 +278,7 @@
<script src="{{cdnjs "/static/js/splitbar.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/katex/katex.min.js"}}" type="text/javascript"></script>
<script type="text/javascript">
active_book_id = {{.Model.Identify}};
active_doc_id = {{.DocumentId}};
$(function () {
$("body").on('article.open', function (event, $param) {
active_doc_id = $param.$id;
});
});
$(function () {
$("#searchList").on("click","a",function () {
var id = $(this).attr("data-id");
@ -287,28 +286,12 @@ $(function () {
$(this).parent("li").siblings().find("a").removeClass("active");
$(this).addClass("active");
loadDocument(url,id,function (body) {
return $(body).highlight(window.keyword);
});
});
$("#page-content").on("click","img",function () {
var src = $(this).attr("src");
// layer.open({
// type: 1,
// shade: false,
// area : ['90%','90%'],
// title: false, //不显示标题
// content: "<img src='" + src + "'>"
// });
});
});
function ExportPdfDoc() {
var id = active_book_id;
if(active_doc_id != "0")
id += "/" + active_doc_id;
window.location.href = "/export/" + id + "?output=pdf";
}
</script>
</body>
</html>

View File

@ -1,13 +1,14 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>{{.SITE_NAME}} - Powered by MinDoc</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.SITE_NAME}} - Powered by MinDoc</title>
<meta name="renderer" content="webkit">
<meta name="author" content="Minho" />
<meta name="site" content="https://www.iminho.me" />
<meta name="description" content="{{.site_description}}">
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">

View File

@ -46,6 +46,11 @@
<label>网站标题</label>
<input type="text" class="form-control" name="SITE_NAME" id="siteName" placeholder="网站标题" value="{{.SITE_NAME.OptionValue}}">
</div>
<div class="form-group">
<label>网站描述</label>
<textarea rows="3" class="form-control" name="site_description" style="height: 90px" placeholder="网站描述">{{.site_description.OptionValue}}</textarea>
<p class="text">描述信息不超过500个字符,支持Markdown语法</p>
</div>
<div class="form-group">
<label>启用匿名访问</label>
<div class="radio">