debian-mirror-gitlab/app/assets/javascripts/pages/admin/admin.js

66 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2018-03-17 18:26:18 +05:30
import { refreshCurrentPage } from '../../lib/utils/url_utility';
2021-01-29 00:20:46 +05:30
function showDenylistType() {
if ($('input[name="denylist_type"]:checked').val() === 'file') {
$('.js-denylist-file').show();
$('.js-denylist-raw').hide();
2018-03-17 18:26:18 +05:30
} else {
2021-01-29 00:20:46 +05:30
$('.js-denylist-file').hide();
$('.js-denylist-raw').show();
2018-03-17 18:26:18 +05:30
}
}
export default function adminInit() {
const modal = $('.change-owner-holder');
$('input#user_force_random_password').on('change', function randomPasswordClick() {
const $elems = $('#user_password, #user_password_confirmation');
if ($(this).attr('checked')) {
2018-03-27 19:54:05 +05:30
$elems.val('').prop('disabled', true);
2018-03-17 18:26:18 +05:30
} else {
2018-03-27 19:54:05 +05:30
$elems.prop('disabled', false);
2018-03-17 18:26:18 +05:30
}
});
2021-03-08 18:12:59 +05:30
$('body').on('click', '.js-toggle-colors-link', (e) => {
2018-03-17 18:26:18 +05:30
e.preventDefault();
2018-11-08 19:23:39 +05:30
$('.js-toggle-colors-container').toggleClass('hide');
2018-03-17 18:26:18 +05:30
});
$('.log-tabs a').on('click', function logTabsClick(e) {
e.preventDefault();
$(this).tab('show');
});
2021-03-08 18:12:59 +05:30
$('.log-bottom').on('click', (e) => {
2018-03-17 18:26:18 +05:30
e.preventDefault();
const $visibleLog = $('.file-content:visible');
2020-03-13 15:44:24 +05:30
// eslint-disable-next-line no-jquery/no-animate
2018-12-13 13:39:08 +05:30
$visibleLog.animate(
{
scrollTop: $visibleLog.find('ol').height(),
},
'fast',
);
2018-03-17 18:26:18 +05:30
});
$('.change-owner-link').on('click', function changeOwnerLinkClick(e) {
e.preventDefault();
$(this).hide();
modal.show();
});
2021-03-08 18:12:59 +05:30
$('.change-owner-cancel-link').on('click', (e) => {
2018-03-17 18:26:18 +05:30
e.preventDefault();
modal.hide();
$('.change-owner-link').show();
});
$('li.project_member, li.group_member').on('ajax:success', refreshCurrentPage);
2021-01-29 00:20:46 +05:30
$("input[name='denylist_type']").on('click', showDenylistType);
showDenylistType();
2018-03-17 18:26:18 +05:30
}