debian-mirror-gitlab/app/assets/javascripts/admin/broadcast_messages/edit.js
2023-03-04 22:38:38 +05:30

43 lines
997 B
JavaScript

import Vue from 'vue';
import MessageForm from './components/message_form.vue';
export default () => {
const el = document.querySelector('#js-broadcast-message');
const {
id,
message,
broadcastType,
theme,
dismissable,
targetAccessLevels,
targetAccessLevelOptions,
targetPath,
startsAt,
endsAt,
} = el.dataset;
return new Vue({
el,
name: 'EditBroadcastMessage',
provide: {
targetAccessLevelOptions: JSON.parse(targetAccessLevelOptions),
},
render(createElement) {
return createElement(MessageForm, {
props: {
broadcastMessage: {
id: parseInt(id, 10),
message,
broadcastType,
theme,
dismissable: dismissable === 'true',
targetAccessLevels: JSON.parse(targetAccessLevels),
targetPath,
startsAt: new Date(startsAt),
endsAt: new Date(endsAt),
},
},
});
},
});
};