Add tab for create, update and remove user

refs #5543
This commit is contained in:
Eric Lippmann 2015-10-01 09:39:21 +02:00
parent cb46af8e9c
commit 631f5d8071
4 changed files with 37 additions and 35 deletions

View File

@ -162,8 +162,7 @@ class UserController extends AuthBackendController
$form->setRepository($backend); $form->setRepository($backend);
$form->add()->handleRequest(); $form->add()->handleRequest();
$this->view->form = $form; $this->renderForm($form, $this->translate('New User'));
$this->render('form');
} }
/** /**
@ -185,8 +184,7 @@ class UserController extends AuthBackendController
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName)); $this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
} }
$this->view->form = $form; $this->renderForm($form, $this->translate('Update User'));
$this->render('form');
} }
/** /**
@ -208,8 +206,7 @@ class UserController extends AuthBackendController
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName)); $this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
} }
$this->view->form = $form; $this->renderForm($form, $this->translate('Remove User'));
$this->render('form');
} }
/** /**

View File

@ -2,5 +2,5 @@
<?= $tabs ?> <?= $tabs ?>
</div> </div>
<div class="content"> <div class="content">
<?= $form->setTitle(null) ?> <?= $form->create()->setTitle(null) // @TODO(el): create() has to be called because the UserForm is setting the title there ?>
</div> </div>

View File

@ -29,11 +29,17 @@ $extensible = $this->hasPermission('config/authentication/users/add') && $backen
$reducible = $this->hasPermission('config/authentication/users/remove') && $backend instanceof Reducible; $reducible = $this->hasPermission('config/authentication/users/remove') && $backend instanceof Reducible;
?> ?>
<?php if ($extensible): ?> <?php if ($extensible): ?>
<?= $this->qlink($this->translate('Add a new user'), 'user/add', array('backend' => $backend->getName()), array( <?= $this->qlink(
'icon' => 'plus', $this->translate('Add a New User') ,
'data-base-target' => '_next', 'user/add',
'class' => 'action-link button' array('backend' => $backend->getName()),
)) ?> array(
'class' => 'button-link',
'data-base-target' => '_next',
'icon' => 'plus',
'title' => $this->translate('Create a new user')
)
) ?>
<?php endif ?> <?php endif ?>
<table class="action-table listing-table" data-base-target="_next"> <table class="action-table listing-table" data-base-target="_next">
<thead> <thead>
@ -59,7 +65,7 @@ $reducible = $this->hasPermission('config/authentication/users/remove') && $back
) )
) ?></td> ) ?></td>
<?php if ($reducible): ?> <?php if ($reducible): ?>
<td><?= $this->qlink( <td class="icon-col"><?= $this->qlink(
null, null,
'user/remove', 'user/remove',
array( array(
@ -67,8 +73,9 @@ $reducible = $this->hasPermission('config/authentication/users/remove') && $back
'user' => $user->user_name 'user' => $user->user_name
), ),
array( array(
'title' => sprintf($this->translate('Remove user %s'), $user->user_name), 'class' => 'action-link',
'icon' => 'cancel' 'icon' => 'cancel',
'title' => sprintf($this->translate('Remove user %s'), $user->user_name)
) )
) ?></td> ) ?></td>
<?php endif ?> <?php endif ?>

View File

@ -26,8 +26,8 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $tabs; ?> <?= $tabs; ?>
<?php endif ?> <?php endif ?>
<h1><?= $this->escape($user->user_name); ?><span class="pull-right"><?= $editLink; ?></span></h1> <h2 class="clearfix"><?= $this->escape($user->user_name) ?><span class="pull-right"><?= $editLink ?></span></h2>
<table class="avp user-header"> <table class="name-value-table">
<tr> <tr>
<th><?= $this->translate('State'); ?></th> <th><?= $this->translate('State'); ?></th>
<td><?= $user->is_active === null ? '-' : ($user->is_active ? $this->translate('Active') : $this->translate('Inactive')); ?></td> <td><?= $user->is_active === null ? '-' : ($user->is_active ? $this->translate('Active') : $this->translate('Inactive')); ?></td>
@ -52,13 +52,26 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
<?php endif ?> <?php endif ?>
</div> </div>
<div class="content memberships"> <div class="content memberships">
<?php if ($showCreateMembershipLink): ?>
<?= $this->qlink(
$this->translate('Add User to Group') ,
'user/createmembership',
array('backend' => $backend->getName()),
array(
'class' => 'button-link',
'data-base-target' => '_next',
'icon' => 'plus',
'title' => $this->translate('Add user to user group')
)
) ?>
<?php endif ?>
<?php <?php
// @TODO(el): Remove that $firstRow thingy
$firstRow = true; $firstRow = true;
foreach ($memberships as $membership): ?> foreach ($memberships as $membership): ?>
<?php if ($firstRow): ?> <?php if ($firstRow): ?>
<?php $firstRow = false; ?> <?php $firstRow = false; ?>
<table data-base-target="_next" class="action membership-list alternating"> <table data-base-target="_next" class="action-table listing-table">
<thead> <thead>
<tr> <tr>
<th class="membership-group"><?= $this->translate('Group'); ?></th> <th class="membership-group"><?= $this->translate('Group'); ?></th>
@ -98,19 +111,4 @@ foreach ($memberships as $membership): ?>
<?php else: ?> <?php else: ?>
<p><?= $this->translate('No memberships found matching the filter'); ?></p> <p><?= $this->translate('No memberships found matching the filter'); ?></p>
<?php endif ?> <?php endif ?>
<?php if ($showCreateMembershipLink): ?> </div>
<?= $this->qlink(
$this->translate('Create New Membership'),
'user/createmembership',
array(
'backend' => $backend->getName(),
'user' => $user->user_name
),
array(
'icon' => 'plus',
'data-base-target' => '_next',
'class' => 'membership-create'
)
); ?>
<?php endif ?>
</div>