debian-mirror-gitlab/app/assets/javascripts/profile/preferences/profile_preferences_bundle.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
733 B
JavaScript
Raw Normal View History

2021-01-29 00:20:46 +05:30
import Vue from 'vue';
import ProfilePreferences from './components/profile_preferences.vue';
export default () => {
const el = document.querySelector('#js-profile-preferences-app');
2021-03-11 19:13:27 +05:30
const formEl = document.querySelector('#profile-preferences-form');
const shouldParse = ['integrationViews', 'themes', 'userFields'];
2021-01-29 00:20:46 +05:30
2021-03-11 19:13:27 +05:30
const provide = Object.keys(el.dataset).reduce(
(memo, key) => {
let value = el.dataset[key];
if (shouldParse.includes(key)) {
value = JSON.parse(value);
}
2021-01-29 00:20:46 +05:30
2021-03-11 19:13:27 +05:30
return { ...memo, [key]: value };
},
{ formEl },
);
2021-01-29 00:20:46 +05:30
return new Vue({
el,
name: 'ProfilePreferencesApp',
provide,
2021-03-08 18:12:59 +05:30
render: (createElement) => createElement(ProfilePreferences),
2021-01-29 00:20:46 +05:30
});
};