summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_alerts.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/vue_alerts.js')
-rw-r--r--app/assets/javascripts/vue_alerts.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/assets/javascripts/vue_alerts.js b/app/assets/javascripts/vue_alerts.js
new file mode 100644
index 00000000000..6550eb31491
--- /dev/null
+++ b/app/assets/javascripts/vue_alerts.js
@@ -0,0 +1,22 @@
+import Vue from 'vue';
+import { parseBoolean } from '~/lib/utils/common_utils';
+import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue';
+
+const mountVueAlert = el => {
+ const props = {
+ html: el.innerHTML,
+ };
+ const attrs = {
+ ...el.dataset,
+ dismissible: parseBoolean(el.dataset.dismissible),
+ };
+
+ return new Vue({
+ el,
+ render(h) {
+ return h(DismissibleAlert, { props, attrs });
+ },
+ });
+};
+
+export default () => [...document.querySelectorAll('.js-vue-alert')].map(mountVueAlert);