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

admin.js « admin « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2732fc191be5f4f1a16842175d55a0d8bade1bb3 (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
import $ from 'jquery';
import { refreshCurrentPage } from '../../lib/utils/url_utility';

function showDenylistType() {
  if ($('input[name="denylist_type"]:checked').val() === 'file') {
    $('.js-denylist-file').show();
    $('.js-denylist-raw').hide();
  } else {
    $('.js-denylist-file').hide();
    $('.js-denylist-raw').show();
  }
}

export default function adminInit() {
  $('input#user_force_random_password').on('change', function randomPasswordClick() {
    const $elems = $('#user_password, #user_password_confirmation');
    if ($(this).attr('checked')) {
      $elems.val('').prop('disabled', true);
    } else {
      $elems.prop('disabled', false);
    }
  });

  $('body').on('click', '.js-toggle-colors-link', (e) => {
    e.preventDefault();
    $('.js-toggle-colors-container').toggleClass('hide');
  });

  $('li.project_member, li.group_member').on('ajax:success', refreshCurrentPage);

  $("input[name='denylist_type']").on('click', showDenylistType);
  showDenylistType();
}