Commit 94a19cbd authored by Tim Zallmann's avatar Tim Zallmann

Latest Changes from CE applied

parent ace34ad1
......@@ -245,7 +245,7 @@ import AuditLogs from './audit_logs';
case 'projects:tags:new':
new ZenMode();
new gl.GLForm($('.tag-form'), true);
new RefSelectDropdown($('.js-branch-select'), JSON.parse(document.getElementById('availableRefs').innerHTML));
new RefSelectDropdown($('.js-branch-select'));
break;
case 'projects:snippets:new':
case 'projects:snippets:edit':
......@@ -311,7 +311,7 @@ import AuditLogs from './audit_logs';
setupProjectEdit();
break;
case 'projects:pipelines:new':
new NewBranchForm($('.js-new-pipeline-form'), JSON.parse(document.getElementById('availableRefs').innerHTML));
new NewBranchForm($('.js-new-pipeline-form'));
break;
case 'projects:pipelines:builds':
case 'projects:pipelines:failures':
......
......@@ -2,30 +2,30 @@ document.addEventListener('DOMContentLoaded', () => {
const importBtnTooltip = 'Please enter a valid project name.';
const $importBtnWrapper = $('.import_gitlab_project');
$('.how_to_import_link').bind('click', (e) => {
$('.how_to_import_link').on('click', (e) => {
e.preventDefault();
$('.how_to_import_link').next('.modal').show();
});
$('.modal-header .close').bind('click', () => {
$('.modal-header .close').on('click', () => {
$('.modal').hide();
});
$('.btn_import_gitlab_project').bind('click', () => {
$('.btn_import_gitlab_project').on('click', () => {
const importHref = $('a.btn_import_gitlab_project').attr('href');
$('.btn_import_gitlab_project').attr('href', `${importHref}?namespace_id=${$('#project_namespace_id').val()}&path=${$('#project_path').val()}`);
});
$('.btn_import_gitlab_project').attr('disabled', $('#project_path').val().trim().length === 0);
$('.btn_import_gitlab_project').attr('disabled', !$('#project_path').val().trim().length);
$importBtnWrapper.attr('title', importBtnTooltip);
$('#new_project').submit(() => {
$('#new_project').on('submit', () => {
const $path = $('#project_path');
$path.val($path.val().trim());
});
$('#project_path').keyup(() => {
if ($('#project_path').val().trim().length !== 0) {
$('#project_path').on('keyup', () => {
if ($('#project_path').val().trim().length) {
$('.btn_import_gitlab_project').attr('disabled', false);
$importBtnWrapper.attr('title', '');
$importBtnWrapper.removeClass('has-tooltip');
......@@ -36,7 +36,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
$('#project_import_url').disable();
$('.import_git').click(() => {
$('.import_git').on('click', () => {
const $projectImportUrl = $('#project_import_url');
$projectImportUrl.attr('disabled', !$projectImportUrl.attr('disabled'));
});
......
class RefSelectDropdown {
constructor($dropdownButton, availableRefs) {
const availableRefsValue = availableRefs || JSON.parse(document.getElementById('availableRefs').innerHTML);
$dropdownButton.glDropdown({
data: availableRefs,
data: availableRefsValue,
filterable: true,
filterByText: true,
remote: false,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment