From 8286ba346e22ef70a3d0db80fa58b6410d7e6075 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 7 Nov 2013 16:19:40 +0100 Subject: [PATCH] admin/myprofile layout after validation (fixes #2644) Broke because the
tag was returned, while the client logic was expecting the whole
including the . Fixed to display the button bar at the bottom, and tested with validation errors as well as switching from/to the panel via ajax. --- admin/code/CMSProfileController.php | 13 +-------- .../templates/CMSProfileController_Content.ss | 8 ++---- .../Includes/CMSProfileController_EditForm.ss | 28 +++++++++++++++++++ 3 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 admin/templates/Includes/CMSProfileController_EditForm.ss diff --git a/admin/code/CMSProfileController.php b/admin/code/CMSProfileController.php index 6b03f105e..035bbc93b 100644 --- a/admin/code/CMSProfileController.php +++ b/admin/code/CMSProfileController.php @@ -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()); @@ -42,8 +33,6 @@ class CMSProfileController extends LeftAndMain { ); $form->Actions()->removeByName('action_delete'); - $form->setTemplate('Form'); - $form->setAttribute('data-pjax-fragment', null); if($member = Member::currentUser()) { $form->setValidator($member->getValidator()); @@ -55,7 +44,7 @@ class CMSProfileController extends LeftAndMain { $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; } diff --git a/admin/templates/CMSProfileController_Content.ss b/admin/templates/CMSProfileController_Content.ss index d7675888e..61be8d660 100644 --- a/admin/templates/CMSProfileController_Content.ss +++ b/admin/templates/CMSProfileController_Content.ss @@ -1,4 +1,4 @@ -
+
<% with $EditForm %> @@ -21,10 +21,6 @@ <% end_with %>
-
- - $EditForm - -
+ $EditForm
diff --git a/admin/templates/Includes/CMSProfileController_EditForm.ss b/admin/templates/Includes/CMSProfileController_EditForm.ss new file mode 100644 index 000000000..3ffef6bee --- /dev/null +++ b/admin/templates/Includes/CMSProfileController_EditForm.ss @@ -0,0 +1,28 @@ + + +
+ <% if $Message %> +

$Message

+ <% else %> + + <% end_if %> + +
+ <% if $Legend %>$Legend<% end_if %> + <% loop $Fields %> + $FieldHolder + <% end_loop %> +
+
+
+ +
+ <% if $Actions %> +
+ <% loop $Actions %> + $Field + <% end_loop %> +
+ <% end_if %> +
+