Skip to content
This repository
Browse code

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

…/ID in Pages admin
  • Loading branch information...
commit 4a36b1e490428f3a5d563d144ed74bb5580e33d8 1 parent 9888f98
Normann Lou authored April 10, 2012
11  code/controllers/CMSMain.php
@@ -45,6 +45,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
45 45
 		'batchactions',
46 46
 		'ListView',
47 47
 		'getListView',
  48
+		'listchildren',
48 49
 	);
49 50
 	
50 51
 	public function init() {
@@ -561,7 +562,11 @@ public function getList(&$filterOnOff) {
561 562
 			}
562 563
 			if(count($ids)) $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
563 564
 		}else{
564  
-			$list->filter("ParentID", 0);
  565
+			$parentID = 0;
  566
+			if($this->urlParams['Action'] == 'listchildren' && $this->urlParams['ID']){
  567
+				$parentID = $this->urlParams['ID'];
  568
+			}
  569
+			$list->filter("ParentID", $parentID);
565 570
 		}
566 571
 
567 572
 		return $list;
@@ -636,9 +641,9 @@ public function currentPageID() {
636 641
 	
637 642
 	public function listchildren(){
638 643
 		if(Director::is_ajax()){
639  
-			return $this;
  644
+			return $this->getListViewHTML();
640 645
 		}else{
641  
-			
  646
+			return $this;
642 647
 		}
643 648
 	}
644 649
 
17  javascript/CMSMain.js
@@ -111,6 +111,23 @@
111 111
 						errorMessage(e);
112 112
 					}
113 113
 				});
  114
+			},
  115
+			replace: function(url){
  116
+				if(window.History.enabled) {
  117
+					var container = $('.cms-container')
  118
+					container.loadPanel(url, '', {selector: '.cms-list'});
  119
+				} else {
  120
+					window.location = $.path.makeUrlAbsolute(url, $('base').attr('href'));
  121
+				}
  122
+			}
  123
+		});
  124
+		
  125
+		$('.cms-list .list-children-link').entwine({
  126
+			onclick: function(e) {
  127
+				this.closest('.cms-list').replace(this.attr('href'));
  128
+				e.preventDefault();
  129
+				return false;
  130
+
114 131
 			}
115 132
 		});
116 133
 	

0 notes on commit 4a36b1e

Please sign in to comment.
Something went wrong with that request. Please try again.