Commit 065435e8 authored by Sven Franck's avatar Sven Franck

Fix: prevent re-loading existing gadgets on first page

parent c3b633ec
...@@ -154,7 +154,7 @@ define([ ...@@ -154,7 +154,7 @@ define([
RenderJs.bindReady(function () { RenderJs.bindReady(function () {
var gadget = RenderJs.GadgetIndex.getGadgetById(page.attr('id')); var gadget = RenderJs.GadgetIndex.getGadgetById(page.attr('id'));
if (gadget.isEnhanced() === false) { if (gadget.isEnhanced() === false) {
page.trigger("create"); // page.trigger("create");
gadget.setEnhanced(true); gadget.setEnhanced(true);
} }
}); });
...@@ -264,6 +264,12 @@ define([ ...@@ -264,6 +264,12 @@ define([
return; return;
} }
// so now we do it here...
if (gadget.isEnhanced() === false) {
gadget.dom.parent().trigger("create");
gadget.setEnhanced(true);
}
gadget_props = gadget["state"]; gadget_props = gadget["state"];
gadget_cleaned_id = gadget_id.split("__").slice(-1)[0]; gadget_cleaned_id = gadget_id.split("__").slice(-1)[0];
......
...@@ -115,13 +115,13 @@ var RenderJs = (function () { ...@@ -115,13 +115,13 @@ var RenderJs = (function () {
// async // async
if (async) { if (async) {
async(data, function(markup){ async(data, function(markup){
gadget.append(markup); gadget.empty().append(markup);
if (callback) { if (callback) {
callback(self); callback(self);
} }
}); });
} else { } else {
gadget.append(data); gadget.empty().append(data);
if (callback) { if (callback) {
callback(self); callback(self);
} }
...@@ -177,6 +177,7 @@ var RenderJs = (function () { ...@@ -177,6 +177,7 @@ var RenderJs = (function () {
gadget_js[key] = value; gadget_js[key] = value;
}); });
} }
if (url !== undefined && url !== "") { if (url !== undefined && url !== "") {
cacheable = gadget.attr("data-gadget-cacheable"); cacheable = gadget.attr("data-gadget-cacheable");
cache_id = gadget.attr("data-gadget-cache-id"); cache_id = gadget.attr("data-gadget-cache-id");
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
width: 100%; width: 100%;
overflow: hidden !important; overflow: hidden !important;
border: 1px solid #D5D5D5; border: 1px solid #D5D5D5;
background: white;
} }
.items_listview li { .items_listview li {
float: left; float: left;
......
...@@ -125,16 +125,7 @@ define([ ...@@ -125,16 +125,7 @@ define([
spec.source = source; spec.source = source;
spec.callback_mockup = callback_mockup; spec.callback_mockup = callback_mockup;
// if unbound, bind and run once, if bound, just run
if (spec.gadget.sourceSet === undefined) {
spec.gadget.sourceSet = true;
$(document).on("pagebeforeshow", spec.pageId, function (e) {
priv.generateItems(spec); priv.generateItems(spec);
});
priv.generateItems(spec);
} else {
priv.generateItems(spec);
}
}; };
that.callback = function (self) { that.callback = function (self) {
......
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