debian-mirror-gitlab/app/assets/javascripts/pages/profiles/init_timezone_dropdown.js

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

35 lines
737 B
JavaScript
Raw Normal View History

2022-11-25 23:54:43 +05:30
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;
}
2023-01-13 00:05:48 +05:30
const { timezoneData, initialValue, name } = el.dataset;
2022-11-25 23:54:43 +05:30
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,
2023-01-13 00:05:48 +05:30
name,
2022-11-25 23:54:43 +05:30
},
class: 'gl-md-form-input-lg',
});
},
});
return timezoneDropdown;
};