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

app: fixed carousel pre-enhancement

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