Skip to content

Commit

Permalink
ENHANCEMENT: Use TreeDropdownField for page selection in section editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncle Cheese committed Aug 29, 2013
1 parent 0c4e5a8 commit 03d8d2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions code/panels/DashboardSectionEditorPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ protected function getPageTypes() {

public function getConfiguration() {
$fields = parent::getConfiguration();
$fields->push(DropdownField::create("ParentID","Section", $this->getHierarchy(0))
->addExtraClass("no-chzn")
$fields->push(TreeDropdownField::create("ParentID","Section","SiteTree")
->setFilterFunction(function($node){
return SiteTree::get()->filter("ParentID", $node->ID)->exists();
})
);
$fields->push(DropdownField::create("Subject", "Page type", $this->getPageTypes())
->addExtraClass("no-chzn")
Expand Down
10 changes: 6 additions & 4 deletions javascript/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
})
},

showConfigure: function() {
console.log("show");
showConfigure: function() {
var $t = this;
this.flip({
direction: "rl",
Expand All @@ -31,10 +30,14 @@
$(this).html("<span class='ui-button-text'>"+text+"</span>");
}
});
$t.find(".TreeDropdownField").each(function() {
while($(this).find(".treedropdownfield-title").length > 1) {
$(this).find(".treedropdownfield-title:last, .treedropdownfield-toggle-panel-link:last, .treedropdownfield-panel:last").remove()
}
})

}
});
console.log("done");
},

hideConfigure: function() {
Expand Down Expand Up @@ -420,7 +423,6 @@

$('.configure-form .dashboard-button-options-btn-group > a').entwine({
onclick: function(e) {
console.log(this.getButtonGroup().getValue());
this.closest(".dashboard-panel")
.removeClass(this.getButtonGroup().getValue())
.addClass(this.data('value'));
Expand Down

0 comments on commit 03d8d2f

Please sign in to comment.