MINOR Removed jQuery.metadata usage in CMS, use jQuery.data() and HTML5 data attributes instead. Also fixes errors where jQuery.metadata tries to eval() HTML5 data attrs, which isn't always applicable

This commit is contained in:
Ingo Schommer 2012-02-16 18:06:48 +01:00
parent 68e9e91a78
commit 8c503069b8
2 changed files with 7 additions and 9 deletions

View File

@ -221,11 +221,10 @@ class CMSPageHistoryController extends CMSMain {
$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'),
)));
$form
->addExtraClass('cms-versions-form') // placeholder, necessary for $.metadata() to work
->setAttribute('data-link-tmpl-compare', Controller::join_links($this->Link('compare'), '%s', '%s', '%s'))
->setAttribute('data-link-tmpl-show', Controller::join_links($this->Link('show'), '%s', '%s'));
return $form;
}

View File

@ -57,9 +57,8 @@
if(!id) return false;
var button, url, selected, to, from, compare, data, metadata;
var button, url, selected, to, from, compare, data;
metadata = this.metadata({type: 'class'});
compare = (this.find(":input[name=CompareMode]").is(":checked"));
selected = this.find("table input[type=checkbox]").filter(":checked");
@ -69,12 +68,12 @@
to = selected.eq(0).val();
from = selected.eq(1).val();
button = this.find(':submit[name=action_doCompare]');
url = ss.i18n.sprintf(metadata['link-tmpl-compare'], id,from,to);
url = ss.i18n.sprintf(this.data('linkTmplCompare'), id,from,to);
}
else {
to = selected.eq(0).val();
button = this.find(':submit[name=action_doShowVersion]');
url = ss.i18n.sprintf(metadata['link-tmpl-show'], id,to);
url = ss.i18n.sprintf(this.data('linkTmplShow'), id,to);
}
$('.cms-container').loadPanel(url, '', {selector: '.cms-edit-form'});