debian-mirror-gitlab/app/assets/javascripts/notifications/index.js
2022-04-04 11:22:00 +05:30

46 lines
1.1 KiB
JavaScript

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,
noFlip,
} = el.dataset;
return new Vue({
el,
provide: {
containerClass,
buttonSize,
disabled: parseBoolean(disabled),
dropdownItems: JSON.parse(dropdownItems),
initialNotificationLevel: notificationLevel,
helpPagePath,
projectId,
groupId,
showLabel: parseBoolean(showLabel),
noFlip: parseBoolean(noFlip),
},
render(h) {
return h(NotificationsDropdown);
},
});
});
};