aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/common-organization.ts
blob: 9d5964c4c7781c30c57a682d1c12a9e0769a7e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import {initCompLabelEdit} from './comp/LabelEdit.ts';
import {queryElems, toggleElem} from '../utils/dom.ts';
import {initAvatarUploaderWithCropper} from './comp/Cropper.ts';

export function initCommonOrganization() {
  if (!document.querySelectorAll('.organization').length) {
    return;
  }

  document.querySelector<HTMLInputElement>('.organization.settings.options #org_name')?.addEventListener('input', function () {
    const nameChanged = this.value.toLowerCase() !== this.getAttribute('data-org-name').toLowerCase();
    toggleElem('#org-name-change-prompt', nameChanged);
  });

  // Labels
  initCompLabelEdit('.page-content.organization.settings.labels');

  queryElems(document, '.avatar-file-with-cropper', initAvatarUploaderWithCropper);
}