Commit 4ad1a770 authored by Sven Franck's avatar Sven Franck

data/app: integrate query parameters in link generation and link categories

parent 10a2afd1
......@@ -22,8 +22,8 @@
"initial_query": {"query": "reference: 'product_group'", "include_docs": true, "select_list": ["title", "title_i18n", "_id"]},
"property_dict": {
"link": true,
"link_identifier": "title",
"link_core": "product_module::group="
"link_identifier": "_id",
"link_core": "product_module&query:group="
},
"scheme": [
{
......
......@@ -7149,17 +7149,20 @@
* @return {string} href
*/
app.util.generateLink = function (spec, id) {
var level, core, separator, empty_string;
var level, core, separator, empty_string, is_core, has_query, has_depth;
empty_string = "";
is_core = spec.link_core || empty_string;
has_query = is_core.split("query:").length > 1;
has_depth = is_core.split("%26").length > 1;
// external link
if (spec.source) {
return spec.source;
}
// link current segment parameter vs segment
if ((spec.link_core || empty_string).split("%26").length > 1) {
// TODO: not robust
if (has_query || has_depth) {
separator = empty_string;
} else {
separator = "/";
......@@ -7169,7 +7172,7 @@
core = spec.link_core || (spec.fragment_list ?
spec.fragment_list.slice(0, level + 1).join("/") : empty_string);
return ("#" + core + separator + window.encodeURIComponent(id));
return ("#" + window.encodeURIComponent(core + separator + id));
};
/**
......
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