From cbc2891c80446aff99501bc20f9789faa63e111f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 21 Feb 2012 21:16:22 +0100 Subject: [PATCH] MINOR Metadata for GridField and Folder->getCMSFields() to allow opening folder references in the UI --- filesystem/Folder.php | 4 ++++ forms/gridfield/GridField.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/filesystem/Folder.php b/filesystem/Folder.php index d693c9315..479aa8928 100644 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -441,6 +441,10 @@ class Folder extends File { $gridField->setFieldFormatting(array( 'Date' => 'Nice' )); + $gridField->setAttribute( + 'data-url-folder-template', + Controller::join_links(singleton('AssetAdmin')->Link('show'), '%s') + ); $titleField = ($this->ID && $this->ID != "root") ? new TextField("Title", _t('Folder.TITLE')) : new HiddenField("Title"); diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index aa2b31dea..8ede986dd 100755 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -335,7 +335,9 @@ class GridField extends FormField { 'tr', array( "class" => 'ss-gridfield-item ' . $record->FirstLast() . " " . $record->EvenOdd(), - 'data-id' => $record->ID + 'data-id' => $record->ID, + // TODO Allow per-row customization similar to GridFieldDefaultColumns + 'data-class' => $record->ClassName, ), $rowContent );