A web application allowing people to create an account, configure a profile, and share a list of URLs on that profile.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

89 lines
3.7 KiB

extends ../layouts/main
block content
- var actionUrl = post ? `/admin/post/${post._id}` : `/admin/post`;
form(method="POST", action= actionUrl).uk-form
div(uk-grid).uk-grid-small
div(class="uk-width-1-1 uk-width-2-3@m")
.uk-margin
label(for="content").uk-form-label Post body
textarea(id="content", name="content", rows="4").uk-textarea= post ? post.content : undefined
div(class="uk-width-1-1 uk-width-1-3@m")
.uk-margin
label(for="title").uk-form-label Post title
input(id="title", name="title", type="text", placeholder= "Enter post title", value= post ? post.title : undefined).uk-input
.uk-margin
label(for="slug").uk-form-label URL slug
-
var postSlug;
if (post) {
postSlug = post.slug.split('-');
postSlug.pop();
postSlug = postSlug.join('-');
}
input(id="slug", name="slug", type="text", placeholder= "Enter post URL slug", value= post ? postSlug : undefined).uk-input
.uk-text-small The slug is used in the link to the page https://#{site.domain}/post/#{post ? post.slug : 'your-slug-here'}
.uk-margin
label(for="summary").uk-form-label Post summary
textarea(id="summary", name="summary", rows="4", placeholder= "Enter post summary (text only, no HTML)").uk-textarea= post ? post.summary : undefined
div(uk-grid)
.uk-width-auto
button(type="submit").uk-button.dtp-button-primary= post ? 'Update post' : 'Create post'
.uk-margin
label(for="status").uk-form-label Status
select(id="status", name="status").uk-select
option(value="draft", selected= post ? post.status === 'draft' : true) Draft
option(value="published", selected= post ? post.status === 'published' : false) Published
option(value="archived", selected= post ? post.status === 'archived' : false) Archived
.uk-margin
div(uk-grid).uk-grid-small
.uk-width-auto
label
input(id="enable-comments", name="enableComments", type="checkbox", checked= post ? post.flags.enableComments : true).uk-checkbox
| Enable comments
.uk-width-auto
label
input(id="is-featured", name="isFeatured", type="checkbox", checked= post ? post.flags.isFeatured : false).uk-checkbox
| Featured
block viewjs
script(src="/tinymce/tinymce.min.js")
script.
window.addEventListener('dtp-load', async ( ) => {
const toolbarItems = [
'undo redo',
'formatselect visualblocks',
'bold italic backcolor',
'alignleft aligncenter alignright alignjustify',
'bullist numlist outdent indent removeformat',
'link image code',
'help'
];
const pluginItems = [
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'print',
'preview', 'anchor', 'searchreplace', 'visualblocks', 'code',
'fullscreen', 'insertdatetime', 'media', 'table', 'paste', 'code',
'help', 'wordcount',
]
const editors = await tinymce.init({
selector: 'textarea#content',
height: 500,
menubar: false,
plugins: pluginItems.join(' '),
toolbar: toolbarItems.join('|'),
branding: false,
images_upload_url: '/image/tinymce',
image_class_list: [
{ title: 'Body Image', value: 'dtp-image-body' },
{ title: 'Title Image', value: 'dtp-image-title' },
],
convert_urls: false,
skin: "oxide-dark",
content_css: "dark",
});
window.dtp.app.editor = editors[0];
});