diff --git a/.gitignore b/.gitignore index 9ba470db..5cd3d290 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.sass-cache \ No newline at end of file +.sass-cache +.DS_Store \ No newline at end of file diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 95dabd2c..9cac6493 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -1042,14 +1042,22 @@ JS; ); $pageTypes[$type->getField('ClassName')] = $html; } - + + $labelTriangle = ''; $fields = new FieldSet( // new HiddenField("ParentID", false, ($this->parentRecord) ? $this->parentRecord->ID : null), // TODO Should be part of the form attribute, but not possible in current form API $hintsField = new LiteralField('Hints', sprintf('', $this->SiteTreeHints())), - $parentField = new TreeDropdownField("ParentID", _t('CMSMain.AddFormParentLabel', 'Parent page'), 'SiteTree'), - new OptionsetField("PageType", "", $pageTypes, 'Page') + $label1 = new LabelField("1", _t('CMSMain.1', '1').$labelTriangle), + $parentField = new TreeDropdownField("ParentID", _t('CMSMain.AddFormParentLabel', 'Choose parent'), 'SiteTree'), + $label2 = new LabelField("1", _t('CMSMain.2', '2').$labelTriangle), + new OptionsetField("PageType", _t('CMSMain.ChoosePageType', 'Choose page type'), $pageTypes, 'Page') ); + $label1->addExtraClass("numeric-label"); + $label1->setAllowHTML(true); + $label2->addExtraClass("numeric-label"); + $label2->setAllowHTML(true); + $parentField->setValue(($record) ? $record->ID : null); $actions = new FieldSet( diff --git a/css/CMSMain.css b/css/CMSMain.css index cf6b0185..a2063bfb 100644 --- a/css/CMSMain.css +++ b/css/CMSMain.css @@ -1,5 +1,8 @@ /** Style custom to the CMSMain admin interface. CMSMain extends the built in sapphire admin section styles. As much as possible we want to use those built in styles. If anything in this file can be implemented in a generic way then it should be include in the admin scss files. @package cms */ /** ------------------------------------------------------------------ Page History Section. ----------------------------------------------------------------- */ +/* line 15, ../scss/CMSMain.scss */ #cms-page-history-versions tr.loading { color: #999; } +/* line 20, ../scss/CMSMain.scss */ #cms-page-history-versions tr.loading td:hover { cursor: none; } +/* line 27, ../scss/CMSMain.scss */ #cms-page-history-versions td:hover { cursor: pointer; } diff --git a/javascript/CMSMain.EditForm.js b/javascript/CMSMain.EditForm.js index 85b9305a..2aa16f92 100644 --- a/javascript/CMSMain.EditForm.js +++ b/javascript/CMSMain.EditForm.js @@ -243,5 +243,32 @@ return confirm(message); } }); + + /** + * Class: .cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked + * + * Showing the "Page location" "Parent page" chooser only when the "Sub-page underneath a parent page" + * radio button is selected + */ + $('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({ + + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ + onchange: function(e) { + var parentTreeDropDown = $('.cms-edit-form.CMSPageSettingsController #ParentID'); + + if (e.target.id == 'Form_EditForm_ParentType_root') parentTreeDropDown.slideUp(); + else parentTreeDropDown.slideDown(); + } + }); + + //trigger an initial change event to do the initial hiding of the element, if necessary + if ($('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr('id') == 'Form_EditForm_ParentType_root') { + $('.cms-edit-form.CMSPageSettingsController #ParentID').hide(); //quick hide on first run + } }); }(jQuery)); \ No newline at end of file diff --git a/scss/CMSMain.scss b/scss/CMSMain.scss index 3402d063..2fa3e906 100644 --- a/scss/CMSMain.scss +++ b/scss/CMSMain.scss @@ -28,4 +28,5 @@ cursor: pointer; } } -} \ No newline at end of file +} + diff --git a/templates/Includes/CMSPagesController_Content.ss b/templates/Includes/CMSPagesController_Content.ss index 5c2c6a39..81cae01b 100644 --- a/templates/Includes/CMSPagesController_Content.ss +++ b/templates/Includes/CMSPagesController_Content.ss @@ -41,7 +41,7 @@ $SiteTreeAsUL -
+
$AddForm