Commit a3968df2 authored by Sven Franck's avatar Sven Franck

app: allow passing class_list and position on dynamic controlgroups

parent 0ec7b1bf
......@@ -1011,6 +1011,7 @@
element.text = element.center[0].title;
element.text_i18n = element.center[0].title_i18n;
}
// TODO: also no!
element.iconpos = "right";
return {
"type": "item",
......@@ -1885,6 +1886,7 @@
if (static_item || divider) {
target = document.createDocumentFragment();
} else {
// TODO: wtf is this for?
element.is_main = true;
target = factory.util.generateContentElement(
"link",
......@@ -2500,6 +2502,7 @@
// main link, split button
// TODO: make icon generic! what about util.class_string
// TODO: why using is_main????
case "link":
is_main = !!spec.is_main;
no_icon = config.icon === null;
......@@ -2507,11 +2510,12 @@
"type": "a",
"direct": {
"href": spec.href || "#",
"className": "ui-btn " + " ui-btn-" +
"className": spec.class_list + " ui-btn " + " ui-btn-" +
(config.split_theme || config.theme || "inherit") +
(no_icon ? " " : (is_main ? " ui-btn-icon-right " :
" ui-btn-icon-" + (spec.iconpos || "notext")) +
" ui-icon-" + (config.icon || spec.icon || "carat-r"))
" ui-icon-" + (config.icon || spec.icon ||
(is_main === false ? "carat-d" : "carat-r")))
},
"attributes": {
"title": spec.title || "",
......@@ -3510,7 +3514,7 @@
/* Mapper list item */
/* ********************************************************************** */
/**
* Map records to factory widget listview and carousel
* Map records to factory widget listview, carousel and controlgroup
* @method listItem
* @param {object} spec Object containing element, parent and counter
* @return {object} mapped object
......@@ -3521,7 +3525,8 @@
// NOTE: make sure there is no "id" flying through here!!! only _id
map.listItem = function (spec) {
var quirk_dict, section, label, j, k, field, setter, record, new_item,
id, key, translation_fields, item, relation, promise_list, pass, count;
id, key, translation_fields, item, relation, promise_list, pass, count,
class_string;
promise_list = [];
translation_fields = "titletextlabel";
......@@ -3556,6 +3561,15 @@
new_item.id = id;
}
// first/last
// TODO: don't do this here and elsewhere and elsewhere...
if (spec.count === 0) {
class_string = " ui-first-child ";
}
if (spec.count === spec.wrapper.property_dict.length - 1) {
class_string = " ui-last-child ";
}
// loop scheme sections
for (j = 0; j < item.scheme.length; j += 1) {
section = item.scheme[j];
......@@ -3596,6 +3610,7 @@
pos = response.position;
obj = {};
new_item[pos] = new_item[pos] || [];
new_item.class_list = class_string || "";
// text/label/... all stuff translateable
if (response.text_element) {
......
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