Commit 201ad90f authored by Sven Franck's avatar Sven Franck

app/data: fixed search for groups, brands and categories

parent b33b4acf
...@@ -41,20 +41,28 @@ ...@@ -41,20 +41,28 @@
"type": "input", "type": "input",
"direct": {"id":"select_brand", "className": "translate"}, "direct": {"id":"select_brand", "className": "translate"},
"attributes": {"data-enhanced":"true", "data-inset": false, "data-i18n": "[placeholder]global_dict.filter", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"}, "attributes": {"data-enhanced":"true", "data-inset": false, "data-i18n": "[placeholder]global_dict.filter", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"},
"logic":{"clear":"true", "action":"search", "add_label": false} "logic":{"clear":"true", "add_label": false}
}, {
"type": "input",
"direct": {"className": "action translate"},
"attributes": {"type": "submit", "data-column": "brand_id", "data-i18n": "[value]global_dict.search_brands", "data-action": "custom_checkbox_search"},
"logic": {"wrapper_class_list": " skim_button ui-btn-icon-right ui-icon-search "}
}, { }, {
"portal_type_source": "Portal Category", "portal_type_source": "Portal Category",
"portal_type_title": "category", "portal_type_title": "category",
"initial_query": {"query": "reference: 'sub_websection'", "include_docs": true, "select_list": ["title", "title_i18n"]}, "initial_query": {"query": "reference: 'sub_websection'", "include_docs": true, "select_list": ["_id", "title", "title_i18n"]},
"property_dict": { "property_dict": {},
"check": true
},
"scheme": [ "scheme": [
{ {
"position": "center", "position": "center",
"field_list": [ "field_list": [
{"field": "title"} {"field": "title"}
] ]
}, {
"position": "right",
"field_list": [
{"field": "_id", "setKey": "id", "type": "check"}
]
} }
], ],
"children": [{ "children": [{
...@@ -84,20 +92,28 @@ ...@@ -84,20 +92,28 @@
"type": "input", "type": "input",
"direct": {"id":"select_category", "className": "translate"}, "direct": {"id":"select_category", "className": "translate"},
"attributes": {"data-enhanced":"true", "data-inset": false, "data-i18n": "[placeholder]global_dict.filter", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"}, "attributes": {"data-enhanced":"true", "data-inset": false, "data-i18n": "[placeholder]global_dict.filter", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"},
"logic":{"clear":"true", "action":"search", "add_label": false} "logic":{"clear":"true", "add_label": false}
}, {
"type": "input",
"direct": {"className": "action translate"},
"attributes": {"type": "submit", "data-column": "category", "data-i18n": "[value]global_dict.search_categories", "data-action": "custom_checkbox_search"},
"logic": {"wrapper_class_list": " skim_button ui-btn-icon-right ui-icon-search "}
}, { }, {
"portal_type_source": "Portal Category", "portal_type_source": "Portal Category",
"portal_type_title": "category", "portal_type_title": "category",
"initial_query": {"query": "reference: 'product_category'", "include_docs": true, "select_list": ["title", "title_i18n"]}, "initial_query": {"query": "reference: 'product_category'", "include_docs": true, "select_list": ["_id", "title", "title_i18n"]},
"property_dict": { "property_dict": {},
"check": true
},
"scheme": [ "scheme": [
{ {
"position": "center", "position": "center",
"field_list": [ "field_list": [
{"field": "title"} {"field": "title"}
] ]
}, {
"position": "right",
"field_list": [
{"field": "_id", "setKey": "id", "type": "check"}
]
} }
], ],
"children": [{ "children": [{
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"children": [{ "children": [{
"type": "input", "type": "input",
"direct": {"className": "action translate"}, "direct": {"className": "action translate"},
"attributes": {"type": "submit", "data-i18n": "[value]global_dict.search_categories", "data-action": "custom_checkbox_search"}, "attributes": {"type": "submit", "data-column": "group", "data-i18n": "[value]global_dict.search_categories", "data-action": "custom_checkbox_search"},
"logic": {"wrapper_class_list": " skim_button ui-btn-icon-right ui-icon-search "} "logic": {"wrapper_class_list": " skim_button ui-btn-icon-right ui-icon-search "}
}] }]
},{ },{
......
...@@ -2985,19 +2985,25 @@ ...@@ -2985,19 +2985,25 @@
map.actions = { map.actions = {
"custom_checkbox_search": function (obj) { "custom_checkbox_search": function (obj) {
var form_check_list, i, check_len, check, value_str; var form_check_list, i, check_len, check, value_str, target;
// TODO: it should be possible to inherit results so a dynamic listview // TODO: checkbox-listview should be child of form. This requires
// could be child of a form, which is not dynamic! // inheriting dynamic data, which still does not work... !
form_check_list = obj.element.parentNode.parentNode.nextSibling.getElementsByTagName("input"); // TODO: find better way to set the key to search, if possible not
// on the checkbox unless it's easy to set and get!!!
target = obj.element.getAttribute("data-column");
// HM
form_check_list = obj.element.parentNode.parentNode.parentNode
.getElementsByTagName("ul")[0].getElementsByTagName("input");
value_str = ""; value_str = "";
for (i = 0, check_len = form_check_list.length; i < check_len; i += 1) { for (i = 0, check_len = form_check_list.length; i < check_len; i += 1) {
check = form_check_list[i]; check = form_check_list[i];
if (check.type = "checkbox" && check.checked) { if (check.type = "checkbox" && check.checked) {
value_str += "group=" + check.id.split("select_")[1] + "|"; value_str += target + "=" + check.id.split("select_")[1] + "|";
} }
} }
$.mobile.changePage( $.mobile.changePage(
"#" + window.encodeURIComponent( "#" + window.encodeURIComponent(
"product_module&query:" + value_str.slice(0,-1) "product_module&query:" + value_str.slice(0,-1)
......
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