From 8c5fd37f4acb1a12a8bad37e9f89a64e6000d98a Mon Sep 17 00:00:00 2001 From: Helmi Akermi Date: Mon, 9 Dec 2024 12:12:28 +0100 Subject: [PATCH] feat: Add View option on refer article success snackbar - EXO-75735 - Meeds-io/MIPs#161 Add View option on refer article success snackbar --- .../components/ExoNewsDetails.vue | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/content-webapp/src/main/webapp/vue-app/news-details/components/ExoNewsDetails.vue b/content-webapp/src/main/webapp/vue-app/news-details/components/ExoNewsDetails.vue index 51cfc5ce8..61ba902fd 100644 --- a/content-webapp/src/main/webapp/vue-app/news-details/components/ExoNewsDetails.vue +++ b/content-webapp/src/main/webapp/vue-app/news-details/components/ExoNewsDetails.vue @@ -225,10 +225,17 @@ export default { this.news.deReferPageId = previousParentPageId; this.$refs.noteTreeview.isLoading = true; this.$refs.noteTreeview.close(); - this.$root.$emit('alert-message', this.$t('content.article.referred.success'), 'success'); + this.displayMessage({ + message: this.$t('content.article.referred.success'), + type: 'success', + linkText: this.$t('notes.view.label'), + alertLink: this.articlePage.url + }); }); }).catch(() => { - this.$root.$emit('alert-message', this.$t('content.article.referred.error'), 'error'); + this.displayMessage({ + message: this.$t('content.article.referred.error'), + type: 'error'}); }); }, referArticle() { @@ -239,7 +246,9 @@ export default { this.news.referred = false; return this.$newsServices.updateNews(this.news, false, this.$newsConstants.newsObjectType.ARTICLE, this.$newsConstants.newsUpdateType.PAGE_REFERENCE).then(() => { - this.$root.$emit('alert-message', this.$t('content.article.deReferred.success'), 'success'); + this.displayMessage({ + message: this.$t('content.article.deReferred.success'), + type: 'success'}); }); }); }); @@ -426,7 +435,16 @@ export default { const message = this.$t('news.details.deleteCanceled'); this.$root.$emit('alert-message', message, 'success'); }); - } + }, + displayMessage(message) { + document.dispatchEvent(new CustomEvent('alert-message-html', {detail: { + alertMessage: message?.message, + alertType: message?.type, + alertLinkText: message?.linkText, + alertLinkCallback: message?.linkCallback, + alertLink: message.alertLink + }})); + }, } };