CC-4744: Edit user form needs styling

-done
This commit is contained in:
denise 2012-12-17 14:12:27 -05:00
parent a2d0f98a62
commit bd18039785
6 changed files with 152 additions and 15 deletions

View File

@ -40,14 +40,12 @@ class Application_Form_AddUser extends Zend_Form
$firstName->setLabel(_('Firstname:'));
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->addValidator($notEmptyValidator);
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
$lastName->setLabel(_('Lastname:'));
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->addValidator($notEmptyValidator);
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');

View File

@ -15,10 +15,9 @@ class Application_Form_EditUser extends Zend_Form
$userData = Application_Model_User::GetUserData($currentUser->getId());
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
/*
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/edit-user.phtml'))));
*/
$this->setAttrib('id', 'current-user-form');
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
@ -33,8 +32,7 @@ class Application_Form_EditUser extends Zend_Form
$login->setRequired(true);
$login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
//$login->setDecorators(array('viewHelper'));
//$login->addValidator('UserNameValidate');
$login->setDecorators(array('viewHelper'));
$this->addElement($login);
$password = new Zend_Form_Element_Password('cu_password');
@ -43,22 +41,23 @@ class Application_Form_EditUser extends Zend_Form
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator($notEmptyValidator);
$password->setDecorators(array('viewHelper'));
$this->addElement($password);
$firstName = new Zend_Form_Element_Text('cu_first_name');
$firstName->setLabel(_('Firstname:'));
$firstName->setLabel(_('First name:'));
$firstName->setValue($userData["first_name"]);
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->addValidator($notEmptyValidator);
$firstName->setDecorators(array('viewHelper'));
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('cu_last_name');
$lastName->setLabel(_('Lastname:'));
$lastName->setLabel(_('Last name:'));
$lastName->setValue($userData["last_name"]);
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->addValidator($notEmptyValidator);
$lastName->setDecorators(array('viewHelper'));
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('cu_email');
@ -69,6 +68,7 @@ class Application_Form_EditUser extends Zend_Form
$email->setRequired(true);
$email->addValidator($notEmptyValidator);
$email->addValidator($emailValidator);
$email->setDecorators(array('viewHelper'));
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cu_cell_phone');
@ -76,6 +76,7 @@ class Application_Form_EditUser extends Zend_Form
$cellPhone->setValue($userData["cell_phone"]);
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$cellPhone->setDecorators(array('viewHelper'));
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('cu_skype');
@ -83,6 +84,7 @@ class Application_Form_EditUser extends Zend_Form
$skype->setValue($userData["skype_contact"]);
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$skype->setDecorators(array('viewHelper'));
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('cu_jabber');
@ -91,13 +93,17 @@ class Application_Form_EditUser extends Zend_Form
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator($emailValidator);
$jabber->setDecorators(array('viewHelper'));
$this->addElement($jabber);
/*
$saveBtn = new Zend_Form_Element_Button('cu_save_user');
$saveBtn->setAttrib('class', 'btn btn-small right-floated');
$saveBtn->setIgnore(true);
$saveBtn->setLabel(_('Save'));
$saveBtn->setDecorators(array('viewHelper'));
$this->addElement($saveBtn);
*/
}
public function validateLogin($p_login, $p_userId) {

View File

@ -0,0 +1,120 @@
<div id="current-user-container">
<form id="current-user-form" class="edit-user-global" enctype="application/x-www-form-urlencoded">
<dl class="zend_form">
<?php echo $this->element->getElement('cu_user_id') ?>
<dt id="cu-username-label">
<label><?php echo $this->element->getElement('cu_login')->getLabel() ?>
</label>
</dt>
<dd id="cu-username-element">
<?php echo $this->element->getElement('cu_login') ?>
<?php if($this->element->getElement('cu_login')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_login')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-password-label">
<label><?php echo $this->element->getElement('cu_password')->getLabel() ?>
</label>
</dt>
<dd id="cu-password-element">
<?php echo $this->element->getElement('cu_password') ?>
<?php if($this->element->getElement('cu_password')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_password')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-firstname-label">
<label><?php echo $this->element->getElement('cu_first_name')->getLabel() ?>
</label>
</dt>
<dd id="cu-firstname-element">
<?php echo $this->element->getElement('cu_first_name') ?>
<?php if($this->element->getElement('cu_first_name')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_first_name')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-lastname-label">
<label><?php echo $this->element->getElement('cu_last_name')->getLabel() ?>
</label>
</dt>
<dd id="cu-lastname-element">
<?php echo $this->element->getElement('cu_last_name') ?>
<?php if($this->element->getElement('cu_last_name')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_last_name')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-email-label">
<label><?php echo $this->element->getElement('cu_email')->getLabel() ?>
</label>
</dt>
<dd id="cu-email-element">
<?php echo $this->element->getElement('cu_email') ?>
<?php if($this->element->getElement('cu_email')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-cell_phone-label">
<label><?php echo $this->element->getElement('cu_cell_phone')->getLabel() ?>
</label>
</dt>
<dd id="cu-cell_phone-element">
<?php echo $this->element->getElement('cu_cell_phone') ?>
<?php if($this->element->getElement('cu_cell_phone')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_cell_phone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-skype-label">
<label><?php echo $this->element->getElement('cu_skype')->getLabel() ?>
</label>
</dt>
<dd id="cu-skype-element">
<?php echo $this->element->getElement('cu_skype') ?>
<?php if($this->element->getElement('cu_skype')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_skype')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="cu-jabber-label">
<label><?php echo $this->element->getElement('cu_jabber')->getLabel() ?>
</label>
</dt>
<dd id="cu-jabber-element">
<?php echo $this->element->getElement('cu_jabber') ?>
<?php if($this->element->getElement('cu_jabber')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('cu_jabber')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<button id="cu_save_user" type="button" class="btn btn-small right-floated">Save</button>
</dl>
</form>
</div>

View File

@ -1,5 +1,3 @@
<?php echo $this->successMessage ?>
<div id="current-user-container">
<?php echo $this->form?>
</div>

View File

@ -2939,3 +2939,19 @@ dd .stream-status {
top: 0px;
left: 0px;
}
.edit-user-global dt {
width: 90px;
float: left;
margin-top: 4px;
margin-left: 2px;
}
.edit-user-global dd {
width: 230px;
padding-bottom: 5px;
}
.edit-user-global input {
width: 170px;
}

View File

@ -467,7 +467,6 @@ $(document).ready(function() {
$('#current-user').bind('mouseover', function() {
$.ajax({
url: baseUrl+'/user/edit-user/format/json',
dataType: 'json',
success: function(json) {
$('#current-user').tipsy({
gravity: 'n',
@ -497,9 +496,9 @@ $(document).ready(function() {
var data = $('#current-user-form').serialize();
$.post(baseUrl+'/user/edit-user', {format: 'json', data: data}, function(data) {
var json = $.parseJSON(data);
$('#current-user-container').empty().append(json.html);
$('.tipsy-inner').empty().append(json.html);
setCurrentUserPseudoPassword();
setTimeout(removeSuccessMsg, 5000);
});
})
});
});