* code for task #17340.

This commit is contained in:
王怡栋
2021-12-10 14:14:25 +08:00
parent c0ce88d4fb
commit 36be7f468c
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -47,15 +47,19 @@ function deleteItem(obj)
$(document).on('change', '[id^="levels"]', function()
{
$tr = $(this).closest('tr');
$next = $(this).closest('td').next()
if($(this).val() == '50')
var ownerLevel = 50;
if($(this).val() == ownerLevel)
{
$next.prepend('<input type="text" value="" class="form-control disabled" disabled autocomplete="off" />');
$next.find('[id^="expires"]').addClass('hidden');
$tr.find('a[onclick^="deleteItem"]').addClass('disabled');
}
else
{
$next.find('[id^="expires"]').removeClass('hidden');
$next.find('input.disabled').remove();
$tr.find('a[onclick^="deleteItem"]').removeClass('disabled');
}
})
@@ -19,14 +19,14 @@
</tr>
</thead>
<tbody>
<?php $ownerLevel = 50;?>
<?php $i = 0;?>
<?php foreach($currentMembers as $member):?>
<tr>
<td><?php echo html::input("names[$i]", $member->name, "class='form-control' readonly");?></td>
<td><?php echo html::select("levels[$i]", array(''=>'') + $this->lang->gitlab->accessLevels, $member->access_level, "class='form-control chosen'");?></td>
<td>
<?php /* 50 represents the owner role. */ ?>
<?php if($member->access_level == '50'):?>
<?php if($member->access_level == $ownerLevel):?>
<input type="text" value="" class="form-control disabled" disabled autocomplete="off" />
<?php echo html::input("expires[$i]", $member->expires_at, "class='form-control form-date hidden'");?>
<?php else:?>
@@ -36,7 +36,7 @@
</td>
<td class='c-actions text-center'>
<?php echo html::a('javascript:;', "<i class='icon-plus'></i>", '', "onclick='addItem(this)' class='btn btn-link'");?>
<?php echo html::a('javascript:;', "<i class='icon icon-close'></i>", '', "onclick='deleteItem(this)' class='btn btn-link'");?>
<?php echo html::a('javascript:;', "<i class='icon icon-close'></i>", '', "onclick='deleteItem(this)' class='btn btn-link" . ($member->access_level == $ownerLevel ? ' disabled' : '') . "'");?>
</td>
</tr>
<?php $i ++;?>