diff options
Diffstat (limited to 'app/assets/javascripts/notifications/index.js')
-rw-r--r-- | app/assets/javascripts/notifications/index.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app/assets/javascripts/notifications/index.js b/app/assets/javascripts/notifications/index.js new file mode 100644 index 00000000000..d60a368703c --- /dev/null +++ b/app/assets/javascripts/notifications/index.js @@ -0,0 +1,44 @@ +import { GlToast } from '@gitlab/ui'; +import Vue from 'vue'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import NotificationsDropdown from './components/notifications_dropdown.vue'; + +Vue.use(GlToast); + +export default () => { + const containers = document.querySelectorAll('.js-vue-notification-dropdown'); + + if (!containers.length) return false; + + return containers.forEach((el) => { + const { + containerClass, + buttonSize, + disabled, + dropdownItems, + notificationLevel, + helpPagePath, + projectId, + groupId, + showLabel, + } = el.dataset; + + return new Vue({ + el, + provide: { + containerClass, + buttonSize, + disabled: parseBoolean(disabled), + dropdownItems: JSON.parse(dropdownItems), + initialNotificationLevel: notificationLevel, + helpPagePath, + projectId, + groupId, + showLabel: parseBoolean(showLabel), + }, + render(h) { + return h(NotificationsDropdown); + }, + }); + }); +}; |