Browse Source

"contains embedded tweets" option for post editor

develop
Rob Colbert 4 months ago
parent
commit
a70ea4d09d
  1. 1
      app/models/post.js
  2. 1
      app/services/post.js
  3. 21
      app/views/post/editor.pug
  4. 6
      app/views/post/view.pug

1
app/models/post.js

@ -32,6 +32,7 @@ const PostSchema = new Schema({
flags: {
enableComments: { type: Boolean, default: true, index: true },
isFeatured: { type: Boolean, default: false, index: true },
hasTweets: { type: Boolean, default: false, required: true },
},
});

1
app/services/post.js

@ -157,6 +157,7 @@ class PostService extends SiteService {
updateOp.$set['flags.enableComments'] = postDefinition.enableComments === 'on';
updateOp.$set['flags.isFeatured'] = postDefinition.isFeatured === 'on';
updateOp.$set['flags.hasTweets'] = postDefinition.hasTweets === 'on';
const OLD_STATUS = post.status;
const postAuthor = post.author;

21
app/views/post/editor.pug

@ -51,13 +51,22 @@ block content
.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
.pretty.p-switch.p-slim
input(id="enable-comments", name="enableComments", type="checkbox", checked= post ? post.flags.enableComments : true)
.state.p-success
label Enable comments
.uk-width-auto
.pretty.p-switch.p-slim
input(id="is-featured", name="isFeatured", type="checkbox", checked= post ? post.flags.isFeatured : false)
.state.p-success
label Featured
.uk-width-auto
label
input(id="is-featured", name="isFeatured", type="checkbox", checked= post ? post.flags.isFeatured : false).uk-checkbox
| Featured
.pretty.p-switch.p-slim
input(id="enable-tweets", name="hasTweets", type="checkbox", checked= post ? post.flags.hasTweets : false)
.state.p-success
label Contains embedded tweets
if post
.uk-margin

6
app/views/post/view.pug

@ -103,4 +103,8 @@ block content
ul#post-comment-list.uk-list.uk-list-divider.uk-list-large
div There are no comments at this time. Please check back later.
else
div Come join the discussion in #[a(href='/chat/room') the chat].
div Come join the discussion in #[a(href='/chat/room') the chat].
block viewjs
if post.flags.hasTweets
script(async, src="https://platform.twitter.com/widgets.js", charset="utf-8")
Loading…
Cancel
Save