Skip to content
Browse files

MINOR Changed TreeDropdownField markup from <div href="..."> to <div …

…data-url-tree="..."> in order to support other URLs (e.g. reordering) - important for the main CMS tree
  • Loading branch information...
1 parent bde24b3 commit 0b40bda1cc43cdd153d2c19949da321301391ace @chillu chillu committed
View
2 forms/TreeDropdownField.php
@@ -135,7 +135,7 @@ public function Field() {
array (
'id' => "TreeDropdownField_{$this->id()}",
'class' => 'TreeDropdownField single' . ($this->extraClass() ? " {$this->extraClass()}" : '') . ($this->showSearch ? " searchable" : ''),
- 'href' => $this->form ? $this->Link('tree') : "",
+ 'data-url-tree' => $this->form ? $this->Link('tree') : "",
'data-title' => $title,
),
$this->createTag (
View
2 forms/TreeMultiselectField.php
@@ -113,7 +113,7 @@ function Field() {
array (
'id' => "TreeDropdownField_{$this->id()}",
'class' => 'TreeDropdownField multiple' . ($this->extraClass() ? " {$this->extraClass()}" : '') . ($this->showSearch ? " searchable" : ''),
- 'href' => $this->form ? $this->Link('tree') : "",
+ 'data-url-tree' => $this->form ? $this->Link('tree') : "",
'data-title' => $title,
),
$this->createTag (
View
6 javascript/TreeDropdownField.js
@@ -61,7 +61,7 @@
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? this.getRequestParams().concat(params) : this.getRequestParams();
panel.addClass('loading');
- treeHolder.load(this.attr('href'), params, function(html, status, xhr) {
+ treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) {
var firstLoad = true;
if(status == 'success') {
$(this)
@@ -101,7 +101,7 @@
// TODO Hack to avoid ajax load on init, see http://code.google.com/p/jstree/issues/detail?id=911
'data': this.getPanel().find('.tree-holder').html(),
'ajax': {
- 'url': this.attr('href'),
+ 'url': this.data('url-tree'),
'data': function(node) {
var id = $(node).data("id") ? $(node).data("id") : 0, params = self.getRequestParams();
params = params.concat([{name: 'ID', value: id}, {name: 'ajax', value: 1}]);
@@ -197,7 +197,7 @@
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? this.getRequestParams().concat(params) : this.getRequestParams();
panel.addClass('loading');
- treeHolder.load(this.attr('href'), params, function(html, status, xhr) {
+ treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) {
var firstLoad = true;
if(status == 'success') {
$(this)
View
8 tests/javascript/TreeDropDownField/TreeDropdownField.js
@@ -45,7 +45,7 @@
beforeEach(function() {
// load fixture
$('body').append(
- '<div id="testfield" class="TreeDropdownField single" href="/myurl" data-title="Selected">' +
+ '<div id="testfield" class="TreeDropdownField single" data-url-tree="/myurl" data-title="Selected">' +
'<input type="hidden" name="testfield" value="1" />' +
'</div>'
);
@@ -110,7 +110,7 @@
beforeEach(function() {
// load fixture
$('body').append(
- '<div id="testfield" class="TreeDropdownField searchable" href="/myurl" data-title="Selected">' +
+ '<div id="testfield" class="TreeDropdownField searchable" data-url-tree="/myurl" data-title="Selected">' +
'<input type="hidden" name="testfield" value="1" />' +
'</div>'
);
@@ -142,7 +142,7 @@
beforeEach(function() {
// load fixture (check one child node, one root node)
$('body').append(
- '<div id="testfield" class="TreeDropdownField multiple" href="/myurl" data-title="Root Node 2,Root Node 3">' +
+ '<div id="testfield" class="TreeDropdownField multiple" data-url-tree="/myurl" data-title="Root Node 2,Root Node 3">' +
'<input type="hidden" name="testfield" value="4,5" />' +
'</div>'
);
@@ -216,7 +216,7 @@
// load fixture
$('body').append(
'<form id="myform" url="/myform">' +
- '<div id="testfield" class="TreeDropdownField" href="/myurl" data-title="Selected">' +
+ '<div id="testfield" class="TreeDropdownField" data-url-tree="/myurl" data-title="Selected">' +
'<input type="hidden" name="testfield" value="1" />' +
'</div>' +
'<input type="hidden" name="MyFormValue" value="foo" />' +

0 comments on commit 0b40bda

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