mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Add sidebar back as a separate tab. Fix tag and category routes
This commit is contained in:
parent
c1cb8576b3
commit
077929f8bf
@ -64,7 +64,7 @@ class BlogCategory extends DataObject implements CategorisationObject
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ trait BlogObject
|
||||
);
|
||||
|
||||
if ($this->ID) {
|
||||
$duplicates->exclude('ID', $this->ID);
|
||||
$duplicates = $duplicates->exclude('ID', $this->ID);
|
||||
}
|
||||
|
||||
return $duplicates;
|
||||
|
@ -272,11 +272,6 @@ class BlogPost extends Page
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Fix the sidebar styles for SS4 + Bootstrap
|
||||
*/
|
||||
return;
|
||||
|
||||
// Get categories and tags
|
||||
$parent = $this->Parent();
|
||||
$categories = $parent instanceof Blog
|
||||
@ -286,32 +281,36 @@ class BlogPost extends Page
|
||||
? $parent->Tags()
|
||||
: BlogTag::get();
|
||||
|
||||
$options = BlogAdminSidebar::create(
|
||||
$publishDate,
|
||||
$urlSegment,
|
||||
TagField::create(
|
||||
'Categories',
|
||||
_t('BlogPost.Categories', 'Categories'),
|
||||
$categories,
|
||||
$this->Categories()
|
||||
)
|
||||
->setCanCreate($this->canCreateCategories())
|
||||
->setShouldLazyLoad(true),
|
||||
TagField::create(
|
||||
'Tags',
|
||||
_t('BlogPost.Tags', 'Tags'),
|
||||
$tags,
|
||||
$this->Tags()
|
||||
)
|
||||
->setCanCreate($this->canCreateTags())
|
||||
->setShouldLazyLoad(true),
|
||||
$authorField,
|
||||
$authorNames
|
||||
)->setTitle('Post Options');
|
||||
|
||||
$options->setName('blog-admin-sidebar');
|
||||
|
||||
$fields->insertBefore($options, 'Root');
|
||||
// @todo: Reimplement the sidebar
|
||||
// $options = BlogAdminSidebar::create(
|
||||
$fields->addFieldsToTab(
|
||||
'Root.PostOptions',
|
||||
[
|
||||
$publishDate,
|
||||
$urlSegment,
|
||||
TagField::create(
|
||||
'Categories',
|
||||
_t('BlogPost.Categories', 'Categories'),
|
||||
$categories,
|
||||
$this->Categories()
|
||||
)
|
||||
->setCanCreate($this->canCreateCategories())
|
||||
->setShouldLazyLoad(true),
|
||||
TagField::create(
|
||||
'Tags',
|
||||
_t('BlogPost.Tags', 'Tags'),
|
||||
$tags,
|
||||
$this->Tags()
|
||||
)
|
||||
->setCanCreate($this->canCreateTags())
|
||||
->setShouldLazyLoad(true),
|
||||
$authorField,
|
||||
$authorNames
|
||||
]
|
||||
);
|
||||
// )->setTitle('Post Options');
|
||||
// $options->setName('blog-admin-sidebar');
|
||||
// $fields->insertBefore($options, 'Root');
|
||||
});
|
||||
|
||||
$fields = parent::getCMSFields();
|
||||
|
@ -64,7 +64,7 @@ class BlogTag extends DataObject implements CategorisationObject
|
||||
*/
|
||||
protected function getListUrlSegment()
|
||||
{
|
||||
return 'tags';
|
||||
return 'tag';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user