blob: e846e7ead77553a21169ecfb269c595939d9cff6 (
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
|
(() => {
const global = window.gl || (window.gl = {});
const VISIBILITY_DESCRIPTIONS = {
0: 'Project access must be granted explicitly to each user.',
10: 'This project can be cloned by any logged in user.',
20: 'The project can be cloned without any authentication.',
};
class VisibilitySelect {
constructor() {
this.visibilitySelect = document.querySelector('.js-visibility-select');
this.helpBlock = this.visibilitySelect.querySelector('.help-block');
this.select = this.visibilitySelect.querySelector('select');
if (this.select) {
this.visibilityChanged();
this.select.addEventListener('change', this.visibilityChanged.bind(this));
} else {
this.helpBlock.textContent = this.visibilitySelect.querySelector('.js-locked').dataset.helpBlock;
}
}
visibilityChanged() {
this.helpBlock.innerText = VISIBILITY_DESCRIPTIONS[this.select.value];
}
}
global.VisibilitySelect = VisibilitySelect;
})();
|