mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Removed hardcoding of history ajax links
This commit is contained in:
parent
b924fdbde6
commit
ab9d62b53c
@ -221,6 +221,12 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
$hiddenID->setValue($id);
|
$hiddenID->setValue($id);
|
||||||
$form->unsetValidator();
|
$form->unsetValidator();
|
||||||
|
|
||||||
|
$form->addExtraClass('cms-versions-form'); // placeholder, necessary for $.metadata() to work
|
||||||
|
$form->addExtraClass(Convert::raw2json(array(
|
||||||
|
'link-tmpl-compare' => Controller::join_links($this->Link('compare'), '%s', '%s', '%s'),
|
||||||
|
'link-tmpl-show' => Controller::join_links($this->Link('show'), '%s', '%s'),
|
||||||
|
)));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,23 +54,23 @@
|
|||||||
|
|
||||||
if(!id) return false;
|
if(!id) return false;
|
||||||
|
|
||||||
var button, url, selected, to, from, compare, data;
|
var button, url, selected, to, from, compare, data, metadata;
|
||||||
|
|
||||||
|
metadata = this.metadata({type: 'class'});
|
||||||
compare = (this.find(":input[name=CompareMode]").is(":checked"));
|
compare = (this.find(":input[name=CompareMode]").is(":checked"));
|
||||||
selected = this.find("table input[type=checkbox]").filter(":checked");
|
selected = this.find("table input[type=checkbox]").filter(":checked");
|
||||||
|
|
||||||
if(compare) {
|
if(compare) {
|
||||||
if(selected.length != 2) return false;
|
if(selected.length != 2) return false;
|
||||||
|
|
||||||
to = selected.eq(0).val();
|
to = selected.eq(0).val();
|
||||||
from = selected.eq(1).val();
|
from = selected.eq(1).val();
|
||||||
button = this.find(':submit[name=action_doCompare]');
|
button = this.find(':submit[name=action_doCompare]');
|
||||||
url = 'admin/page/history/compare/'+ [id,from,to].join('/') +"/";
|
url = ss.i18n.sprintf(metadata['link-tmpl-compare'], id,from,to);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
to = selected.eq(0).val();
|
to = selected.eq(0).val();
|
||||||
button = this.find(':submit[name=action_doShowVersion]');
|
button = this.find(':submit[name=action_doShowVersion]');
|
||||||
url = 'admin/page/history/show/'+ [id,to].join('/') + "/";
|
url = ss.i18n.sprintf(metadata['link-tmpl-show'], id,to);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.History.pushState({selector: '.cms-edit-form'}, '', url);
|
window.History.pushState({selector: '.cms-edit-form'}, '', url);
|
||||||
|
Loading…
Reference in New Issue
Block a user