1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

bitbake: toaster: use cookies for count and sorting in templates tables

Until now cookies were used to save which columns were shown and which
were hidden in toaster tables. The tables from the templates also have
functionalities like sorting the entries on a certain column and
limiting the number of entries displayed on a page. The later however
were not saved using cookies. This patch brings this new feature.

The cookies are not saved only in the front-end. They are saved both
in the frontend in case the user uses the inputs/buttons to change
a parameter and also in the backend in case the user specifies manually
using GET variables the value of the parameters.

When no GET parameters are given the views will redirect the url to one
containg the parameters saved as cookies. When no cookies exist, default
values will be used.

[YOCTO #6126]

(Bitbake rev: 880b58c845e3a501fa90d24e1bd89c87ca84b709)

Signed-off-by: Marius Avram <marius.avram@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Marius Avram
2014-08-29 15:51:01 +03:00
committed by Richard Purdie
parent a6f1e31721
commit 69e5cbdac5
3 changed files with 102 additions and 46 deletions
@@ -26,7 +26,7 @@
<span class="help-inline" style="padding-top:5px;">Show rows:</span>
<select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
{% with "2 5 10 25 50 100" as list%}
{% for i in list.split %}<option{%if i == request.GET.count %} selected{%endif%}>{{i}}</option>
{% for i in list.split %}<option value="{{i}}">{{i}}</option>
{% endfor %}
{% endwith %}
</select>
@@ -56,6 +56,14 @@
}
}
// load cookie for number of entries to be displayed on page
pagesize = $.cookie('count');
if (!pagesize)
pagesize = 10;
$('.pagesize option').prop('selected', false)
.filter('[value="' + pagesize + '"]')
.attr('selected', true);
$('.chbxtoggle').each(function () {
showhideTableColumn($(this).attr('id'), $(this).is(':checked'))
});
@@ -72,8 +80,9 @@
$('.progress, .lead span').tooltip({container:'table', placement:'top'});
$(".pagesize").change(function () {
console.log("page size change");
reload_params({"count":$(this).val()}); ;
reload_params({"count":$(this).val()});
// save cookie with pagesize
$.cookie("count", $(this).val(), { path : $(location).attr('pathname') });
});
});
</script>