diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-12-01 18:02:59 -0600 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-05-04 23:57:52 +1200 |
commit | 3ccb422aeb1173eb9d1b30e9e211251cd190c166 (patch) | |
tree | 2c64d794accecaf123f260f8443b058f742c3b27 /templates | |
parent | aab0a9ad3fa8a5b1ebb38bec20cc6d2977677171 (diff) | |
download | openembedded-core-contrib-3ccb422aeb1173eb9d1b30e9e211251cd190c166.tar.gz |
rrs/recipes: Add support for persist search and filters.
Now when search something the URL is modified and you can
share the URL for access to the data.
[YOCTO #7809]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/rrs/recipes.html | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/templates/rrs/recipes.html b/templates/rrs/recipes.html index 3ec980bdf5..be2a3a5a3c 100644 --- a/templates/rrs/recipes.html +++ b/templates/rrs/recipes.html @@ -167,6 +167,16 @@ $(document).ready(function() { recipesTable = $('#recipestable') upstreamStatus = $("<div/>").html('{{ upstream_status }}').text() maintainer = $("<div/>").html('{{ maintainer_name }}').text() + search = '{{ search }}' + + function updateQueryString(queryString) { + if (window.history.pushState) { + var newurl = window.location.protocol + "//" + + window.location.host + window.location.pathname + + queryString + window.history.pushState({path:newurl}, '', newurl); + } + } function updateRecipeCount() { $('#recipestable').show() @@ -243,21 +253,38 @@ $(document).ready(function() { updateStatusSelected() updateMaintainerSelected() + + queryString = '' + if (search != '') { + $.uiTableFilter(recipesTable, search); + queryString = '?search=' + search + } else { + if (upstreamStatus != 'All' && maintainer != 'All') { + queryString = '?upstream_status=' + upstreamStatus + + '&maintainer_name=' + maintainer + } else if (upstreamStatus != 'All') { + queryString = '?upstream_status=' + upstreamStatus + } else if (maintainer != 'All') { + queryString = '?maintainer_name=' + maintainer + } + } + updateQueryString(queryString) } $("#form-search").submit(function( event ) { upstreamStatus = 'All' maintainer = 'All' - search_text = $("#filter").val() + search = $("#filter").val() $("#clear-search-btn").show() applyFilters() - $.uiTableFilter(recipesTable, search_text); updateRecipeCount() + event.preventDefault(); }); function clearSearch() { $("#filter").val('') + search = $("#filter").val() $("#clear-search-btn").hide() applyFilters() updateRecipeCount() @@ -299,6 +326,10 @@ $(document).ready(function() { }); {% endif %} + if (search != '') { + $("#filter").val(search) + $("#clear-search-btn").show() + } applyFilters() updateRecipeCount() }); |