Files
leanote/app/views/member/blog/update_abstract.html

158 lines
4.1 KiB
HTML
Raw Normal View History

2014-11-12 17:32:03 +08:00
{{template "member/top.html" .}}
<style>
.img-src {
max-height: 200px;
}
</style>
<div class="m-b-md"> <h3 class="m-b-none">
2015-11-28 15:17:36 +08:00
{{.note.Title}} - {{msg $ "setAbstract"}}
2014-11-12 17:32:03 +08:00
</h3>
</div>
<link rel="stylesheet" href="/css/tinymce/skin.min.css" type="text/css">
2015-11-28 15:17:36 +08:00
2014-11-12 17:32:03 +08:00
<div class="row">
<div class="col-sm-10">
<form id="formData">
<section class="panel panel-default">
<div class="panel-body">
2015-11-28 15:17:36 +08:00
{{leaMsg . "Once the abstract has been updated, it will not set the abstract automatically other than you cancel it."}}
2014-11-12 17:32:03 +08:00
<hr />
<div class="alert alert-danger" id="baseMsg" style="display: none"></div>
2015-11-28 15:17:36 +08:00
<div class="form-group" id="mainImg">
2014-11-12 17:32:03 +08:00
<label>
2015-11-28 15:17:36 +08:00
{{leaMsg $ "Main Image"}}
<a class="btn btn-default btn-select-img">
{{leaMsg $ "Get next image as main image from content"}}
</a>
2014-11-12 17:32:03 +08:00
</label>
2015-11-28 15:17:36 +08:00
<div style="border: 2px dashed #ccc; padding: 5px;">
2014-11-12 17:32:03 +08:00
<img src="{{.note.ImgSrc}}" class="img-src" id="imgSrc"/>
</div>
</div>
<div class="form-group">
2015-11-28 15:17:36 +08:00
<label>{{leaMsg $ "Description" }}</label>
2014-11-12 17:32:03 +08:00
<textarea type="text" rows="6" class="form-control" id="desc" name="desc">{{.note.Desc}}</textarea>
</div>
<div class="form-group">
2015-11-28 15:17:36 +08:00
<label for="content1">{{leaMsg $ "Abstract"}}</label>
<div class="toolbar-content">
<div id="popularToolbar" class="tool-bar"></div>
<div id="content1" class="content-ctn" name="content">{{raw .note.Abstract}}</div>
</div>
2014-11-12 17:32:03 +08:00
</div>
</div>
<footer class="panel-footer text-right bg-light lter">
<button type="submit" id="submitBtn" class="btn btn-success">{{msg . "submit"}}</button>
</footer>
2015-11-28 15:17:36 +08:00
2014-11-12 17:32:03 +08:00
<div class="panel-body">
<p>
2015-11-28 15:17:36 +08:00
{{leaMsg . "Raw Content"}}:
<hr />
2014-11-12 17:32:03 +08:00
</p>
<div id="rawContent">
2015-11-28 15:17:36 +08:00
{{if .note.IsMarkdown}}
<pre>{{.note.Content|raw}}</pre>
{{else}}
{{.note.Content|raw}}
{{end}}
2014-11-12 17:32:03 +08:00
</div>
</div>
</section>
</form>
</div>
</div>
{{template "member/footer.html" .}}
<script type="text/javascript" src="/tinymce/tinymce.js"></script>
<script>
2015-01-08 00:36:28 +08:00
var UrlPrefix = "{{.siteUrl}}";
2015-11-28 15:17:36 +08:00
var LeaAce = null;
2014-11-12 17:32:03 +08:00
$(function() {
tinymce.init({
2015-11-28 15:17:36 +08:00
inline: true,
2014-11-12 17:32:03 +08:00
selector : "#content1",
2015-11-28 15:17:36 +08:00
theme: 'leanote',
2014-11-12 17:32:03 +08:00
language : "{{.locale}}",
plugins : [
2015-11-28 15:17:36 +08:00
"advlist autolink link lists charmap hr ",
2015-01-08 00:36:28 +08:00
"searchreplace visualblocks visualchars tabfocus",
2015-11-28 15:17:36 +08:00
"table contextmenu directionality textcolor fullpage textcolor"],
toolbar1 : "formatselect |fontselect fontsizeselect| forecolor backcolor | bold italic underline strikethrough | bullist numlist |",
2014-11-12 17:32:03 +08:00
menubar : false,
statusbar : false,
font_formats : "Arial=arial,helvetica,sans-serif;"
+ "Arial Black=arial black,avant garde;"
+ "Times New Roman=times new roman,times;"
+ "Courier New=courier new,courier;"
+ "Tahoma=tahoma,arial,helvetica,sans-serif;"
+ "Verdana=verdana,geneva;" + "宋体=SimSun;"
+ "新宋体=NSimSun;" + "黑体=SimHei;"
+ "微软雅黑=Microsoft YaHei",
block_formats : "Header 1=h1;Header 2=h2;Header 3=h3; Header 4=h4;Pre=pre;Paragraph=p"
});
// 提交
$("#submitBtn").click(function(e) {
e.preventDefault();
var data = {
noteId: "{{.noteId}}",
imgSrc: $("#imgSrc").attr("src"),
desc : $("#desc").val(),
abstract : getEditorContent()
}
ajaxPost("/member/blog/doUpdateBlogAbstract/", data, function(re) {
if(reIsOk(re)) {
2015-11-28 16:12:27 +08:00
art.tips(getMsg("Success"));
2014-11-12 17:32:03 +08:00
location.href = "/member/blog/index";
} else {
art.alert(re.Msg || "error")
}
});
});
2015-11-28 15:17:36 +08:00
var isMarkdown = {{$.note.IsMarkdown}};
var images = [];
if (isMarkdown) {
var content = $('#rawContent').html();
var reg = /!\[.*?\]\((.*)\)/g;
var ret = reg.exec(content);
while(ret) {
images.push(ret[1]);
ret = reg.exec(content);
}
// console.log(images);
}
2014-11-12 17:32:03 +08:00
// 选择主图
2015-11-28 15:17:36 +08:00
$("#rawContent").find("img").each(function () {
if($(this).attr('src')) {
images.push($(this).attr('src'));
2014-11-12 17:32:03 +08:00
}
2015-11-28 15:17:36 +08:00
});;
var imgLen = images.length;
var imgSeq = 0;
$imgSrc = $('#imgSrc');
if (imgLen) {
$(".btn-select-img").click(function() {
imgSeq++;
imgSeq = imgSeq % imgLen;
$imgSrc.attr("src", images[imgSeq]);
});
}
else {
$(".btn-select-img").hide();
}
2014-11-12 17:32:03 +08:00
});
</script>
{{template "member/end.html" .}}