VoidForum/src/main/resources/templates/account/posts/edit.jade

90 lines
3.0 KiB
Plaintext

extends ../layout/account
block head
script(src="/webjars/ace/1.2.8/src-noconflict/ace.js")
script(src="/webjars/ace/1.2.8/src-noconflict/theme-github.js")
script(src="/webjars/ace/1.2.8/src-noconflict/mode-markdown.js")
block content
h1 Edit Post
hr
if errors != null
.alert.alert-danger
span Check out errors!
ol
for err in errors.values()
li #{err.getField()} : #{err.getErrorMessage()}
form.post-form(method="post", action="/account/posts/#{post.getId()}")
.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()}")
.col-sm-3
input(type="hidden", name="seoOgImage", value="#{postForm.getSeoOgImage()}")
input(type="hidden", name="seoOgLocale", value="#{postForm.getSeoOgLocale().getId()}")
input(type="hidden", name="seoOgType", value="#{postForm.getSeoOgType().getId()}")
input(type="hidden", name="seoDescription", value="#{postForm.getSeoDescription()}")
input(type="hidden", name="seoOgVideo", value="#{postForm.getSeoOgVideo()}")
input(type="hidden", name="seoKeywords", value="#{postForm.getSeoKeywords()}")
.item-row
hr
button.btn.btn-primary.btn-block(type="submit") Save
.item-row
br
script
:javascript
$(document).ready(function() {
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;
});
});