Commit 1b56020c authored by Sven Franck's avatar Sven Franck

app: fixed carousel pre-enhancement

parent f1887d4f
......@@ -325,8 +325,8 @@
container_class_list = "ui-" + spec.attributes.type;
label_inside = true;
push_label = (has_opts && has_opts.length > 0);
label_class_list = "ui-btn ui-corner-all ui-btn-inherit" +
" ui-icon-radio-off" /* + active */ + " ui-radio-" +
label_class_list = "ui-btn ui-corner-all ui-btn-inherit " +
" ui-icon-" + (icon || "radio-off") + " ui-radio-" +
active + index + disabled + readonly +
(no_text ? " ui-btn-icon-" + no_text : "");
spec.attributes["data-cacheval"] = true;
......@@ -1595,7 +1595,7 @@
* "class_list": null,
* "handles": null,
* "bullets": true,
* "bulletspos": "bottom"
* "bulletspos": "bottom"
* "inset": null,
* "shadow": null,
* "corners": null,
......@@ -1622,7 +1622,7 @@
**/
factory.widget.carousel = function (spec) {
var fragment, generator, empty_string, has_handles, make_handle, is_thumb,
controller, i, id, radio_id;
controller, i, id, radio_id, len;
// makes carousel elements
generator = function (spec) {
......@@ -1677,6 +1677,7 @@
empty_string = "";
has_handles = spec.handles;
is_thumb = spec.thumbnails;
id = spec.controller_id || spec.id || util.uuid();
// list container - we spare declaring data-attributes
fragment.appendChild(factory.element({
......@@ -1694,6 +1695,7 @@
},
"attributes": {
"data-enhanced": true,
"data-barrel": "ui-carousel-barrel-" + id,
"data-role": "carousel",
"tabindex": -1
},
......@@ -1710,7 +1712,6 @@
// bullets
if (!is_thumb) {
id = spec.controller_id || spec.id || util.uuid();
controller = factory.element({
"type": "div",
"direct": {
......@@ -1722,7 +1723,9 @@
"logic": {}
});
for (i = 0; i < spec.length; i += 1) {
len = spec.total_rows || spec.length;
for (i = 0; i < len; i += 1) {
radio_id = "radio-" + id;
controller.appendChild(factory.widget.formElement({
"type": "input",
......@@ -1734,6 +1737,7 @@
},
"attributes": {
"type": "radio",
"data-icon": "circle",
"data-iconpos": "notext"
},
"logic": {"value": i}
......@@ -4119,7 +4123,7 @@
/**
* Build a query object based on passed configuration
* @method parseQuery
* @param {object} query
* @param {object} query
* @param {string} type Portal Type to fetch
* @param {string} key Parameter to search single column
* @param {string} value Value to search for across one or all columns
......@@ -5666,11 +5670,6 @@
app.content.set = function (content_dict, url_dict, create, purge) {
var pass;
if (!content_dict) {
util.loader("", "status_dict.parse_error", "ban-circle");
return app.util.error("content.set: Parse Error");
}
// pack
pass = {
"content_dict": content_dict || {},
......@@ -5987,12 +5986,12 @@
* @param {object} Pass through object and reply (queried records)
* @return {object} response object/promise
**/
// TODO: refactor... this is appocalyptic
// TODO: refactor... appocalyptic
app.content.make = function (reply) {
var pass, method, type, kids, promise_list, route,
search, search_id, kid, is_html, is_dynamic, is_id, i, j, last,
encoded, wrapper, active, selector, update_target, target,
grant_child, quirk_dict, generator, pointer_results;
grant_child, quirk_dict, generator, pointer_results, data_total_rows;
pass = reply.pass;
pass.config_dict = pass.config_dict || {};
......@@ -6000,6 +5999,12 @@
method = factory.widget[type] || undefined;
promise_list = [];
// set results, here, so dynamic kids are correct!
if (pass.grant && reply.response) {
pointer_results = util.parse(reply.response);
data_total_rows = pointer_results.data.total_rows;
}
// kids (must be declared before wrapper, because some wrapper need length
if (pass.content_dict.view_dict) {
kids = pass.content_dict.view_dict[pass.url_dict.mode || "default"];
......@@ -6009,13 +6014,14 @@
// ============= TODO: improve property_dict generation ==============
// TODO: no all elements need them?
// TODO:
// wrapper object and properties
quirk_dict = util.mergeObject(
(pass[method ? "content_dict" : "config_dict"].property_dict),
{
"create": pass.create,
"update": pass.create === false ? true : null,
"total_rows": data_total_rows,
"length": kids.length,
"layout_level": pass.url_dict.layout_level,
"fragment_list": pass.url_dict.fragment_list,
......@@ -6085,11 +6091,6 @@
// dynamic content
// TODO: 10 if-else...
if (!pass.skip) {
// set results
if (pass.grant && reply.response) {
pointer_results = util.parse(reply.response);
}
// set empty "record" to allow generation of empty form
if (pass.url_dict.mode === "new") {
pointer_results = {"data": {"total_rows": 1, "rows": [{"doc": {}}]}};
......@@ -6103,7 +6104,6 @@
if (pointer_results.data.total_rows === 0) {
quirk_dict.no_show = quirk_dict.no_items || {};
}
// set up fragment and child_selector
if (quirk_dict.update !== true) {
// set reference for children in need
......@@ -6173,7 +6173,6 @@
quirk_dict.length = kids.length;
is_id = (quirk_dict.data || {})._id || quirk_dict.item_identifier;
// TODO: MAKE OPTIONAL UTIL-ajax-for-each... ask Tristan
for (i = 0; i < kids.length; i += 1) {
kid = kids[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