#6061 - Administration: Add a confirmation on profile field delete button (#6062)

* #6061 - Administration: Add a confirmation on profile field delete button

* Update ProfileCest.php

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
Marc Farré 2023-01-25 18:41:26 +01:00 committed by GitHub
parent d4990e5869
commit 108161a75a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -12,3 +12,4 @@ HumHub Changelog (DEVELOP)
- Enh #6031: On users list grid, show Auth mode badge only for sys admins
- Enh #6035: Added Estonian language
- Fix #5956: Display all newer comments after current comment
- Enh #6061: Administration: Add a confirmation on profile field delete button

View File

@ -195,9 +195,9 @@ class HForm extends \yii\base\Component
{
$output = "";
foreach ($buttons as $buttonName => $definition) {
$definition['isVisible'] = isset($definition['isVisible']) ? $definition['isVisible'] : true;
if ($definition['type'] == 'submit' && $definition['isVisible']) {
$output .= \yii\helpers\Html::submitButton($definition['label'], ['name' => $buttonName, 'class' => $definition['class'], 'data-ui-loader' => '']);
$isVisible = $definition['isVisible'] ?? true;
if ($definition['type'] == 'submit' && $isVisible) {
$output .= \yii\helpers\Html::submitButton($definition['label'], array_merge(['name' => $buttonName, 'class' => $definition['class'], 'data-ui-loader' => ''], $definition['options'] ?? []));
$output .= "&nbsp;";
}
}

View File

@ -136,7 +136,8 @@ class UserProfileController extends Controller
$definition['buttons']['delete'] = [
'type' => 'submit',
'label' => Yii::t('AdminModule.user', 'Delete'),
'class' => 'btn btn-danger pull-right'
'class' => 'btn btn-danger pull-right',
'options' => ['data-action-confirm' => ''],
];
}

View File

@ -199,6 +199,8 @@ class ProfileCest
$I->jsClick('.tab-pane.active tr[data-key=0] td:last-child a');
$I->waitForText('Edit profile field');
$I->click('Delete');
$I->waitForText('Confirm');
$I->click('Confirm');
$I->seeSuccess('Deleted');
}
}