braziw-plugin-blog
Version:
Blog plugin for Braziw CMS
74 lines (55 loc) • 2.57 kB
HTML
{% extends _cms.conf.adminTemplate %}
{% block title %}{{pageTitle}}{% endblock %}
{% block head %}
<link href="/css/plugin/blog/bootstrap.min.css" media="all" rel="stylesheet">
<link href="/css/plugin/blog/bootstrap-markdown.min.css" media="all" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<style>
textarea.content {
padding: 12px;
font-family: Inconsolata, monospace;
font-size: 16px;
}
.md-preview {
padding: 12px;
}
.hint {
color: #999;
font-size: 12px;
margin-bottom: 4px;
}
</style>
{% endblock %}
{% block content %}
<form method="post" name="blogForm">
{%if blog and blog._id%}
<input name="_id" type="hidden" value="{{blog._id}}" />
{%endif%}
<input name="blogTitle" type="text" placeholder="Blog Title" value="{{blog.blogTitle}}" />
<div class="hint">This blog editor uses Markdown syntax. (<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Here-Cheatsheet" target="_blank">Learn more</a>)</div>
<textarea class="content" name="content" id="MARKDOWN_EDITOR" rows="10">{{blog.content}}</textarea>
<div style="margin-top: 12px;">
<label>
<input name="publish" type="checkbox" {%if blog.blogStatus != 'D'%}checked{%endif%}> Publish
</label>
<label>
<input name="anonymous" type="checkbox" {%if blog.blogAnonymousInd == 'Y'%}checked{%endif%}> Anonymous
</label>
</div>
<div style="margin-top: 17px">
<button type="submit" class="tiny btn" onClick="document.blogForm.action=null">Save</button> <button type="submit" target="_blank" style="margin-left: 12px;" class="tiny btn btn-default" onClick="document.blogForm.action='/admin/blog/preview'" formtarget="_blank">Preview</button>
{%if blog._id and (_user.role == 'ADMIN' or _user.role == 'EDITOR' or _user._id == blog.meta.createBy) %}
<button type="submit" target="_blank" style="float: right;" class="tiny btn alert" onClick="if (confirm('Are you sure you want to delete this blog?')) { document.blogForm.action='/admin/blog/delete'; return true;} else {return false}">Delete</button>
{%endif%}
</div>
</form>
{% endblock %}
{% block beforeEndBody %}
<script src="/js/plugin/blog/bootstrap.min.js"></script>
<script src="/js/plugin/blog/markdown.js"></script>
<script src="/js/plugin/blog/to-markdown.js"></script>
<script src="/js/plugin/blog/bootstrap-markdown.js"></script>
<script>
$("#MARKDOWN_EDITOR").markdown({height:400})
</script>
{% endblock %}