Permalink
Browse files

Fixed new layout for edit and create user

  • Loading branch information...
1 parent 49dc21e commit 48e0366fa5b957616290704c267ab1493e66a4a9 Filippo committed Jul 26, 2010
View
2 apps/fe/modules/sfGuardUser/config/generator.yml
@@ -6,4 +6,4 @@ generator:
class: sfGuardUserAdminForm
display:
"NONE": [username, password, password_again, Profile]
- "Permissions and groups": [is_active, is_super_admin, groups_list, permissions_list]
+ "Permissions and groups": [is_active, is_super_admin, is_super_admin, is_super_admin]
View
29 apps/fe/modules/sfGuardUser/templates/editSuccess.php
@@ -1,28 +1 @@
-
-<?php slot('title', __('Edit user')) ?>
-
-
-<div class="block" id="block-tables">
-
- <?php include_partial('idProject/sf_guard_create_menu', array('module_name' => 'user')); ?>
-
- <div class="content">
- <h2 class="title"><?php echo __('Edit user') ?></h2>
- <div class="inner">
- <?php echo form_tag_for($form, '@sf_guard_user', array('class' =>'form')) ?>
-
- <?php include_partial('idProject/sf_guard_form_header', array('form' => $form, 'module_name' => 'user')); ?>
-
- <table class="table">
-
- <?php include_partial('idProject/content_table', array('configuration' => $configuration, 'form' => $form)); ?>
-
- </table>
-
- <?php include_partial('idProject/sf_guard_form_footer', array('form' => $form, 'module_name' => 'user')); ?>
-
- </form>
- </div>
- </div>
-</div>
-
+<?php require_once 'newSuccess.php'; ?>
View
46 apps/fe/modules/sfGuardUser/templates/indexSuccess.php
@@ -1,13 +1,5 @@
<?php slot('title', __('Manage users')) ?>
-<?php include_partial('idProject/sf_guard_filters', array(
- 'form' => $filters,
- 'configuration' => $configuration,
- 'module_name' => 'user',
- 'fields' => array('username',
- 'groups_list'),
- )); ?>
-
<div class="span-23" id="content">
<div class="span-full last project-navigation">
<ul>
@@ -17,10 +9,33 @@
</ul>
</div>
+ <div id="block-filters" class="span-full">
+ <h2 class="title"><?php echo __('User filters') ?></h2>
+ <?php if ($filters->hasGlobalErrors()): ?>
+ <div class="error">
+ <?php echo $filters->renderGlobalErrors() ?>
+ </div>
+ <?php endif; ?>
+ <form action="<?php echo url_for('sf_guard_user_collection', array('action' => 'filter')) ?>" method="post">
+ <div class="span-10">
+ <?php echo $filters['username']->renderError() ?>
+ <?php echo $filters['username']->renderLabel() ?> :
+ <?php echo $filters['username'] ?>
+ </div>
+ <div class="span-10 last prepend-2">
+ <?php echo $filters->renderHiddenFields() ?>
+ <input type="submit" value="<?php echo __('Filter') ?>" class="button" />
+ <?php echo link_to(__('Reset'), 'sf_guard_user_collection', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post')) ?>
+ </div>
+ <div class="clear"></div>
+ </form>
+ </div>
+
<div class="span-full">
<div class="title">
<span>Users</span>
<a id="add-user"class="button block-green medium-round" href="<?php echo url_for('@sf_guard_user_new') ?>">Add</a>
+ <a class="button block-orange medium-round" href="#" id="filters">Filters</a>
</div>
<div class="menu">
<div class="span-5"><?php echo link_to(__('Username'), 'sfGuardUser/index?sort=s.username&sort_type='.('s.username' == $sort[0] && $sort[1] == 'asc' ? 'desc' : 'asc')) ?></div>
@@ -29,7 +44,7 @@
<div class="span-6 right last append-1">E-mail</div>
</div>
- <ul class="action">
+ <ul class="action time">
<?php if ($pager->getNbResults() > 0): ?>
<?php foreach ($pager->getResults() as $user): ?>
<li class="icon-group">
@@ -65,4 +80,15 @@
<?php endif; ?>
</div>
-</div>
+</div>
+
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#block-filters').hide();
+ $('#filters').toggle(function() {
+ $('#block-filters').show();
+ }, function() {
+ $('#block-filters').hide();
+ });
+ });
+</script>
View
119 apps/fe/modules/sfGuardUser/templates/newSuccess.php
@@ -1,25 +1,104 @@
-<?php slot('title', __('Create a new user')) ?>
+<?php slot('title', __('Edit user')) ?>
-<div class="block" id="block-tables">
-
- <?php include_partial('idProject/sf_guard_create_menu', array('module_name' => 'user')); ?>
-
- <div class="content">
- <h2 class="title"><?php echo __('New user creation') ?></h2>
- <div class="inner">
- <?php echo form_tag_for($form, '@sf_guard_user', array('class' =>'form')) ?>
-
- <?php include_partial('idProject/sf_guard_form_header', array('form' => $form, 'module_name' => 'user')); ?>
-
- <table class="table">
-
- <?php include_partial('idProject/content_table', array('configuration' => $configuration, 'form' => $form)); ?>
+<div class="span-23" id="content">
+ <div class="span-full last project-navigation">
+ <ul>
+ <li><?php echo link_to('Users', '@sf_guard_user'); ?></li>
+ <li><?php echo link_to('Groups', '@sf_guard_group'); ?></li>
+ <li><?php echo link_to('Permissions', '@sf_guard_permission'); ?></li>
+ </ul>
+ </div>
- </table>
+ <div class="span-full">
+ <div class="title"><?php echo __('New user') ?></div>
+ <?php echo form_tag_for($form, '@sf_guard_user', array('class' =>'form')) ?>
+ <?php if ($sf_user->hasFlash('notice')): ?>
+ <div class="notice">
+ <?php echo __($sf_user->getFlash('notice')) ?></p>
+ </div>
+ <?php endif; ?>
+ <?php if ($sf_user->hasFlash('error')): ?>
+ <div class="message error">
+ <?php echo __($sf_user->getFlash('error')) ?>
+ </div>
+ <?php endif; ?>
+ <?php if ($form->hasGlobalErrors()): ?>
+ <div class="message error">
+ <?php echo $form->renderGlobalErrors() ?>
+ </div>
+ <?php endif; ?>
- <?php include_partial('idProject/sf_guard_form_footer', array('form' => $form, 'module_name' => 'user')); ?>
-
- </form>
- </div>
+ <div class="span-10">
+ <?php echo $form['Profile']['first_name']->renderLabel() ?>
+ <?php echo $form['Profile']['first_name']->renderError() ?>
+ <?php echo $form['Profile']['first_name']->render() ?>
+ </div>
+ <div class="span-3">
+ &nbsp;
+ </div>
+ <div class="span-10 last">
+ <?php echo $form['password']->renderLabel() ?>
+ <?php echo $form['password']->renderError() ?>
+ <br/><?php echo $form['password']->render() ?>
+ </div>
+ <div class="clear"></div>
+ <div class="span-10">
+ <?php echo $form['Profile']['last_name']->renderLabel() ?>
+ <?php echo $form['Profile']['last_name']->renderError() ?>
+ <?php echo $form['Profile']['last_name']->render() ?>
+ </div>
+ <div class="span-3">
+ &nbsp;
+ </div>
+ <div class="span-10 last">
+ <?php echo $form['password_again']->renderLabel() ?>
+ <?php echo $form['password_again']->renderError() ?>
+ <br/><?php echo $form['password_again']->render() ?>
+ </div>
+ <div class="clear"></div>
+ <div class="span-10">
+ <?php echo $form['username']->renderLabel() ?>
+ <?php echo $form['username']->renderError() ?>
+ <?php echo $form['username']->render() ?>
+ </div>
+ <div class="span-3">
+ &nbsp;
+ </div>
+ <div class="span-10 last">
+ <?php echo $form['Profile']['email']->renderLabel() ?>
+ <?php echo $form['Profile']['email']->renderError() ?>
+ <?php echo $form['Profile']['email']->render() ?>
+ </div>
+ <div class="clear"></div>
+ <div class="span-10">
+ <?php echo $form['is_active']->render() ?>
+ <?php echo $form['is_active']->renderLabel() ?>
+ <?php echo $form['is_active']->renderError() ?>
+ </div>
+ <div class="span-3">
+ &nbsp;
+ </div>
+ <div class="span-10">
+ &nbsp;
+ </div>
+ <div class="clear"></div>
+ <div class="span-10">
+ <?php echo $form['is_super_admin']->render() ?>
+ <?php echo $form['is_super_admin']->renderLabel() ?>
+ <?php echo $form['is_super_admin']->renderError() ?>
+ </div>
+ <div class="span-3">
+ &nbsp;
+ </div>
+ <div class="span-10">
+ &nbsp;
+ </div>
+ <div class="clear"></div>
+ <div class="span-7">
+ <?php echo input_tag('Submit', __('Save'), array('class' => 'button', 'type' => 'submit'))?>
+ <?php echo link_to(__('Cancel'), 'sf_guard_user'); ?>
+ </div>
+ <?php echo $form->renderHiddenFields() ?>
+ </form>
</div>
</div>
View
BIN data/phpcollab_unit_test.db
Binary file not shown.
View
49 test/functional/fe/idProjectUserCreateTest.php
@@ -39,33 +39,34 @@
checkElement('input[type="text"][id="sf_guard_user_Profile_email"]')->
checkElement('input[type="checkbox"][id="sf_guard_user_is_active"]')->
checkElement('input[type="checkbox"][id="sf_guard_user_is_super_admin"]')->
- checkElement('select[id="sf_guard_user_groups_list"]')->
- checkElement('select[id="sf_guard_user_permissions_list"]')->
- end();
-
-$browser->click('Save', array('sf_guard_user' => array(
- 'username' => 'brigido',
- 'password' => 'brigido',
- 'password_again' => 'brigido',
- 'Profile' => array(
- 'first_name' => 'Flavio',
- 'last_name' => 'Brigidini',
- 'email' => 'brigidini@examople.com',
-
- ),
- 'is_active' => 'on',
- 'groups_list' => array('2'),
- 'permissions_list' => array('2')
- )
- )
- , array('method' => 'post'))->
-
-
+ checkElement('select[id="sf_guard_user_groups_list"]', false)->
+ checkElement('select[id="sf_guard_user_permissions_list"]', false)->
+ end()->
+
+ setField('sf_guard_user[username]', 'brigdo')->
+ setField('sf_guard_user[password]', 'brigdo')->
+ setField('sf_guard_user[password_again]', 'brigdo')->
+ setField('sf_guard_user[Profile][first_name]', 'blablu')->
+ setField('sf_guard_user[Profile][last_name]', 'bubbo')->
+ setField('sf_guard_user[Profile][email]', 'bri@example.com')->
+ setField('sf_guard_user[is_active]', 'on')->
+ click('Save')->
+ with('form')->begin()->
+ hasErrors(false)->
+ end()->
+ with('request')->begin()->
+ isParameter('module', 'sfGuardUser')->
+ isParameter('action', 'create')->
+ end()->
followRedirect()->
with('request')->begin()->
isParameter('module', 'sfGuardUser')->
isParameter('action', 'edit')->
+ isParameter('id', '9')->
end()->
-
- responseContains('The item was created successfully.');
+ click('Users')->
+ click('Last')->
+ with('response')->begin()->
+ checkElement('ul li:contains("brigdo")')->
+ end();
View
33 test/functional/fe/idProjectUserEditTest.php
@@ -23,22 +23,15 @@
isParameter('action', 'edit')->
end()->
- click('Save modification', array('sf_guard_user' => array(
- 'username' => 'nopuser',
- 'password' => 'mario',
- 'password_again' => 'mario',
- 'Profile' => array(
- 'first_name' => 'mario',
- 'last_name' => 'mariotti',
- 'email' => 'mariotti@examople.com',
- ),
- 'is_active' => 'on',
- 'groups_list' => array('2'),
- 'permissions_list' => array('2')
- )
- )
- , array('method' => 'post'))->
-
+ setField('sf_guard_user[username]', 'nopuser')->
+ setField('sf_guard_user[password]', 'mario')->
+ setField('sf_guard_user[password_again]', 'mario')->
+ setField('sf_guard_user[Profile][first_name]', 'mario')->
+ setField('sf_guard_user[Profile][last_name]', 'mariotti')->
+ setField('sf_guard_user[Profile][email]', 'mariotti@example.com')->
+ setField('sf_guard_user[is_active]', 'on')->
+ click('Save')->
+
with('form')->begin()->
hasErrors(false)->
end()->
@@ -49,7 +42,11 @@
isParameter('module', 'sfGuardUser')->
isParameter('action', 'edit')->
end()->
-
- responseContains('The item was updated successfully.')
+ click('Users')->
+ with('response')->begin()->
+ checkElement('ul li:contains("mariotti@example.com")')->
+ checkElement('ul li:contains("mariotti")')->
+ checkElement('ul li:contains("mario")')->
+ end();
;

0 comments on commit 48e0366

Please sign in to comment.