mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Make GridFieldAddNewButton Content more specific
* Alter Grid Field "Add New" Button to take the name of the table (i.e. "Add Member") * Alter table names in security section to be singular so the button text makes sense
This commit is contained in:
parent
1747298786
commit
16982ba17c
@ -68,7 +68,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||
|
||||
$memberList = GridField::create(
|
||||
'Members',
|
||||
'Member',
|
||||
false,
|
||||
DataList::create('Member'),
|
||||
$memberListConfig = GridFieldConfig_RecordEditor::create()
|
||||
@ -77,7 +77,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
|
||||
|
||||
$groupList = GridField::create(
|
||||
'Groups',
|
||||
'Group',
|
||||
false,
|
||||
DataList::create('Group'),
|
||||
GridFieldConfig_RecordEditor::create()
|
||||
@ -129,7 +129,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
// Add roles editing interface
|
||||
if(Permission::check('APPLY_ROLES')) {
|
||||
$rolesField = GridField::create('Roles',
|
||||
$rolesField = GridField::create('Role',
|
||||
false,
|
||||
DataList::create('PermissionRole'),
|
||||
GridFieldConfig_RecordEditor::create()
|
||||
|
@ -57,6 +57,8 @@ class GridField extends FormField {
|
||||
*/
|
||||
protected $columnDispatch = null;
|
||||
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* Creates a new GridField field
|
||||
*
|
||||
@ -67,6 +69,7 @@ class GridField extends FormField {
|
||||
*/
|
||||
public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) {
|
||||
parent::__construct($name, $title, null);
|
||||
$this->name = $name;
|
||||
|
||||
if($dataList) {
|
||||
$this->setList($dataList);
|
||||
@ -81,7 +84,6 @@ class GridField extends FormField {
|
||||
$this->config->addComponent(new GridState_Component());
|
||||
$this->state = new GridState($this);
|
||||
|
||||
|
||||
$this->addExtraClass('ss-gridfield');
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ class GridFieldAddNewButton implements GridField_HTMLProvider {
|
||||
public function getHTMLFragments($gridField) {
|
||||
$data = new ArrayData(array(
|
||||
'NewLink' => Controller::join_links($gridField->Link('item'), 'new'),
|
||||
'ButtonName' => _t('GridField.Add', 'Add') . ' ' . _t('GridField.' . $gridField -> name, $gridField -> name),
|
||||
));
|
||||
return array(
|
||||
$this->targetFragment => $data->renderWith('GridFieldAddNewbutton'),
|
||||
|
@ -1 +1,3 @@
|
||||
<a href="$NewLink" class="action action-detail ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add"><% _t('GridField.AddNew', 'Add New') %></a>
|
||||
<a href="$NewLink" class="action action-detail ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add">
|
||||
$ButtonName
|
||||
</a>
|
Loading…
Reference in New Issue
Block a user