tweaking templates code to accept a template-type attribute (for boolean purposes

v1.18.x
Julian Lam 12 years ago
parent d96bfee227
commit 51a941b6d5

@ -171,7 +171,18 @@
document.getElementById('content').innerHTML = templates[tpl_url].parse(JSON.parse(template_data));
jQuery('#content [template-variable]').each(function(index, element) {
templates.set(element.getAttribute('template-variable'), element.value);
var value = null;
switch(element.getAttribute('template-type')) {
case 'boolean':
value = (element.value === 'true' || element.value === '1') ? true : false;
break;
default:
value = element.value;
break;
}
templates.set(element.getAttribute('template-variable'), value);
});
if (callback) {

@ -74,6 +74,6 @@
<input type="hidden" template-variable="yourid" value="{yourid}" />
<input type="hidden" template-variable="theirid" value="{theirid}" />
<input type="hidden" template-variable="isFriend" value="{isFriend}" />
<input type="hidden" template-type="boolean" template-variable="isFriend" value="{isFriend}" />
<script type="text/javascript" src="/src/forum/account.js"></script>
Loading…
Cancel
Save