2022-01-28 16:00:11 -05:00
|
|
|
import $ from 'jquery';
|
2021-10-16 12:28:04 -05:00
|
|
|
import {initCompLabelEdit} from './comp/LabelEdit.js';
|
2023-02-18 23:06:14 -05:00
|
|
|
import {hideElem, showElem} from '../utils/dom.js';
|
2021-10-16 12:28:04 -05: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 23:06:14 -05:00
|
|
|
showElem($prompt);
|
|
|
|
showElem($prompt_redirect);
|
2021-10-16 12:28:04 -05:00
|
|
|
} else {
|
2023-02-18 23:06:14 -05:00
|
|
|
hideElem($prompt);
|
|
|
|
hideElem($prompt_redirect);
|
2021-10-16 12:28:04 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Labels
|
|
|
|
initCompLabelEdit('.organization.settings.labels');
|
|
|
|
}
|