From 6cd02af928c2eb10adfad6a46645932a1d55e7cb Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 8 Nov 2023 01:44:30 +0000 Subject: [PATCH] * Add gitlab creategroup,editgroup page. --- module/gitlab/js/common.ui.js | 8 ++ module/gitlab/js/createproject.ui.js | 8 -- module/gitlab/js/editgroup.ui.js | 4 + module/gitlab/js/editproject.ui.js | 8 -- module/gitlab/ui/creategroup.html.php | 98 ++++++++++++++++++++++++ module/gitlab/ui/editgroup.html.php | 103 ++++++++++++++++++++++++++ 6 files changed, 213 insertions(+), 16 deletions(-) create mode 100644 module/gitlab/js/editgroup.ui.js create mode 100644 module/gitlab/ui/creategroup.html.php create mode 100644 module/gitlab/ui/editgroup.html.php diff --git a/module/gitlab/js/common.ui.js b/module/gitlab/js/common.ui.js index 87e31a96ce..1958f91165 100644 --- a/module/gitlab/js/common.ui.js +++ b/module/gitlab/js/common.ui.js @@ -18,3 +18,11 @@ function setAvatar() $(".avatar").removeClass('hidden'); }); } + +function onAclChange(event) +{ + const visibility = $(event.target).val(); + + if(visibility == 'public') $("#visibilitypublic").parent().append(publicTip); + if(visibility != 'public') $('#publicTip').remove(); +} diff --git a/module/gitlab/js/createproject.ui.js b/module/gitlab/js/createproject.ui.js index 19918652f1..74b6236a74 100644 --- a/module/gitlab/js/createproject.ui.js +++ b/module/gitlab/js/createproject.ui.js @@ -2,11 +2,3 @@ function onNameChange(event) { $("#path").val($(event.target).val().toLowerCase()); } - -function onAclChange(event) -{ - const visibility = $(event.target).val(); - - if(visibility == 'public') $("#visibilitypublic").parent().append(publicTip); - if(visibility != 'public') $('#publicTip').remove(); -} diff --git a/module/gitlab/js/editgroup.ui.js b/module/gitlab/js/editgroup.ui.js new file mode 100644 index 0000000000..df9ee9fc25 --- /dev/null +++ b/module/gitlab/js/editgroup.ui.js @@ -0,0 +1,4 @@ +$(function() +{ + if(visibility == 'public') $("#visibilitypublic").parent().append(publicTip); +}); diff --git a/module/gitlab/js/editproject.ui.js b/module/gitlab/js/editproject.ui.js index 2301f843ce..df9ee9fc25 100644 --- a/module/gitlab/js/editproject.ui.js +++ b/module/gitlab/js/editproject.ui.js @@ -1,11 +1,3 @@ -function onAclChange(event) -{ - const visibility = $(event.target).val(); - - if(visibility == 'public') $("#visibilitypublic").parent().append(publicTip); - if(visibility != 'public') $('#publicTip').remove(); -} - $(function() { if(visibility == 'public') $("#visibilitypublic").parent().append(publicTip); diff --git a/module/gitlab/ui/creategroup.html.php b/module/gitlab/ui/creategroup.html.php new file mode 100644 index 0000000000..d1cf2488ca --- /dev/null +++ b/module/gitlab/ui/creategroup.html.php @@ -0,0 +1,98 @@ + + * @package gitlab + * @link https://www.zentao.net + */ +namespace zin; + +$publicTip = "" . $lang->gitlab->group->publicTip . ''; +jsVar('publicTip', $publicTip); + +formPanel +( + set::title($lang->gitlab->group->create), + set::labelWidth($app->clientLang == 'zh-cn' ? '8em' : '13em'), + formGroup + ( + set::name('name'), + set::label($lang->gitlab->group->name), + set::placeholder($lang->gitlab->group->name), + set::required(true), + set::width('1/2') + ), + formGroup + ( + set::label($lang->gitlab->group->path), + set::width('1/2'), + set::required(true), + inputGroup + ( + $gitlab->url . '/', + input + ( + set::name('path'), + set::placeholder($lang->gitlab->group->path) + ) + ) + ), + formGroup + ( + set::label($lang->gitlab->group->description), + set::name('description'), + set::placeholder($lang->gitlab->group->description), + set::width('1/2') + ), + formGroup + ( + set::label($lang->gitlab->group->visibility), + set::name('visibility'), + set::control('radioList'), + set::items($lang->gitlab->group->visibilityList), + set::value('private'), + on::change('onAclChange') + ), + formGroup + ( + set::label($lang->gitlab->group->permission), + set::name('request_access_enabled'), + set::control(array('type' => 'checkbox', 'value' => '1', 'text' => $lang->gitlab->group->requestAccessEnabledTip, 'checked' => true)) + ), + formGroup + ( + set::label($lang->gitlab->group->lfsEnabled), + set::name('lfs_enabled'), + set::control(array('type' => 'checkbox', 'value' => '1' , 'text' => $lang->gitlab->group->lfsEnabledTip, 'checked' => true)) + ), + formGroup + ( + set::label($lang->gitlab->group->projectCreationLevel), + set::width('1/2'), + picker + ( + set::name('project_creation_level'), + set::items($lang->gitlab->group->projectCreationLevelList), + set::value('developer'), + set::required(true) + ), + ), + formGroup + ( + set::label($lang->gitlab->group->subgroupCreationLevel), + set::width('1/2'), + picker + ( + set::name('subgroup_creation_level'), + set::items($lang->gitlab->group->subgroupCreationLevelList), + set::value('maintainer'), + set::required(true) + ) + ) +); + +render(); + diff --git a/module/gitlab/ui/editgroup.html.php b/module/gitlab/ui/editgroup.html.php new file mode 100644 index 0000000000..eaba3b2bfc --- /dev/null +++ b/module/gitlab/ui/editgroup.html.php @@ -0,0 +1,103 @@ + + * @package gitlab + * @link https://www.zentao.net + */ +namespace zin; + +$publicTip = "" . $lang->gitlab->group->publicTip . ''; +jsVar('publicTip', $publicTip); +jsVar('visibility', $group->visibility); + +formPanel +( + set::title($lang->gitlab->group->edit), + set::labelWidth($app->clientLang == 'zh-cn' ? '8em' : '13em'), + formGroup + ( + set::name('name'), + set::label($lang->gitlab->group->name), + set::placeholder($lang->gitlab->group->name), + set::value($group->name), + set::required(true), + set::width('1/2') + ), + formGroup + ( + set::label($lang->gitlab->group->path), + set::width('1/2'), + set::required(true), + inputGroup + ( + $gitlab->url . '/', + input + ( + set::name('path'), + set::placeholder($lang->gitlab->group->path), + set::value($group->path), + set::readonly(true) + ) + ) + ), + formGroup + ( + set::label($lang->gitlab->group->description), + set::name('description'), + set::placeholder($lang->gitlab->group->description), + set::value($group->description), + set::width('1/2') + ), + formGroup + ( + set::label($lang->gitlab->group->visibility), + set::name('visibility'), + set::control('radioList'), + set::items($lang->gitlab->group->visibilityList), + set::value($group->visibility), + on::change('onAclChange') + ), + formGroup + ( + set::label($lang->gitlab->group->permission), + set::name('request_access_enabled'), + set::control(array('type' => 'checkbox', 'value' => '1', 'text' => $lang->gitlab->group->requestAccessEnabledTip, 'checked' => $group->request_access_enabled ? true : false)) + ), + formGroup + ( + set::label($lang->gitlab->group->lfsEnabled), + set::name('lfs_enabled'), + set::control(array('type' => 'checkbox', 'value' => '1' , 'text' => $lang->gitlab->group->lfsEnabledTip, 'checked' => $group->lfs_enabled ? true : false)) + ), + formGroup + ( + set::label($lang->gitlab->group->projectCreationLevel), + set::width('1/2'), + picker + ( + set::name('project_creation_level'), + set::items($lang->gitlab->group->projectCreationLevelList), + set::value($group->project_creation_level), + set::required(true) + ), + ), + formGroup + ( + set::label($lang->gitlab->group->subgroupCreationLevel), + set::width('1/2'), + picker + ( + set::name('subgroup_creation_level'), + set::items($lang->gitlab->group->subgroupCreationLevelList), + set::value($group->subgroup_creation_level), + set::required(true) + ) + ) +); + +render(); +