Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Removed hardcoding of history ajax links

  • Loading branch information...
commit ab9d62b53c92cadac613071235e020731416a35a 1 parent b924fdb
@chillu chillu authored
View
6 code/controllers/CMSPageHistoryController.php
@@ -221,6 +221,12 @@ function VersionsForm() {
$hiddenID->setValue($id);
$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;
}
View
8 javascript/CMSPageHistoryController.js
@@ -54,23 +54,23 @@
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"));
selected = this.find("table input[type=checkbox]").filter(":checked");
-
if(compare) {
if(selected.length != 2) return false;
to = selected.eq(0).val();
from = selected.eq(1).val();
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 {
to = selected.eq(0).val();
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);
Please sign in to comment.
Something went wrong with that request. Please try again.