diff --git a/src/Dashboard/Changelog.php b/src/Dashboard/Changelog.php new file mode 100644 index 0000000..8eda2d6 --- /dev/null +++ b/src/Dashboard/Changelog.php @@ -0,0 +1,44 @@ +object = $object; + } + + public function CMSEditLink($version = null) + { + if(!$version) { + return $this->object->CMSEditLink(); + } + + return Controller::join_links( + $this->object->CMSEditLink(), + '/ItemEditForm/field/History/item/28/view?VersionID='.$version + ); + } + + public function Created() + { + return $this->object->dbObject('Created'); + } + + public function Versions() + { + $versions = $this->object->allVersions(); + return $this->object->allVersions(); + } + + public function render() + { + return $this->renderWith(__CLASS__); + } +} \ No newline at end of file diff --git a/src/Dashboard/Dashboard.php b/src/Dashboard/Dashboard.php new file mode 100644 index 0000000..9167708 --- /dev/null +++ b/src/Dashboard/Dashboard.php @@ -0,0 +1,57 @@ +sort('LastEdited DESC') + ->limit($limit); + } + + public function RecentPages() + { + return self::getRecentObjects(SiteTree::class); + } + + public function RecentFiles() + { + return self::getRecentObjects(File::class); + } + + public function RecentObjects() + { + $models = self::config()->get('managed_models'); + if(!count($models)){ + return null; + } + + $objects = []; + foreach ($models as $model) { + $objects[] = [ + 'Title' => singleton($model)->plural_name(), + 'Objects' => self::getRecentObjects($model), + ]; + } + + return ArrayList::create($objects); + } +} \ No newline at end of file diff --git a/templates/A2nt/CMSNiceties/Dashboard/Changelog.ss b/templates/A2nt/CMSNiceties/Dashboard/Changelog.ss new file mode 100644 index 0000000..ee78d5c --- /dev/null +++ b/templates/A2nt/CMSNiceties/Dashboard/Changelog.ss @@ -0,0 +1,31 @@ +