Commit 264ca7e3 authored by Ivan Tyagov's avatar Ivan Tyagov

RenderJs uses now custom HTML5 element attributes which have a leading

"data-" prefix.
parent 8971cb24
...@@ -25,7 +25,7 @@ var RenderJs = (function () { ...@@ -25,7 +25,7 @@ var RenderJs = (function () {
load: function (root) { load: function (root) {
/* Load gadget layout by traversing DOM */ /* Load gadget layout by traversing DOM */
var gadget_list; var gadget_list;
gadget_list = root.find("[gadget]"); gadget_list = root.find("[data-gadget]");
// Load chilren // Load chilren
gadget_list.each(function() { gadget_list.each(function() {
RenderJs.loadGadgetFromUrl($(this)); RenderJs.loadGadgetFromUrl($(this));
...@@ -42,7 +42,7 @@ var RenderJs = (function () { ...@@ -42,7 +42,7 @@ var RenderJs = (function () {
loadGadgetFromUrl: function(gadget) { loadGadgetFromUrl: function(gadget) {
/* Load gadget's SPECs from URL */ /* Load gadget's SPECs from URL */
var url, gadget_id, gadget_property, cacheable, cache_id, app_cache, data, gadget_js; var url, gadget_id, gadget_property, cacheable, cache_id, app_cache, data, gadget_js;
url = gadget.attr("gadget"); url = gadget.attr("data-gadget");
gadget_id = gadget.attr("id"); gadget_id = gadget.attr("id");
// register gadget in javascript namespace // register gadget in javascript namespace
...@@ -50,7 +50,7 @@ var RenderJs = (function () { ...@@ -50,7 +50,7 @@ var RenderJs = (function () {
RenderJs.GadgetIndex.registerGadget(gadget_js); RenderJs.GadgetIndex.registerGadget(gadget_js);
if (url!==undefined && url!==""){ if (url!==undefined && url!==""){
gadget_property = gadget.attr("gadget:property"); gadget_property = gadget.attr("data-gadget:property");
cacheable = false; cacheable = false;
if (gadget_property!==undefined) { if (gadget_property!==undefined) {
gadget_property = $.parseJSON(gadget_property); gadget_property = $.parseJSON(gadget_property);
...@@ -152,8 +152,8 @@ var RenderJs = (function () { ...@@ -152,8 +152,8 @@ var RenderJs = (function () {
updateGadgetData: function(gadget) { updateGadgetData: function(gadget) {
/* Do real gagdet update here */ /* Do real gagdet update here */
var data_source, data_handler; var data_source, data_handler;
data_source = gadget.attr("gadget:data-source"); data_source = gadget.attr("data-gadget:data-source");
data_handler = gadget.attr("gadget:data-handler"); data_handler = gadget.attr("data-gadget:data-handler");
// acquire data and pass it to method handler // acquire data and pass it to method handler
if (data_source!==undefined){ if (data_source!==undefined){
$.ajax({url:data_source, $.ajax({url:data_source,
...@@ -306,9 +306,9 @@ var RenderJs = (function () { ...@@ -306,9 +306,9 @@ var RenderJs = (function () {
tab_container=$('#'+dom_id); tab_container=$('#'+dom_id);
tab_container.empty(); tab_container.empty();
html_string =['<div class="gadget" ', html_string =['<div class="gadget" ',
'gadget="' + gadget + '"', 'data-gadget="' + gadget + '"',
'gadget:data-handler="' + gadget_data_handler + '" ', 'data-gadget:data-handler="' + gadget_data_handler + '" ',
'gadget:data-source="' + gadget_data_source +'"></div>'].join('\n'); 'data-gadget:data-source="' + gadget_data_source +'"></div>'].join('\n');
tab_container.append(html_string); tab_container.append(html_string);
tab_gadget = tab_container.find(".gadget"); tab_gadget = tab_container.find(".gadget");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment