From 17083dc5e61efb8fa5b72e7854cb753adc2df859 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Tue, 22 Oct 2013 19:41:34 -0400 Subject: [PATCH 1/2] closes #417 --- public/src/templates.js | 30 ++++++++++++++++-------------- public/templates/topic.tpl | 17 +++++++++-------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/public/src/templates.js b/public/src/templates.js index a7e4510210..4f9055d0ad 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -172,25 +172,27 @@ template_data['relative_path'] = RELATIVE_PATH; translator.translate(templates[tpl_url].parse(template_data), function (translatedTemplate) { - document.getElementById('content').innerHTML = translatedTemplate; + + $('#content').html(translatedTemplate); jQuery('#content [template-variable]').each(function (index, element) { var value = null; - - switch (element.getAttribute('template-type')) { - case 'boolean': - value = (element.value === 'true' || element.value === '1') ? true : false; - break; - case 'int': // Intentional fall-through - case 'integer': - value = parseInt(element.value); - break; - default: - value = element.value; - break; + console.log($(element).attr('value')); + console.log($(element).attr('template-variable')); + switch ($(element).attr('template-type')) { + case 'boolean': + value = ($(element).val() === 'true' || $(element).val() === '1') ? true : false; + break; + case 'int': // Intentional fall-through + case 'integer': + value = parseInt($(element).val()); + break; + default: + value = $(element).val(); + break; } - templates.set(element.getAttribute('template-variable'), value); + templates.set($(element).attr('template-variable'), value); }); if (callback) { diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 1d9346a1ab..a929812637 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -1,3 +1,12 @@ + + + + + + + + +
- - - - - - - - From 87744302baf902aad784ff16250f0b66670dfed4 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Tue, 22 Oct 2013 19:45:06 -0400 Subject: [PATCH 2/2] fixed button tags in topic.tpl --- public/templates/topic.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index a929812637..bd26d4f271 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -206,8 +206,8 @@