From 880b58c845e3a501fa90d24e1bd89c87ca84b709 Mon Sep 17 00:00:00 2001 From: Marius Avram Date: Fri, 29 Aug 2014 15:51:01 +0300 Subject: 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] Signed-off-by: Marius Avram --- lib/toaster/toastergui/templates/basetable_top.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/toaster/toastergui/templates/basetable_top.html') diff --git a/lib/toaster/toastergui/templates/basetable_top.html b/lib/toaster/toastergui/templates/basetable_top.html index 1231e1f92..037554b62 100644 --- a/lib/toaster/toastergui/templates/basetable_top.html +++ b/lib/toaster/toastergui/templates/basetable_top.html @@ -156,6 +156,13 @@ showhideImmediateTableAction( clname, sh, orderkey ); } + // + // saves a cookie with selected order field + // + function saveOrderCookie( orderfield ) { + $.cookie("orderby", orderfield, { path: $(location).attr('pathname') }); + } + @@ -205,7 +212,7 @@ Show rows: @@ -221,7 +228,7 @@ {% for tc in tablecols %} {%if tc.qhelp%}{%endif%} - {%if tc.orderfield%}{{tc.name}}{%else%}{{tc.name}}{%endif%} + {%if tc.orderfield%}{{tc.name}}{%else%}{{tc.name}}{%endif%} {%if tc.ordericon%} {%endif%} {%if tc.filter%}
-- cgit 1.2.3-korg