Move radio fields HTML to the template

... in Server\Privileges::getChangeLoginInformationHtmlForm

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-10-05 13:48:00 -03:00
parent 441a33d1fc
commit dff5619d53
2 changed files with 27 additions and 20 deletions

View File

@ -1809,33 +1809,14 @@ class Privileges
*/
public function getChangeLoginInformationHtmlForm($username, $hostname)
{
$choices = [
'4' => __('… keep the old one.'),
'1' => __('… delete the old one from the user tables.'),
'2' => __(
'… revoke all active privileges from '
. 'the old one and delete it afterwards.'
),
'3' => __(
'… delete the old one from the user tables '
. 'and reload the privileges afterwards.'
),
];
$userGroup = $this->getUserGroupForUser($username);
$loginInformationFields = $this->getHtmlForLoginInformationFields('change', $username, $hostname);
$radioFields = Util::getRadioFields(
'mode',
$choices,
'4',
true
);
return $this->template->render('server/privileges/change_user_login_info', [
'username' => $username,
'hostname' => $hostname,
'user_group' => $userGroup,
'login_information_fields' => $loginInformationFields,
'radio_fields' => $radioFields,
]);
}

View File

@ -18,7 +18,33 @@
{% trans 'Create a new user account with the same privileges and …' %}
</legend>
{{ radio_fields|raw }}
<div class="form-group form-check">
<input class="form-check-input" type="radio" name="mode" id="mode_4" value="4" checked>
<label class="form-check-label" for="mode_4">
{% trans '… keep the old one.' %}
</label>
</div>
<div class="form-group form-check">
<input class="form-check-input" type="radio" name="mode" id="mode_1" value="1">
<label class="form-check-label" for="mode_1">
{% trans '… delete the old one from the user tables.' %}
</label>
</div>
<div class="form-group form-check">
<input class="form-check-input" type="radio" name="mode" id="mode_2" value="2">
<label class="form-check-label" for="mode_2">
{% trans '… revoke all active privileges from the old one and delete it afterwards.' %}
</label>
</div>
<div class="form-group form-check">
<input class="form-check-input" type="radio" name="mode" id="mode_3" value="3">
<label class="form-check-label" for="mode_3">
{% trans '… delete the old one from the user tables and reload the privileges afterwards.' %}
</label>
</div>
</fieldset>
</fieldset>