fix post page

This commit is contained in:
deepzz0
2016-10-19 22:16:58 +08:00
parent 2f52a53ff3
commit 773378682b
5 changed files with 21 additions and 29 deletions

6
api.go
View File

@@ -46,6 +46,8 @@ func init() {
APIs["trash-delete"] = apiTrashDelete
// 恢复回收箱
APIs["trash-recover"] = apiTrashRecover
// 上传文件
APIs["file-upload"] = apiFileUpload
}
func apiAccount(c *gin.Context) {
@@ -389,6 +391,10 @@ func apiTrashRecover(c *gin.Context) {
responseNotice(c, NOTICE_SUCCESS, "恢复成功", "")
}
func apiFileUpload(c *gin.Context) {
}
func responseNotice(c *gin.Context, typ, content, hl string) {
if hl != "" {
c.SetCookie("notice_highlight", hl, 86400, "/", "", true, false)

15
back.go
View File

@@ -97,15 +97,18 @@ type T struct {
func HandlePost(c *gin.Context) {
h := GetBack()
id, err := strconv.Atoi(c.Query("cid"))
if artc := QueryArticle(int32(id)); err == nil && id > 0 && artc != nil {
h["Title"] = "编辑文章 | " + Ei.BTitle
h["Edit"] = artc
} else {
if err == nil && id > 0 {
artc := QueryArticle(int32(id))
if artc != nil {
h["Title"] = "编辑文章 | " + Ei.BTitle
h["Edit"] = artc
}
}
if h["Title"] == "" {
h["Title"] = "撰写文章 | " + Ei.BTitle
}
h["Post"] = true
h["Path"] = c.Request.URL.Path
h["Title"] = "撰写文章 | " + Ei.BTitle
h["Domain"] = setting.Conf.Mode.Domain
h["Series"] = Ei.Series
var tags []T
@@ -126,7 +129,7 @@ func HandleDraftDelete(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "删除错误"})
return
}
c.JSON(http.StatusOK, nil)
c.Redirect(http.StatusFound, "/admin/write-post")
}
// 文章管理==>Manage

BIN
static/admin/Moxie.swf Normal file

Binary file not shown.

View File

@@ -1,13 +1,12 @@
{{define "admin-post"}}
<div class="body container">
<div class="typecho-page-title">
{{with .Eidt}}<h2>编辑 {{.Title}}</h2>{{end}}
<h2>撰写文章</h2>
{{if .Edit}}<h2>编辑 {{.Edit.Title}}</h2>{{else}}<h2>撰写文章</h2>{{end}}
</div>
<div class="row typecho-page-main typecho-post-area" role="form">
<form action="/admin/api/post-add" method="post" name="write_post">
<div class="col-mb-12 col-tb-9" role="main">
{{with .Eidt}}<cite class="edit-draft-notice">你正在编辑的是草稿, 你也可以 <a href="/admin/draft-delete?cid={{.ID}}">删除它</a></cite>{{end}}
{{if .Edit.IsDraft}}<cite class="edit-draft-notice">你正在编辑的是草稿, 你也可以 <a href="/admin/draft-delete?cid={{.Edit.ID}}">删除它</a></cite>{{end}}
<p class="title">
<label for="title" class="sr-only">标题</label>
<input type="text" id="title" name="title" autocomplete="off" {{with .Edit}}value="{{.Title}}"{{end}} placeholder="标题" class="w-100 text title" />
@@ -654,23 +653,7 @@ $(document).ready(function() {
return false;
});
}
if (isMarkdown) {
initMarkdown();
} else {
var notice = $('<div class="message notice">这篇文章不是由Markdown语法创建的, 继续使用Markdown编辑它吗? ' + '<button class="btn btn-xs primary yes">是</button> ' + '<button class="btn btn-xs no">否</button></div>')
.hide().insertBefore(textarea).slideDown();
$('.yes', notice).click(function() {
notice.remove();
$('<input type="hidden" name="markdown" value="1" />').appendTo('.submit');
initMarkdown();
});
$('.no', notice).click(function() {
notice.remove();
});
}
initMarkdown();
});
</script>
<script src="/static/admin/moxie.js"></script>
@@ -780,9 +763,9 @@ $(document).ready(function() {
$('#tab-files').bind('init', function() {
var uploader = new plupload.Uploader({
browse_button: $('.upload-file').get(0),
url: 'http://localhost/index.php/action/upload?_=53e23a1bd0daab03b05d9c23190904a4',
url: '/admin/api/file-upload',
runtimes: 'html5,flash,html4',
flash_swf_url: 'http://localhost/admin/js/Moxie.swf',
flash_swf_url: '/static/admin/js/Moxie.swf',
drop_element: $('.upload-area').get(0),
filters: {
max_file_size: '2mb',

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="always"><title>{{.Title}}</title><script>!function(n,t){function e(){o("nls",1)}function c(){t.documentElement.style.display="none",u(),location.reload()}function r(n){var t="";try{t=f[n]||"",t.length<99&&c()}catch(e){u()}return t}function i(n,t){try{f[n]=t,t!==f[n]&&u()}catch(e){u()}}function o(n,e){var c=999;e||(c=-1),c=new Date(+new Date+86400000*c).toGMTString();var r=n+"="+e+";path=/;secure;expires="+c;t.cookie=r}function a(n){var e=t.getElementById(n).innerHTML;i(n,e)}function l(e,c){var i=r(e),o=t.createElement(c?"script":"style");return n.execScript&&c?n.execScript(i):(o.innerHTML=i,void t.head.appendChild(o))}function u(){o("v",0)}var f,h=function(){},d=n.L={h:h,l:h,c:h};try{f=localStorage,d.h=a,d.l=l,d.c=o}catch(p){e()}}(this,document);</script>{{if .Version}}<script>L.c('v', {{.Version}})</script>{{end}}<link rel="apple-touch-icon" href="{{.Favicon}}"><link rel="search" type="application/opensearchdescription+xml" href="//{{.Domain}}/opensearch.xml" title="{{.BTitle}}">{{if .Version}}<style id="blog_css">{{template "blog_css"}}</style><script>L.h('blog_css')</script>{{else}}<script>L.l("blog_css")</script>{{end}}<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="//{{.Domain}}/rss.html"><meta name="description" content="{{.Description}}"><style id="style-1-cropbar-clipper">.en-markup-crop-options{top:18px!important;left:50%!important;margin-left:-100px!important;width:200px!important;border:2px rgba(255,255,255,.38) solid!important;border-radius:4px!important}.en-markup-crop-options div div:first-of-type{margin-left:0!important}</style></head><body><div class="container"><div class="left-col"><div class="intrude-less"><header id="header" class="inner"><div class="profilepic"><a href="/"></a></div><h1><a href="/">{{.BlogName}}</a></h1><p class="subtitle">{{.SubTitle}}</p><nav id="main-nav"><ul><li {{if eq .Path "/"}}class="on" {{end}}><a href="/"><span>首页</span></a></li><li {{if eq .Path "/series.html"}}class="on" {{end}}><a href="/series.html"><span>专题</span></a></li><li {{if eq .Path "/archives.html"}}class="on" {{end}}><a href="/archives.html"><span>归档</span></a></li><li {{if eq .Path "/post/blogroll.html"}}class="on" {{end}}><a href="/post/blogroll.html"><span>友链</span></a></li><li {{if eq .Path "/post/about.html"}}class="on" {{end}}><a href="/post/about.html"><span>关于</span></a></li></ul></nav><nav id="sub-nav"><div class="social"><a target="_blank" class="twitter external" rel="nofollow" href="{{.Twitter}}" title="Twitter">Twitter</a><a target="_blank" class="rss" href="//{{.Domain}}/rss.html" title="RSS 订阅">RSS</a><a class="search" href="/search.html" title="站内搜索">Search</a></div></nav></header></div></div><div class="mid-col"><div class="mid-col-container">{{if .HomePage}} {{template "home" .}} {{else if .ArticlePage}} {{template "article" .}}{{else if .SeriesPage}}{{template "series" .}}{{else if .ArchivesPage}}{{template "archives" .}} {{else if .BlogrollPage}}{{template "blogroll" .}}{{else if .AboutPage}}{{template "about" .}}{{else if .SearchPage}} {{template "search" .}}{{else if .NotFoundPage}}{{template "notfound"}} {{end}}</div><footer id=footer class=inner>© {{.CopyYear}} - {{.BTitle}} - <a target="_blank" rel="nofollow designer" class="external beian" href="http://www.miitbeian.gov.cn/">{{.BeiAn}}</a><br>Powered by <a target=_blank href="//github.com/eiblog/eiblog">EiBlog</a> & <a target=_blank rel="nofollow designer" class=external href="//imququ.com">JerryQu</a></footer></div></div><input type=hidden id=CURRENT_PAGE value="{{.CurrentPage}}"><input type=hidden id=CDN_DOMAIN value="{{.Static}}">{{if .Version}}<script id="ana_js">{{template "ana_js"}}</script><script>L.h('ana_js')</script>{{else}}<script>L.l('ana_js', 1)</script>{{end}}{{if .Version}}<script id="jq_js">{{template "jq_js"}}</script><script>L.h('jq_js')</script>{{else}}<script>L.l('jq_js', 1)</script>{{end}}{{if .Version}}<script id="hl_js">{{template "hl_js"}}</script><script>L.h('hl_js')</script>{{else}}<script>L.l('hl_js', 1)</script>{{end}}{{if .Version}}<script id="blog_js">{{template "blog_js"}}</script><script>L.h('blog_js')</script>{{else}}<script>L.l('blog_js', 1)</script>{{end}}</body></html>
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="always"><title>{{.Title}}</title><script>!function(n,t){function e(){o("nls",1)}function c(){t.documentElement.style.display="none",u(),location.reload()}function r(n){var t="";try{t=f[n]||"",t.length<99&&c()}catch(e){u()}return t}function i(n,t){try{f[n]=t,t!==f[n]&&u()}catch(e){u()}}function o(n,e){var c=999;e||(c=-1),c=new Date(+new Date+86400000*c).toGMTString();var r=n+"="+e+";path=/;secure;expires="+c;t.cookie=r}function a(n){var e=t.getElementById(n).innerHTML;i(n,e)}function l(e,c){var i=r(e),o=t.createElement(c?"script":"style");return n.execScript&&c?n.execScript(i):(o.innerHTML=i,void t.head.appendChild(o))}function u(){o("v",0)}var f,h=function(){},d=n.L={h:h,l:h,c:h};try{f=localStorage,d.h=a,d.l=l,d.c=o}catch(p){e()}}(this,document);</script>{{if .Version}}<script>L.c('v', {{.Version}})</script>{{end}}<link rel="apple-touch-icon" href="{{.Favicon}}"><link rel="search" type="application/opensearchdescription+xml" href="//{{.Domain}}/opensearch.xml" title="{{.BTitle}}">{{if .Version}}<style id="blog_css">{{template "blog_css"}}</style><script>L.h('blog_css')</script>{{else}}<script>L.l("blog_css")</script>{{end}}<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="//{{.Domain}}/rss.html"><meta name="description" content="{{.Description}}"><style id="style-1-cropbar-clipper">.en-markup-crop-options{top:18px!important;left:50%!important;margin-left:-100px!important;width:200px!important;border:2px rgba(255,255,255,.38) solid!important;border-radius:4px!important}.en-markup-crop-options div div:first-of-type{margin-left:0!important}</style></head><body><div class="container"><div class="left-col"><div class="intrude-less"><header id="header" class="inner"><div class="profilepic"><a href="/"></a></div><h1><a href="/">{{.BlogName}}</a></h1><p class="subtitle">{{.SubTitle}}</p><nav id="main-nav"><ul><li {{if eq .Path "/"}}class="on" {{end}}><a href="/"><span>首页</span></a></li><li {{if eq .Path "/series.html"}}class="on" {{end}}><a href="/series.html"><span>专题</span></a></li><li {{if eq .Path "/archives.html"}}class="on" {{end}}><a href="/archives.html"><span>归档</span></a></li><li {{if eq .Path "/post/blogroll.html"}}class="on" {{end}}><a href="/post/blogroll.html"><span>友链</span></a></li><li {{if eq .Path "/post/about.html"}}class="on" {{end}}><a href="/post/about.html"><span>关于</span></a></li></ul></nav><nav id="sub-nav"><div class="social"><a target="_blank" class="twitter external" rel="nofollow" href="{{.Twitter}}" title="Twitter">Twitter</a><a target="_blank" class="rss" href="//{{.Domain}}/rss.html" title="RSS 订阅">RSS</a><a class="search" href="/search.html" title="站内搜索">Search</a></div></nav></header></div></div><div class="mid-col"><div class="mid-col-container">{{if .HomePage}} {{template "home" .}} {{else if .ArticlePage}} {{template "article" .}}{{else if .SeriesPage}}{{template "series" .}}{{else if .ArchivesPage}}{{template "archives" .}} {{else if .BlogrollPage}}{{template "blogroll" .}}{{else if .AboutPage}}{{template "about" .}}{{else if .SearchPage}} {{template "search" .}}{{else if .NotFoundPage}}{{template "notfound"}} {{end}}</div><footer id=footer class=inner>© {{.CopyYear}} - {{.BTitle}} - <a target="_blank" rel="nofollow designer" class="external beian" href="http://www.miitbeian.gov.cn/">{{.BeiAn}}</a><br>Powered by <a target=_blank href="//github.com/eiblog/eiblog">Eiblog</a> & <a target=_blank rel="nofollow designer" class=external href="//imququ.com">JerryQu</a></footer></div></div><input type=hidden id=CURRENT_PAGE value="{{.CurrentPage}}"><input type=hidden id=CDN_DOMAIN value="{{.Static}}">{{if .Version}}<script id="ana_js">{{template "ana_js"}}</script><script>L.h('ana_js')</script>{{else}}<script>L.l('ana_js', 1)</script>{{end}}{{if .Version}}<script id="jq_js">{{template "jq_js"}}</script><script>L.h('jq_js')</script>{{else}}<script>L.l('jq_js', 1)</script>{{end}}{{if .Version}}<script id="hl_js">{{template "hl_js"}}</script><script>L.h('hl_js')</script>{{else}}<script>L.l('hl_js', 1)</script>{{end}}{{if .Version}}<script id="blog_js">{{template "blog_js"}}</script><script>L.h('blog_js')</script>{{else}}<script>L.l('blog_js', 1)</script>{{end}}</body></html>