Welcome to mirror list, hosted at ThFree Co, Russian Federation.

init_timezone_dropdown.js « profiles « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 80b911493a85d35f4c6f1672152d856b75b3c7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
};