ENHANCEMENT SSF-124 finished ajax version of admin/pages/listchildren/ID in Pages admin

This commit is contained in:
Normann Lou 2012-04-10 14:14:42 +12:00
parent 9888f980aa
commit 4a36b1e490
2 changed files with 25 additions and 3 deletions

View File

@ -45,6 +45,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'batchactions',
'ListView',
'getListView',
'listchildren',
);
public function init() {
@ -561,7 +562,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
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 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function listchildren(){
if(Director::is_ajax()){
return $this;
return $this->getListViewHTML();
}else{
return $this;
}
}

View File

@ -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;
}
});