From 291702e3f50ca5216dcaa30671528dd6d1549e40 Mon Sep 17 00:00:00 2001 From: Guanxiying Date: Wed, 14 Apr 2021 12:01:10 +0800 Subject: [PATCH] * Add gitlab type to repo type list. --- module/repo/js/create.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/module/repo/js/create.js b/module/repo/js/create.js index 96fbc55790..0af0d52404 100644 --- a/module/repo/js/create.js +++ b/module/repo/js/create.js @@ -6,16 +6,38 @@ $(function() $form = $(this).closest('form'); $form.css('min-height', $form.height()); }) + + $('#gitlabHost, #gitlabToken').change(function() + { + host = Base64.encode($('#gitlabHost').val()); + token = $('#gitlabToken').val(); + url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + '&token=' + token); + if(host == '' || token == '') return false; + + $.get(url, function(response) + { + $('#gitlabProject').html('').append(response); + $('#gitlabProject').chosen().trigger("chosen:updated");; + }); + }); + + $('#gitlabProject').change(function() + { + $option = $(this).find('option:selected'); + $('#name').val($option.data('name')); + }); + }); -function scmChanged(scm) { +function scmChanged(scm) +{ if(scm == 'Git') { $('.account-fields').addClass('hidden'); $('.tips-git').removeClass('hidden'); $('.tips-svn').addClass('hidden'); - } + } else { $('.account-fields').removeClass('hidden'); @@ -23,4 +45,7 @@ function scmChanged(scm) { $('.tips-git').addClass('hidden'); $('.tips-svn').removeClass('hidden'); } + + $('tr.gitlab').toggle(scm == 'Gitlab'); + $('tr.hide-gitlab').toggle(scm != 'Gitlab'); }