From: Wolfram Schneider Date: Wed, 3 Jul 2013 13:56:44 +0000 (+0000) Subject: the sort and perpage menu are configurable X-Git-Tag: 0.9.1~347 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=03b61372369fe8bc8802c07871ba57908751a2a0;p=mkws-moved-to-github.git the sort and perpage menu are configurable Both are enabled by default. --- diff --git a/experiments/spclient/README b/experiments/spclient/README index 43a38da..85cd098 100644 --- a/experiments/spclient/README +++ b/experiments/spclient/README @@ -74,6 +74,8 @@ Here is an example of all possible options use_service_proxy: false, /* true, flase */ switch_menu: true, /* true, false: show/hide Records|Targets menu */ lang_menu: true, /* true, false: show/hide language menu */ + sort_menu: true, /* show/hide perpage menu */ + perpage_menu: true, /* show/hide language menu */ lang_display: ["en", "de", "da"], /* display languages links for given languages, [] for all */ facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */ diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 5a3ab0a..ca6c9ce 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -247,8 +247,10 @@ function domReady () document.mkwsSearchForm.onsubmit = onFormSubmitEventHandler; document.mkwsSearchForm.mkwsQuery.value = ''; if (document.mkwsSelect) { - document.mkwsSelect.mkwsSort.onchange = onSelectDdChange; - document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange; + if (document.mkwsSelect.mkwsSort) + document.mkwsSelect.mkwsSort.onchange = onSelectDdChange; + if (document.mkwsSelect.mkwsPerpage) + document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange; } } @@ -506,7 +508,9 @@ function mkws_html_all(config) { perpage_default: 20, query_width: 50, switch_menu: true, /* show/hide Records|Targets menu */ - lang_menu: true, /* show/hide language menu */ + lang_menu: true, /* show/hide sort menu */ + sort_menu: true, /* show/hide perpage menu */ + perpage_menu: true, /* show/hide language menu */ lang_display: [], /* display languages links for given languages, [] for all */ facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */ responsive_design_width: 980, /* a page with less pixel width considered as mobile */ @@ -574,12 +578,17 @@ function mkws_html_all(config) { } if ($("#mkwsRanking").length) { - $("#mkwsRanking").html('\ -
\ - ' + M('Sort by') + ' ' + mkws_html_sort(config) + '\ - ' + M('and show') + ' ' + mkws_html_perpage(config) + '\ - ' + M('per page') + '.\ -
'); + var ranking_data = ''; + ranking_data += '
'; + if (config.sort_menu) { + ranking_data += M('Sort by') + ' ' + mkws_html_sort(config) + ' '; + } + if (config.perpage_menu) { + ranking_data += M('and show') + ' ' + mkws_html_perpage(config) + ' ' + M('per page') + '.'; + } + ranking_data += '
'; + + $("#mkwsRanking").html(ranking_data); } mkws_html_switch(config);