mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Use properly constructed links in the add new multi class components.
This means that the component now works with URLs which include parameters, such as when translatable is being used. Closes #30.
This commit is contained in:
parent
79e8d9a0dc
commit
9abd92bd7f
@ -153,7 +153,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
|
|||||||
|
|
||||||
$data = new ArrayData(array(
|
$data = new ArrayData(array(
|
||||||
'Title' => $this->getTitle(),
|
'Title' => $this->getTitle(),
|
||||||
'Link' => Controller::join_links($grid->Link(), 'add-multi-class'),
|
'Link' => Controller::join_links($grid->Link(), 'add-multi-class', '{class}'),
|
||||||
'ClassField' => $field
|
'ClassField' => $field
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -128,11 +128,11 @@
|
|||||||
|
|
||||||
$(".ss-gridfield-add-new-multi-class .ss-ui-button").entwine({
|
$(".ss-gridfield-add-new-multi-class .ss-ui-button").entwine({
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
var link = this.prop("href");
|
var link = this.data("href");
|
||||||
var cls = this.parents(".ss-gridfield-add-new-multi-class").find("select").val();
|
var cls = this.parents(".ss-gridfield-add-new-multi-class").find("select").val();
|
||||||
|
|
||||||
if(cls && cls.length) {
|
if(cls && cls.length) {
|
||||||
this.getGridField().showDetailView(link + "/" + cls);
|
this.getGridField().showDetailView(link.replace("{class}", cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="ss-gridfield-add-new-multi-class">
|
<div class="ss-gridfield-add-new-multi-class">
|
||||||
$ClassField.FieldHolder
|
$ClassField.FieldHolder
|
||||||
|
|
||||||
<a href="$Link" class="ss-ui-action-constructive ss-ui-button" data-icon="add">
|
<a href="#" data-href="$Link" class="ss-ui-action-constructive ss-ui-button" data-icon="add">
|
||||||
$Title
|
$Title
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user