FIX Add 'add document set' button and update label for Page

This commit is contained in:
Sacha Judd 2017-06-02 11:36:27 +12:00
parent 886fd217f2
commit cbd3a65fa9
4 changed files with 4 additions and 11 deletions

View File

@ -43,8 +43,6 @@ class DMSDocumentAdmin extends ModelAdmin
$gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
$gridFieldConfig->addComponent(new DMSGridFieldAddNewButton('buttons-before-left'), 'GridFieldExportButton');
} elseif ($this->modelClass === 'DMSDocumentSet') {
$gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
$dataColumns = $gridFieldConfig->getComponentByType('GridFieldDataColumns');
$fields = $dataColumns->getDisplayFields($gridField);
$fields = array('Title' => 'Title', 'Page.Title' => 'Page') + $fields;

View File

@ -117,6 +117,9 @@ class DMSDocumentSet extends DataObject
$gridFieldConfig->addComponent($sortableComponent);
}
$field = $fields->fieldByName('Root.Main.PageID');
$field->setTitle(_t('DMSDocumentSet.SHOWONPAGE', 'Show on page'));
$gridFieldConfig->getComponentByType('GridFieldDataColumns')
->setDisplayFields($self->getDocumentDisplayFields())
->setFieldCasting(array('LastEdited' => 'Datetime->Ago'))

View File

@ -26,6 +26,7 @@ en:
ADDDOCUMENTSBUTTON: Add Documents
GRIDFIELD_NOTICE: Managing documents will be available once you have created this document set.
PLURALNAME: Document Sets
SHOWONPAGE: Show on page
SINGULARNAME: Document Set
DMSDocumentTaxonomyExtension:
TAGS: Tags

View File

@ -47,15 +47,6 @@ class DMSDocumentAdminTest extends FunctionalTest
$this->assertEquals(200, $this->get('admin/documents')->getStatusCode());
}
/**
* Check that the document sets GridField has had its "add new" button removed
*/
public function testDocumentSetsGridFieldHasNoAddButton()
{
$result = (string) $this->get('admin/documents/DMSDocumentSet')->getBody();
$this->assertNotContains('Add Document Set', $result);
}
/**
* Check that the document sets GridField has a data column for the parent page title. Here we check for the
* Page title existing in the DOM, since "Page" is guaranteed to exist somewhere else.