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