summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstance Okoghenun <cokoghenun@gitlab.com>2018-05-07 17:45:33 +0100
committerConstance Okoghenun <cokoghenun@gitlab.com>2018-05-07 17:45:33 +0100
commit504ef7a5a2e6203c8bc4db091f0876e05b8b8f67 (patch)
treeeffd496f5a66a4cebaeb69136baef92b9b40af4a
parent22651a63901c04445be571c788c51921b1ddac45 (diff)
downloadgitlab-ce-504ef7a5a2e6203c8bc4db091f0876e05b8b8f67.tar.gz
Made delete wiki modal component props required and changed the component init behaviour
-rw-r--r--app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue6
-rw-r--r--app/assets/javascripts/pages/projects/wikis/index.js41
2 files changed, 26 insertions, 21 deletions
diff --git a/app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue b/app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue
index ce5f28b464c..e59758b14a0 100644
--- a/app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue
+++ b/app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue
@@ -10,17 +10,17 @@ export default {
props: {
deleteWikiUrl: {
type: String,
- required: false,
+ required: true,
default: '',
},
pageTitle: {
type: String,
- required: false,
+ required: true,
default: '',
},
csrfToken: {
type: String,
- required: false,
+ required: true,
default: '',
},
},
diff --git a/app/assets/javascripts/pages/projects/wikis/index.js b/app/assets/javascripts/pages/projects/wikis/index.js
index 169fa5d85a8..0295653cb29 100644
--- a/app/assets/javascripts/pages/projects/wikis/index.js
+++ b/app/assets/javascripts/pages/projects/wikis/index.js
@@ -14,22 +14,27 @@ document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new
new GLForm($('.wiki-form'), true); // eslint-disable-line no-new
- Vue.use(Translate);
- const { deleteWikiUrl, pageTitle } = document.getElementById('delete-wiki-button').dataset;
- const deleteWikiModalEl = document.getElementById('delete-wiki-modal');
- const deleteModal = new Vue({ // eslint-disable-line
- el: deleteWikiModalEl,
- data: {
- deleteWikiUrl: '',
- },
- render(createElement) {
- return createElement(deleteWikiModal, {
- props: {
- pageTitle,
- deleteWikiUrl,
- csrfToken: csrf.token,
- },
- });
- },
- });
+ const deleteWikiButton = document.getElementById('delete-wiki-button');
+
+ if (deleteWikiButton) {
+ Vue.use(Translate);
+
+ const { deleteWikiUrl, pageTitle } = deleteWikiButton.dataset;
+ const deleteWikiModalEl = document.getElementById('delete-wiki-modal');
+ const deleteModal = new Vue({ // eslint-disable-line
+ el: deleteWikiModalEl,
+ data: {
+ deleteWikiUrl: '',
+ },
+ render(createElement) {
+ return createElement(deleteWikiModal, {
+ props: {
+ pageTitle,
+ deleteWikiUrl,
+ csrfToken: csrf.token,
+ },
+ });
+ },
+ });
+ }
});