mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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
This commit is contained in:
parent
bde24b3415
commit
0b40bda1cc
@ -135,7 +135,7 @@ class TreeDropdownField extends FormField {
|
||||
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 (
|
||||
|
@ -113,7 +113,7 @@ class TreeMultiselectField extends TreeDropdownField {
|
||||
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 (
|
||||
|
@ -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)
|
||||
|
@ -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" />' +
|
||||
|
Loading…
x
Reference in New Issue
Block a user