Add sidebar back as a separate tab. Fix tag and category routes

This commit is contained in:
Robbie Averill 2017-01-13 15:55:48 +13:00
parent c1cb8576b3
commit 077929f8bf
4 changed files with 33 additions and 35 deletions

View File

@ -64,7 +64,7 @@ class BlogCategory extends DataObject implements CategorisationObject
*/ */
protected function getListUrlSegment() protected function getListUrlSegment()
{ {
return 'categories'; return 'category';
} }
/** /**
@ -74,5 +74,4 @@ class BlogCategory extends DataObject implements CategorisationObject
{ {
return _t('BlogCategory.Duplicate', 'A blog category already exists with that name.'); return _t('BlogCategory.Duplicate', 'A blog category already exists with that name.');
} }
} }

View File

@ -211,7 +211,7 @@ trait BlogObject
); );
if ($this->ID) { if ($this->ID) {
$duplicates->exclude('ID', $this->ID); $duplicates = $duplicates->exclude('ID', $this->ID);
} }
return $duplicates; return $duplicates;

View File

@ -272,11 +272,6 @@ class BlogPost extends Page
); );
} }
/**
* @todo Fix the sidebar styles for SS4 + Bootstrap
*/
return;
// Get categories and tags // Get categories and tags
$parent = $this->Parent(); $parent = $this->Parent();
$categories = $parent instanceof Blog $categories = $parent instanceof Blog
@ -286,32 +281,36 @@ class BlogPost extends Page
? $parent->Tags() ? $parent->Tags()
: BlogTag::get(); : BlogTag::get();
$options = BlogAdminSidebar::create( // @todo: Reimplement the sidebar
$publishDate, // $options = BlogAdminSidebar::create(
$urlSegment, $fields->addFieldsToTab(
TagField::create( 'Root.PostOptions',
'Categories', [
_t('BlogPost.Categories', 'Categories'), $publishDate,
$categories, $urlSegment,
$this->Categories() TagField::create(
) 'Categories',
->setCanCreate($this->canCreateCategories()) _t('BlogPost.Categories', 'Categories'),
->setShouldLazyLoad(true), $categories,
TagField::create( $this->Categories()
'Tags', )
_t('BlogPost.Tags', 'Tags'), ->setCanCreate($this->canCreateCategories())
$tags, ->setShouldLazyLoad(true),
$this->Tags() TagField::create(
) 'Tags',
->setCanCreate($this->canCreateTags()) _t('BlogPost.Tags', 'Tags'),
->setShouldLazyLoad(true), $tags,
$authorField, $this->Tags()
$authorNames )
)->setTitle('Post Options'); ->setCanCreate($this->canCreateTags())
->setShouldLazyLoad(true),
$options->setName('blog-admin-sidebar'); $authorField,
$authorNames
$fields->insertBefore($options, 'Root'); ]
);
// )->setTitle('Post Options');
// $options->setName('blog-admin-sidebar');
// $fields->insertBefore($options, 'Root');
}); });
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();

View File

@ -64,7 +64,7 @@ class BlogTag extends DataObject implements CategorisationObject
*/ */
protected function getListUrlSegment() protected function getListUrlSegment()
{ {
return 'tags'; return 'tag';
} }
/** /**