-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: NEW Add Title, Last Edited and Last Editor as default columns in all CMS reports #2234
WIP: NEW Add Title, Last Edited and Last Editor as default columns in all CMS reports #2234
Conversation
Nice one :) I think the column headers might make more sense if it was either:
With my preference being 1, and a shorter date format for smaller screens if it isn't a huge effort e.g. 2 August 2018, 11.06pm |
], | ||
'AuthorID' => [ | ||
'title' => _t(__CLASS__ . '.LastEditor', 'Last Editor'), | ||
'formatting' => function ($value, SiteTree $item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you added this as a getter to SiteTree
, would that make it exportable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it would, but it's also couple it a bit more to versioned. I'm sure I can customise the export fields with callbacks, I just haven't looked at it enough yet 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly idea. If you add this method to SiteTree, you can just replace the AuthorID
col with LastEditor.Title
. This fixed the CSV issue. Or we could add it to Versioned
.
/**
* @return Member|null
*/
public function LastEditor()
{
$latestVersion = Versioned::get_latest_version(SiteTree::class, $this->ID);
if (!$latestVersion) {
return null;
}
/** @var Member $member */
return Member::get()->byID($latestVersion->AuthorID);
}
/** @var Member $member */ | ||
$member = Member::get()->byID($latestVersion->AuthorID); | ||
if ($member) { | ||
return sprintf('%s %s', $member->FirstName, $member->Surname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return sprintf('%s %s', $member->FirstName, $member->Surname); | |
return $member->Title; |
I realise versioned is a dependency of the CMS and will always be, but it'd still be nice if I could achieve this without adding coupling to this module - will look at this again on hackday |
Another idea for an additional column would be the 'stage' of the page, ie |
I'm probably not going to get this finished, so closing, but I'll leave the branch around if anyone wants to use it later |
Adds more default columns to all CMS reports.
The "Last Editor" column isn't able to be exported to CSV though, which should probably block this being merged. This is because there's no dot notation link available to get from the page to the Member who saved the latest version of it.
Resolves silverstripe/silverstripe-reports#108