diff --git a/code/forms/BlogAdminSidebar.php b/code/forms/BlogAdminSidebar.php new file mode 100644 index 0000000..2a78db6 --- /dev/null +++ b/code/forms/BlogAdminSidebar.php @@ -0,0 +1,5 @@ +beforeUpdateCMSFields(function($fields) use ($self) { - $fields->addFieldsToTab('Root.Main', array( - HeaderField::create('Post Options', 3), + + // Add featured image + $fields->insertBefore( + $uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), + "Content" + ); + $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); + + // Now we're going to create the blog options panel. + $menuTitle = $fields->dataFieldByName('MenuTitle'); + $urlSegment = $fields->dataFieldByName('URLSegment'); + $fields->removeFieldsFromTab('Root.Main', array( + 'MenuTitle', + 'URLSegment', + )); + $options = BlogAdminSidebar::create( + $menuTitle, + $urlSegment, $publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")), ListboxField::create( "Categories", @@ -75,40 +91,13 @@ class BlogPost extends Page { _t("BlogPost.Tags", "Tags"), $self->Parent()->Tags()->map()->toArray() )->setMultiple(true) - )); + )->setTitle('Post Options'); + $fields->insertBefore($options, 'Root'); $publishDate->getDateField()->setConfig("showcalendar", true); - - // Add featured image - $fields->insertBefore( - $uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), - "Content" - ); - $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); }); $fields = parent::getCMSFields(); - // We're going to make an SEO tab and move all the usual crap there - $menuTitle = $fields->dataFieldByName('MenuTitle'); - $urlSegment = $fields->dataFieldByName('URLSegment'); - $fields->addFieldsToTab('Root.SEO', array( - $menuTitle, - $urlSegment, - )); - - $metaField = $fields->fieldByName('Root.Main.Metadata'); - if($metaField) { - $metaFields = $metaField->getChildren(); - if($metaFields->count() > 0) { - $tab = $fields->findOrMakeTab('Root.SEO'); - $tab->push(HeaderField::create('Meta', 3)); - foreach($metaFields as $field) { - $tab->push($field); - } - } - $fields->removeByName('Metadata'); - } - return $fields; } diff --git a/css/cms.css b/css/cms.css index 86d67f6..23820c0 100755 --- a/css/cms.css +++ b/css/cms.css @@ -21,3 +21,22 @@ clear: none; float: left; } + +/* line 23, ../scss/cms.scss */ +.blog-admin-sidebar { + width: 280px !important; + border-right: none; + border-left: 1px solid #C0C0C2; + height: 547px; + position: fixed; + right: 0; +} +/* line 31, ../scss/cms.scss */ +.blog-admin-sidebar ~ .ss-tabset { + width: 866px; + float: left; +} +/* line 37, ../scss/cms.scss */ +.blog-admin-sidebar.cms-content-tools .cms-panel-content { + width: auto; +} diff --git a/scss/cms.scss b/scss/cms.scss index 39e02da..f8e7f29 100755 --- a/scss/cms.scss +++ b/scss/cms.scss @@ -18,4 +18,24 @@ #FeaturedImage .middleColumn { clear: none; float: left; +} + +.blog-admin-sidebar { + width: 280px !important; + border-right: none; + border-left: 1px solid #C0C0C2; + height: 547px; + position: fixed; + right: 0; + + ~ .ss-tabset { + width: 866px; + float:left; + } + + &.cms-content-tools { + .cms-panel-content { + width: auto; + } + } } \ No newline at end of file diff --git a/templates/BlogAdminSidebar_holder.ss b/templates/BlogAdminSidebar_holder.ss new file mode 100644 index 0000000..54f2baf --- /dev/null +++ b/templates/BlogAdminSidebar_holder.ss @@ -0,0 +1,17 @@ +