|
@@ -9,13 +9,14 @@
|
|
<div class="full-page-takeover-header-button">
|
|
<div class="full-page-takeover-header-button">
|
|
<!-- TODO: Check blog validity before publishing -->
|
|
<!-- TODO: Check blog validity before publishing -->
|
|
<Modal
|
|
<Modal
|
|
|
|
+ @opened="checkBlogValidity"
|
|
openTitle="Publish"
|
|
openTitle="Publish"
|
|
openBtnClass="button is-success is-medium is-inverted is-outlined"
|
|
openBtnClass="button is-success is-medium is-inverted is-outlined"
|
|
title="Review Details">
|
|
title="Review Details">
|
|
<div>
|
|
<div>
|
|
<div class="title">Once you publish blog you cannot change url to a blog.</div>
|
|
<div class="title">Once you publish blog you cannot change url to a blog.</div>
|
|
<!-- Check for error -->
|
|
<!-- Check for error -->
|
|
- <div>
|
|
|
|
|
|
+ <div v-if="!publishError">
|
|
<div class="subtitle">Current Url is:</div>
|
|
<div class="subtitle">Current Url is:</div>
|
|
<article class="message is-success">
|
|
<article class="message is-success">
|
|
<div class="message-body">
|
|
<div class="message-body">
|
|
@@ -24,11 +25,11 @@
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</article>
|
|
</div>
|
|
</div>
|
|
- <!-- <article class="message is-danger">
|
|
|
|
|
|
+ <article v-else class="message is-danger">
|
|
<div class="message-body">
|
|
<div class="message-body">
|
|
- Display error here
|
|
|
|
|
|
+ {{publishError}}
|
|
</div>
|
|
</div>
|
|
- </article> -->
|
|
|
|
|
|
+ </article>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
</Modal>
|
|
</div>
|
|
</div>
|
|
@@ -52,6 +53,7 @@
|
|
@editorMounted="initBlogContent"
|
|
@editorMounted="initBlogContent"
|
|
@editorUpdated="updateBlog"
|
|
@editorUpdated="updateBlog"
|
|
:isSaving="isSaving"
|
|
:isSaving="isSaving"
|
|
|
|
+ ref="editor"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -67,6 +69,11 @@ export default {
|
|
components: {
|
|
components: {
|
|
Editor, Header, Modal
|
|
Editor, Header, Modal
|
|
},
|
|
},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ publishError: ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
computed : {
|
|
computed : {
|
|
...mapState({
|
|
...mapState({
|
|
blog: ({instructor}) => instructor.blog.item,
|
|
blog: ({instructor}) => instructor.blog.item,
|
|
@@ -96,6 +103,15 @@ export default {
|
|
}catch(error){
|
|
}catch(error){
|
|
this.$toasted.error('Blog cannot be saved!', {duration: 2000})
|
|
this.$toasted.error('Blog cannot be saved!', {duration: 2000})
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ checkBlogValidity() {
|
|
|
|
+ const title = this.$refs.editor.getNodeValueByName('title')
|
|
|
|
+ this.publishError = ''
|
|
|
|
+ if (title && title.length > 24) {
|
|
|
|
+ // create slug from title
|
|
|
|
+ } else {
|
|
|
|
+ this.publishError = 'Cannot publish! Title needs to be longer than 24 characters!'
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|