Fix controller names, removed Listbox methods, namespacing bugs, template locations

This commit is contained in:
Robbie Averill 2016-12-16 17:10:38 +13:00
parent 72a9f041c2
commit 58e5ebb652
8 changed files with 27 additions and 24 deletions

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Blog\Admin; namespace SilverStripe\Blog\Admin;
use SilverStripe\Blog\Form\GridField\GridFieldAddByDBField; use SilverStripe\Blog\Forms\GridField\GridFieldAddByDBField;
use SilverStripe\Blog\Admin\GridFieldMergeAction; use SilverStripe\Blog\Admin\GridFieldMergeAction;
use SilverStripe\Blog\Model\CategorisationObject; use SilverStripe\Blog\Model\CategorisationObject;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor; use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
@ -33,13 +33,15 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
/** /**
* @var GridFieldDataColumns $columns * @var GridFieldDataColumns $columns
*/ */
$columns = $this->getComponentByType('GridFieldDataColumns'); $columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setFieldFormatting(array( $columns->setFieldFormatting(
'BlogPostsCount' => function ($value, CategorisationObject $item) { array(
return $item->BlogPosts()->Count(); 'BlogPostsCount' => function ($value, CategorisationObject $item) {
} return $item->BlogPosts()->Count();
)); }
)
);
$this->changeColumnOrder(); $this->changeColumnOrder();
} }
@ -52,7 +54,7 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
/** /**
* @var GridFieldDataColumns $columns * @var GridFieldDataColumns $columns
*/ */
$columns = $this->getComponentByType('GridFieldDataColumns'); $columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields( $columns->setDisplayFields(
array( array(

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Blog\Admin; namespace SilverStripe\Blog\Admin;
use GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
class GridFieldFormAction extends GridField_FormAction class GridFieldFormAction extends GridField_FormAction
{ {

View File

@ -2,15 +2,16 @@
namespace SilverStripe\Blog\Admin; namespace SilverStripe\Blog\Admin;
use GridField_ColumnProvider;
use GridField_ActionProvider;
use DropdownField;
use GridField;
use Controller;
use SilverStripe\Blog\Admin\GridFieldFormAction; use SilverStripe\Blog\Admin\GridFieldFormAction;
use SilverStripe\Control\Controller;
use Silverstripe\Forms\DropdownField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_ColumnProvider;
/**
* @package blog
*/
class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider
{ {
/** /**
@ -81,11 +82,11 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
public function getColumnContent($gridField, $record, $columnName) public function getColumnContent($gridField, $record, $columnName)
{ {
if ($columnName === 'MergeAction' && $record->{$this->childMethod}()->Count() > 0) { if ($columnName === 'MergeAction' && $record->{$this->childMethod}()->Count() > 0) {
$dropdown = new DropdownField('Target', 'Target', $this->records->exclude('ID', $record->ID)->map()); $dropdown = DropdownField::create('Target', 'Target', $this->records->exclude('ID', $record->ID)->map());
$dropdown->setAttribute('id', 'Target_'.$record->ID); $dropdown->setAttribute('id', 'Target_'.$record->ID);
$prefix = strtolower($this->parentMethod . '-' . $this->childMethod); $prefix = strtolower($this->parentMethod . '-' . $this->childMethod);
$action = GridFieldFormAction::create( $action = new GridFieldFormAction(
$gridField, $gridField,
'MergeAction' . $record->ID, 'MergeAction' . $record->ID,
'Move', 'Move',

View File

@ -8,7 +8,7 @@ use Page_Controller;
* @package silverstripe * @package silverstripe
* @subpackage blog * @subpackage blog
*/ */
class BlogPostController extends Page_Controller class BlogPost_Controller extends Page_Controller
{ {
} }

View File

@ -13,7 +13,7 @@ use SilverStripe\Security\Member;
* @package silverstripe * @package silverstripe
* @subpackage blog * @subpackage blog
*/ */
class BlogController extends Page_Controller class Blog_Controller extends Page_Controller
{ {
/** /**
* @var array * @var array

View File

@ -210,7 +210,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
$forTemplate->Fields->push($addAction); $forTemplate->Fields->push($addAction);
return array( return array(
$this->targetFragment => $forTemplate->renderWith('SilverStripe\\Blog\\Form\\GridField\\GridFieldAddByDBField') $this->targetFragment => $forTemplate->renderWith('SilverStripe\\Blog\\Forms\\GridField\\GridFieldAddByDBField')
); );
} }
} }

View File

@ -354,7 +354,7 @@ class Blog extends Page implements PermissionProvider
$members = $this->getCandidateUsers()->map()->toArray(); $members = $this->getCandidateUsers()->map()->toArray();
$editorField = ListboxField::create('Editors', 'Editors', $members) $editorField = ListboxField::create('Editors', 'Editors', $members)
->setMultiple(true) // ->setMultiple(true)
->setRightTitle('<a class="toggle-description">help</a>') ->setRightTitle('<a class="toggle-description">help</a>')
->setDescription(' ->setDescription('
An editor has control over specific Blogs, and all posts included within it. Short of being able to assign other editors to a blog, they are able to handle most changes to their assigned blog.<br /> An editor has control over specific Blogs, and all posts included within it. Short of being able to assign other editors to a blog, they are able to handle most changes to their assigned blog.<br />
@ -373,7 +373,7 @@ class Blog extends Page implements PermissionProvider
} }
$writerField = ListboxField::create('Writers', 'Writers', $members) $writerField = ListboxField::create('Writers', 'Writers', $members)
->setMultiple(true) // ->setMultiple(true)
->setRightTitle('<a class="toggle-description">help</a>') ->setRightTitle('<a class="toggle-description">help</a>')
->setDescription(' ->setDescription('
A writer has full control over creating, editing and publishing BlogPosts they have authored or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.<br /> A writer has full control over creating, editing and publishing BlogPosts they have authored or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.<br />
@ -389,7 +389,7 @@ class Blog extends Page implements PermissionProvider
} }
$contributorField = ListboxField::create('Contributors', 'Contributors', $members) $contributorField = ListboxField::create('Contributors', 'Contributors', $members)
->setMultiple(true) // ->setMultiple(true)
->setRightTitle('<a class="toggle-description">help</a>') ->setRightTitle('<a class="toggle-description">help</a>')
->setDescription(' ->setDescription('
Contributors have the ability to create or edit BlogPosts, but are unable to publish without authorisation of an editor. They are also unable to assign other contributing authors to any of their BlogPosts.<br /> Contributors have the ability to create or edit BlogPosts, but are unable to publish without authorisation of an editor. They are also unable to assign other contributing authors to any of their BlogPosts.<br />