Skip to content

Commit

Permalink
feat: Use new publication drawer in article details - EXO-72749_EXO-7…
Browse files Browse the repository at this point in the history
…3246 - Meeds-io/MIPs#161 (#257)

Use new publication drawer in article details
  • Loading branch information
hakermi authored and exo-swf committed Oct 9, 2024
1 parent 621623b commit 14811fd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
3 changes: 3 additions & 0 deletions content-webapp/src/main/webapp/WEB-INF/gatein-resources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@
<minify>false</minify>
<path>/js/newsDetails.bundle.js</path>
</script>
<depends>
<module>NotesPublication</module>
</depends>
<depends>
<module>vue</module>
</depends>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export default {
},
postAndPublish(editMode, publicationSettings) {
if (editMode) {
this.article.activityPosted = publicationSettings?.post;
this.updateAndPostArticle();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@
:cancel-label="$t('news.button.cancel')"
@ok="deleteNews" />
<exo-news-edit-publishing-drawer
v-if="news && currentUser"
v-if="news && currentUser && !newPublicationDrawerEnabled"
:news="news"
@refresh-news="getNewsById(newsId)" />
<note-publication-drawer
v-if="newPublicationDrawerEnabled"
ref="publicationDrawer"
:is-publishing="isPublishing"
:space-id="spaceId"
:edit-mode="true"
@publish="publishArticle" />
<news-mobile-action-menu
:news="news"
@edit-article="editLink"
Expand Down Expand Up @@ -156,7 +163,8 @@ export default {
hour: '2-digit',
minute: '2-digit',
},
iframelyOriginRegex: /^https?:\/\/if-cdn.com/
iframelyOriginRegex: /^https?:\/\/if-cdn.com/,
isPublishing: false
};
},
computed: {
Expand All @@ -168,6 +176,9 @@ export default {
},
articleNewLayoutEnabled() {
return eXo?.env?.portal?.articleNewLayoutEnabled;
},
newPublicationDrawerEnabled() {
return eXo?.env?.portal?.newPublicationDrawerEnabled;
}
},
created() {
Expand All @@ -189,11 +200,17 @@ export default {
}
}
});
this.$root.$on('open-edit-publishing-drawer', this.openPublicationDrawer);
},
mounted() {
this.markNewsAsRead(this.newsId);
},
methods: {
openPublicationDrawer() {
if (this.newPublicationDrawerEnabled) {
this.$refs.publicationDrawer.open(this.news);
}
},
markNewsAsRead(newsId) {
if (newsId) {
this.$newsServices.markNewsAsRead(newsId);
Expand Down Expand Up @@ -242,7 +259,18 @@ export default {
}
}, redirectionTime);
},
publishArticle(publicationSettings) {
this.isPublishing = true;
this.news.activityPosted = publicationSettings?.post;
return this.$newsServices.updateNews(this.news, false, this.$newsConstants.newsObjectType.ARTICLE, this.$newsConstants.newsUpdateType.POSTING_AND_PUBLISHING).then(() => {
this.isPublishing = false;
this.$root.$emit('alert-message', this.$t('news.composer.alert.success.UpdateTargets'), 'success');
this.$refs.publicationDrawer.close();
}).catch(() => {
this.isPublishing = false;
this.$root.$emit('alert-message', this.$t('news.composer.alert.error.UpdateTargets'), 'error');
});
},
postNews(schedulePostDate, postArticleMode, publish, isActivityPosted, selectedTargets, selectedAudience) {
this.news.timeZoneId = USER_TIMEZONE_ID;
this.news.activityPosted = isActivityPosted;
Expand Down

0 comments on commit 14811fd

Please sign in to comment.