From 614f307a37cbacdc08bc998ec5a238cc37b52b91 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 23 Apr 2012 21:02:29 +1200 Subject: [PATCH] ENHANCEMENT When loading CMS, ensure that "Parent page" tree dropdown is either hidden or shown depending on initial "Page location" state --- code/model/SiteTree.php | 2 +- javascript/CMSMain.EditForm.js | 7 +++++-- lang/en.yml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index d3c36a5c..8348a6dd 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1899,7 +1899,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $parentTypeSelector = new CompositeField( new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array( "root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), - "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"), + "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page"), )), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle') ), diff --git a/javascript/CMSMain.EditForm.js b/javascript/CMSMain.EditForm.js index 139c7a7d..2cf3097d 100644 --- a/javascript/CMSMain.EditForm.js +++ b/javascript/CMSMain.EditForm.js @@ -275,7 +275,10 @@ * radio button is selected */ $('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({ - + onmatch: function() { + this.onclick(); + this._super(); + }, /** * Function: onclick * @@ -286,7 +289,7 @@ var parentTreeDropDown = $('.cms-edit-form.CMSPageSettingsController #ParentID'); if (e.target.id == 'Form_EditForm_ParentType_root') parentTreeDropDown.slideUp(); - else parentTreeDropDown.slideDown(); + else parentTreeDropDown.slideDown(); } }); diff --git a/lang/en.yml b/lang/en.yml index b2dfe955..cd338793 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -338,7 +338,7 @@ en: PARENTID: "Parent page" PARENTTYPE: "Page location" PARENTTYPE_ROOT: "Top-level page" - PARENTTYPE_SUBPAGE: "Sub-page underneath a parent page (choose below)" + PARENTTYPE_SUBPAGE: "Sub-page underneath a parent page" PERMISSION_GRANTACCESS_DESCRIPTION: "Manage access rights for content" PERMISSION_GRANTACCESS_HELP: "Allow setting of page-specific access restrictions in the \"Pages\" section." # Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface