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:
Andrew Short 2013-10-09 20:34:12 +11:00
parent 79e8d9a0dc
commit 9abd92bd7f
3 changed files with 4 additions and 4 deletions

View File

@ -153,7 +153,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
$data = new ArrayData(array(
'Title' => $this->getTitle(),
'Link' => Controller::join_links($grid->Link(), 'add-multi-class'),
'Link' => Controller::join_links($grid->Link(), 'add-multi-class', '{class}'),
'ClassField' => $field
));

View File

@ -128,11 +128,11 @@
$(".ss-gridfield-add-new-multi-class .ss-ui-button").entwine({
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();
if(cls && cls.length) {
this.getGridField().showDetailView(link + "/" + cls);
this.getGridField().showDetailView(link.replace("{class}", cls));
}
return false;

View File

@ -1,7 +1,7 @@
<div class="ss-gridfield-add-new-multi-class">
$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
</a>
</div>