Skip to content

Commit

Permalink
Merge pull request #2647 from chillu/pulls/2644-myprofile-layout
Browse files Browse the repository at this point in the history
admin/myprofile layout after validation (fixes #2644)
  • Loading branch information
halkyon committed Nov 7, 2013
2 parents 62bb6f1 + 8286ba3 commit 4867334
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
13 changes: 1 addition & 12 deletions admin/code/CMSProfileController.php
Expand Up @@ -14,15 +14,6 @@ class CMSProfileController extends LeftAndMain {

private static $tree_class = 'Member';

public function getResponseNegotiator() {
$neg = parent::getResponseNegotiator();
$controller = $this;
$neg->setCallback('CurrentForm', function() use(&$controller) {
return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
});
return $neg;
}

public function getEditForm($id = null, $fields = null) {
$this->setCurrentPageID(Member::currentUserID());

Expand All @@ -42,8 +33,6 @@ public function getEditForm($id = null, $fields = null) {
);

$form->Actions()->removeByName('action_delete');
$form->setTemplate('Form');
$form->setAttribute('data-pjax-fragment', null);

if($member = Member::currentUser()) {
$form->setValidator($member->getValidator());
Expand All @@ -55,7 +44,7 @@ public function getEditForm($id = null, $fields = null) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
}

$form->addExtraClass('member-profile-form root-form cms-edit-form cms-panel-padded center');
$form->addExtraClass('member-profile-form root-form cms-edit-form center');

return $form;
}
Expand Down
8 changes: 2 additions & 6 deletions admin/templates/CMSProfileController_Content.ss
@@ -1,4 +1,4 @@
<div id="settings-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content CurrentForm">
<div id="settings-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">

<div class="cms-content-header north">
<% with $EditForm %>
Expand All @@ -21,10 +21,6 @@
<% end_with %>
</div>

<div class="cms-content-fields center ui-widget-content" data-layout-type="border">

$EditForm

</div>
$EditForm

</div>
28 changes: 28 additions & 0 deletions admin/templates/Includes/CMSProfileController_EditForm.ss
@@ -0,0 +1,28 @@
<form $FormAttributes data-layout-type="border">

<div class="cms-content-fields center">
<% if $Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
<% else %>
<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
<% end_if %>

<fieldset>
<% if $Legend %><legend>$Legend</legend><% end_if %>
<% loop $Fields %>
$FieldHolder
<% end_loop %>
<div class="clear"><!-- --></div>
</fieldset>
</div>

<div class="cms-content-actions cms-content-controls south">
<% if $Actions %>
<div class="Actions">
<% loop $Actions %>
$Field
<% end_loop %>
</div>
<% end_if %>
</div>
</form>

0 comments on commit 4867334

Please sign in to comment.