Commit 36b712ff authored by Sven Franck's avatar Sven Franck

app: updated dynamic value setting (still can't inherit through tree)

parent 4779f26f
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
case "type": case "type":
case "rel": case "rel":
case "alt": case "alt":
case "src":
case "readonly": case "readonly":
case "size": case "size":
case "colspan": case "colspan":
...@@ -6620,7 +6621,7 @@ ...@@ -6620,7 +6621,7 @@
return RSVP.all(promise_list) return RSVP.all(promise_list)
.then(function (response_list) { .then(function (response_list) {
var j, k, res_len, response, param_len, out_param; var j, k, res_len, response, param_len, out_param, val;
// TODO: CUSTOM CODE, wrap in callback and make generic handler // TODO: CUSTOM CODE, wrap in callback and make generic handler
for (j = 0, res_len = response_list.length; j < res_len; j += 1) { for (j = 0, res_len = response_list.length; j < res_len; j += 1) {
...@@ -6628,7 +6629,9 @@ ...@@ -6628,7 +6629,9 @@
for (k = 0, param_len = param_list.length; k < param_len; k += 1) { for (k = 0, param_len = param_list.length; k < param_len; k += 1) {
out_param = param_list[k]; out_param = param_list[k];
if (response.field === out_param[1]) { if (response.field === out_param[1]) {
element.logic[out_param[0]] = response.value; val = out_param[0];
element.logic[val] = element.logic[val] || "";
element.logic[val] += response.value;
} }
} }
} }
...@@ -6645,20 +6648,22 @@ ...@@ -6645,20 +6648,22 @@
* @returns {object} kid * @returns {object} kid
*/ */
app.util.setParam = function (kid, wrapper) { app.util.setParam = function (kid, wrapper) {
var i, len, param_list, param, href, loc, sep; var i, len, param_list, param, href, loc, splitter, val;
param_list = kid.logic.setParam; param_list = kid.logic.setParam;
for (i = 0, len = param_list.length; i < len; i += 1) { for (i = 0, len = param_list.length; i < len; i += 1) {
param = param_list[i]; param = param_list[i];
switch (param[1]) { switch (param[1]) {
// NOTE: hacked for oauth redirect url TODO: remove, not generic! // NOTE: hacked for oauth redirect url
// TODO: remove, not generic!
// TODO: find way to include encoding when setting a href
case "location": case "location":
href = kid.direct.href; href = kid.direct.href;
sep = href.indexOf("?") > 0 ? "&" : "?"; splitter = href.indexOf("?") > 0 ? "&" : "?";
loc = window.location; loc = window.location;
kid.direct.href += sep + window.encodeURIComponent(param[0]) + "=" + kid.direct.href += splitter + window.encodeURIComponent(param[0]) +
window.encodeURIComponent( "=" + window.encodeURIComponent(
loc.origin + loc.pathname + loc.hash.split("?")[0] loc.origin + loc.pathname + loc.hash.split("?")[0]
); );
break; break;
...@@ -6668,7 +6673,12 @@ ...@@ -6668,7 +6673,12 @@
if (param[1].split("subordinate_").length > 1) { if (param[1].split("subordinate_").length > 1) {
kid.needs_subordination = true; kid.needs_subordination = true;
} else { } else {
kid.logic[param[0]] = wrapper.property_dict.data.doc[param[1]]; val = param[0];
kid.logic[val] = kid.logic[val] || "";
kid.logic[val] += wrapper.property_dict.data.doc[param[1]];
if (val === "href") {
kid.logic[val] = window.encodeURIComponent(kid.logic[val]);
}
delete kid.logic.setParam[i]; delete kid.logic.setParam[i];
} }
} }
......
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