debian-mirror-gitlab/app/assets/javascripts/pages/profiles/init_timezone_dropdown.js
2022-11-25 23:54:43 +05:30

34 lines
749 B
JavaScript

import Vue from 'vue';
import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown/timezone_dropdown.vue';
export const initTimezoneDropdown = () => {
const el = document.querySelector('.js-timezone-dropdown');
if (!el) {
return null;
}
const { timezoneData, initialValue } = el.dataset;
const timezones = JSON.parse(timezoneData);
const timezoneDropdown = new Vue({
el,
data() {
return {
value: initialValue,
};
},
render(h) {
return h(TimezoneDropdown, {
props: {
value: this.value,
timezoneData: timezones,
name: 'user[timezone]',
},
class: 'gl-md-form-input-lg',
});
},
});
return timezoneDropdown;
};