2022-01-28 14:00:11 -07:00
|
|
|
import $ from 'jquery';
|
2021-10-16 10:28:04 -07:00
|
|
|
import {initCompLabelEdit} from './comp/LabelEdit.js';
|
2023-02-18 21:06:14 -07:00
|
|
|
import {hideElem, showElem} from '../utils/dom.js';
|
2021-10-16 10:28:04 -07:00
|
|
|
|
|
|
|
export function initCommonOrganization() {
|
|
|
|
if ($('.organization').length === 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('.organization.settings.options').length > 0) {
|
|
|
|
$('#org_name').on('keyup', function () {
|
|
|
|
const $prompt = $('#org-name-change-prompt');
|
|
|
|
const $prompt_redirect = $('#org-name-change-redirect-prompt');
|
|
|
|
if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
|
2023-02-18 21:06:14 -07:00
|
|
|
showElem($prompt);
|
|
|
|
showElem($prompt_redirect);
|
2021-10-16 10:28:04 -07:00
|
|
|
} else {
|
2023-02-18 21:06:14 -07:00
|
|
|
hideElem($prompt);
|
|
|
|
hideElem($prompt_redirect);
|
2021-10-16 10:28:04 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Labels
|
|
|
|
initCompLabelEdit('.organization.settings.labels');
|
|
|
|
}
|