VoidForum/src/main/resources/templates/admin/posts/new.jade

119 lines
3.6 KiB
Plaintext

extends ../layout/admin
block head
script(src="/webjars/ace/1.2.8/src-min/ace.js")
script(src="/webjars/ace/1.2.8/src-min/theme-github.js")
script(src="/webjars/ace/1.2.8/src-min/mode-markdown.js")
block content
h1 New Post
hr
if errors != null
.alert.alert-danger
= errors.getMessage()
ol
for err in errors.getArgsAsWebErrorList()
li #{err.getField()} : #{err.getErrorMessage()}
form.post-form(method="post", action="/admin/posts")
.item-row
input(type="hidden", name='_csrf', value='#{_csrf.token}')
.item-row
input.form-control(type="text", name="title", value='#{postForm.getTitle()}')
.item-row
textarea.form-control#content(name="content", style="display:none;")
= postForm.getContent()
div#content-editor
= postForm.getContent()
.item-row
hr
.row
.col-sm-3
span Format
select.form-control(name="postFormat")
for format in postFormats
if format != postForm.getPostFormat()
option(value="#{format.getId()}") #{format.getName()}
else
option(value="#{format.getId()}", selected="selected") #{format.getName()}
.col-sm-3
span Status
select.form-control(name="postStatus")
for status in postStatus
if status != postForm.getPostStatus()
option(value="#{status.getId()}") #{status.getName()}
else
option(value="#{status.getId()}", selected="selected") #{status.getName()}
.col-sm-3
span Permalink
input.form-control(name="permalink", value="#{postForm.getPermalink()}")
.col-sm-3
span Tags
input.form-control(name="postTags", value="#{postForm.getPostTags()}")
hr
.row
.col-sm-3
span Seo Keywords
input.form-control(name="seoKeywords", value="#{postForm.getSeoKeywords()}")
.col-sm-3
span Seo Description
input.form-control(name="seoDescription", value="#{postForm.getSeoDescription()}")
hr
h5 Open Graph
.row
.col-sm-3
span Type
select.form-control(name="seoOgType")
for ogType in seoOgTypes
if postForm.getSeoOgType() == ogType
option(value="#{ogType.getId()}", selected="selected") #{ogType.getName()}
else
option(value="#{ogType.getId()}") #{ogType.getName()}
.col-sm-3
span Image link
input.form-control(name="seoOgImage", value="#{postForm.getSeoOgImage()}")
.col-sm-3
span Video link
input.form-control(name="seoOgVideo", value="#{postForm.getSeoOgVideo()}")
.col-sm-3
span Locale
select.form-control(name="seoOgLocale")
for ogLocale in seoOgLocales
if postForm.getSeoOgLocale() == ogLocale
option(value="#{ogLocale.getId()}", selected="selected") #{ogLocale.getName()}
else
option(value="#{ogLocale.getId()}") #{ogLocale.getName()}
.item-row
hr
button.btn.btn-primary.btn-block(type="submit") Create new post
.item-row
br
script
:javascript
var editor = ace.edit("content-editor");
editor.setTheme("ace/theme/github");
var MarkdownMode = ace.require("ace/mode/markdown").Mode;
editor.getSession().setMode(new MarkdownMode());
editor.getSession().setUseWrapMode(true);
$("form").submit(function(){
$("#content").val(editor.getValue());
return true;
});