Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT SSF-124 finished ajax version of admin/pages/listchildren…

…/ID in Pages admin
  • Loading branch information...
commit 4a36b1e490428f3a5d563d144ed74bb5580e33d8 1 parent 9888f98
@normann normann authored
Showing with 25 additions and 3 deletions.
  1. +8 −3 code/controllers/CMSMain.php
  2. +17 −0 javascript/CMSMain.js
View
11 code/controllers/CMSMain.php
@@ -45,6 +45,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'batchactions',
'ListView',
'getListView',
+ 'listchildren',
);
public function init() {
@@ -561,7 +562,11 @@ public function getList(&$filterOnOff) {
}
if(count($ids)) $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
}else{
- $list->filter("ParentID", 0);
+ $parentID = 0;
+ if($this->urlParams['Action'] == 'listchildren' && $this->urlParams['ID']){
+ $parentID = $this->urlParams['ID'];
+ }
+ $list->filter("ParentID", $parentID);
}
return $list;
@@ -636,9 +641,9 @@ public function currentPageID() {
public function listchildren(){
if(Director::is_ajax()){
- return $this;
+ return $this->getListViewHTML();
}else{
-
+ return $this;
}
}
View
17 javascript/CMSMain.js
@@ -111,6 +111,23 @@
errorMessage(e);
}
});
+ },
+ replace: function(url){
+ if(window.History.enabled) {
+ var container = $('.cms-container')
+ container.loadPanel(url, '', {selector: '.cms-list'});
+ } else {
+ window.location = $.path.makeUrlAbsolute(url, $('base').attr('href'));
+ }
+ }
+ });
+
+ $('.cms-list .list-children-link').entwine({
+ onclick: function(e) {
+ this.closest('.cms-list').replace(this.attr('href'));
+ e.preventDefault();
+ return false;
+
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.