From 80fe9c886445b3e18335c891d6570e7b9500c7f6 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 28 Feb 2012 15:05:30 +1300 Subject: [PATCH 1/4] MINOR: SSF-106 Include cms gridfield javascript hooks --- code/controllers/AssetAdmin.php | 1 + code/controllers/CMSMain.php | 1 + 2 files changed, 2 insertions(+) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index cb4a845e..895639b2 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -57,6 +57,7 @@ class AssetAdmin extends LeftAndMain { if(!file_exists(ASSETS_PATH)) Filesystem::makeFolder(ASSETS_PATH); Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js"); + Requirements::javascript(CMS_DIR . '/javascript/CMSMain.GridField.js'); Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true); Requirements::css(CMS_DIR . "/css/screen.css"); diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 1384c32c..e87ebdfa 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -67,6 +67,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', + CMS_DIR . '/javascript/CMSMain.GridField.js', CMS_DIR . '/javascript/CMSPageHistoryController.js', // CMS_DIR . '/javascript/CMSPagesController.Tree.js', CMS_DIR . '/javascript/SilverStripeNavigator.js' From a317b66a8a730d680f707eca947565a997746c3c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 28 Feb 2012 16:56:21 +0100 Subject: [PATCH 2/4] MINOR Merge errors --- javascript/AssetAdmin.js | 5 ++++- javascript/CMSMain.GridField.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 3154af8f..27258c79 100644 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -31,7 +31,10 @@ $('#Form_EditForm_File .ss-gridfield-item').entwine({ onclick: function(e) { // Let actions do their own thing - if($(e.target).is('.action')) return; + if($(e.target).is('.action')) { + this._super(); + return; + } var grid = this.closest('.ss-gridfield'); if(this.data('class') == 'Folder') { diff --git a/javascript/CMSMain.GridField.js b/javascript/CMSMain.GridField.js index e320d4b9..359fa91e 100644 --- a/javascript/CMSMain.GridField.js +++ b/javascript/CMSMain.GridField.js @@ -1,5 +1,5 @@ jQuery(function($){ - $('fieldset.ss-gridfield').entwine({ + $('.ss-gridfield').entwine({ onopennewview: function(e, url) { $('.cms-container').entwine('ss').loadPanel(url); return false; From f78ab9097a3e93f1d413a20aff5f046e3b26cc98 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 28 Feb 2012 18:49:31 +0100 Subject: [PATCH 3/4] MINOR Reinstated getting current record ID from session in AssetAdmin in order to allow routing to GridFieldPopupForms detail views (admin/assets/show/99 vs admin/assets/EditForm/field/...) --- code/controllers/AssetAdmin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 895639b2..aafb23a1 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -38,10 +38,12 @@ class AssetAdmin extends LeftAndMain { * Return fake-ID "root" if no ID is found (needed to upload files into the root-folder) */ public function currentPageID() { - if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID'])) { - return $_REQUEST['ID']; + if($this->request->requestVar('ID')) { + return $this->request->requestVar('ID'); } elseif (is_numeric($this->urlParams['ID'])) { return $this->urlParams['ID']; + } elseif(Session::get("{$this->class}.currentPage")) { + return Session::get("{$this->class}.currentPage"); } else { return "root"; } From e96d6f5bd52ab45fcfdc959e11e7d55b43f302a6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 28 Feb 2012 20:11:07 +0100 Subject: [PATCH 4/4] MINOR Linking breadcrumbs to root node via AssetAdmin->Breadcrumbs() --- code/controllers/AssetAdmin.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index aafb23a1..243de432 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -476,6 +476,18 @@ JS return array_diff($allThumbnails, $usedThumbnails); } + + /** + * @return ArrayList + */ + public function Breadcrumbs($unlinked = false) { + $items = parent::Breadcrumbs($unlinked); + + // The root element should explicitly point to the root node + $items[0]->Link = Controller::join_links($this->Link('show'), 'root'); + + return $items; + } } /**