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 @@ +

Changelog

+
    + + <% if $Versions %> + <% loop $Versions %> +
  1. + <% if $First %> + Current Version #{$Version} {$relField('LastEdited')} + <% if $Author %> + (Author $Author.Title) + <% end_if %> + <% else %> + + Version #{$Version} + {$relField('LastEdited')} + <% if $Author %> + (Author $Author.Title) + <% end_if %> + + <% end_if %> +
  2. + <% end_loop %> + <% end_if %> + +
  3. + Created {$Created.Ago} + <% if $Author %> + (Author $Author.Title) + <% end_if %> +
  4. +
\ No newline at end of file diff --git a/templates/A2nt/CMSNiceties/Dashboard/Includes/Dashboard_Content.ss b/templates/A2nt/CMSNiceties/Dashboard/Includes/Dashboard_Content.ss new file mode 100644 index 0000000..75b6a29 --- /dev/null +++ b/templates/A2nt/CMSNiceties/Dashboard/Includes/Dashboard_Content.ss @@ -0,0 +1,48 @@ +
+ +
+
+ +
+ + <%-- div class="cms-content-header-tabs cms-tabset-nav-primary ss-ui-tabs-nav"> + +
+
+ +
+
+
+ <% include A2nt\CMSNiceties\Dashboard\Includes\RecentPages %> + <% include A2nt\CMSNiceties\Dashboard\Includes\RecentFiles %> + <% if $RecentObjects %> + <% loop $RecentObjects %> + <% include A2nt\CMSNiceties\Dashboard\Includes\RecentObjects %> + <% end_loop %> + <% end_if %> +
+
+
+ + diff --git a/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentFiles.ss b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentFiles.ss new file mode 100644 index 0000000..4b5302d --- /dev/null +++ b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentFiles.ss @@ -0,0 +1,16 @@ +<% if $RecentFiles %> +
+

+ <%t A2nt\CMSNiceties\Dashboard\Dashboard.RecentFiles 'Recent Files' %> +

+ + <% loop $RecentFiles %> +
+ + $Name + ($LastEdited.Ago) + +
+ <% end_loop %> +
+<% end_if %> \ No newline at end of file diff --git a/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentObjects.ss b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentObjects.ss new file mode 100644 index 0000000..16d5ab2 --- /dev/null +++ b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentObjects.ss @@ -0,0 +1,19 @@ +
+

+ $Title +

+ + <% loop $Objects %> +
+ <% if $CMSEditLink %> + + $Title + ($LastEdited.Ago) + + <% else %> + $Title + ($LastEdited.Ago) + <% end_if %> +
+ <% end_loop %> +
diff --git a/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentPages.ss b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentPages.ss new file mode 100644 index 0000000..d9fb62f --- /dev/null +++ b/templates/A2nt/CMSNiceties/Dashboard/Includes/RecentPages.ss @@ -0,0 +1,16 @@ +<% if $RecentPages %> +
+

+ <%t A2nt\CMSNiceties\Dashboard\Dashboard.RecentPages 'Recent Pages' %> +

+ + <% loop $RecentPages %> +
+ + $MenuTitle + ($LastEdited.Ago) + +
+ <% end_loop %> +
+<% end_if %> \ No newline at end of file