summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates
diff options
context:
space:
mode:
authorMarius Avram <marius.avram@intel.com>2014-08-29 15:51:01 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-05 10:14:25 +0100
commit69e5cbdac50418738d72987b6ee943933f6bfd51 (patch)
tree71a234c7d815c51730b5798f33729ed793a66d44 /bitbake/lib/toaster/toastergui/templates
parenta6f1e3172173ac0a77c27ae410a786521e6391d3 (diff)
downloadpoky-69e5cbdac50418738d72987b6ee943933f6bfd51.tar.gz
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>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basetable_bottom.html15
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basetable_top.html11
2 files changed, 21 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
index ac14363798..cbdc164273 100644
--- a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
+++ b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
@@ -26,7 +26,7 @@
26 <span class="help-inline" style="padding-top:5px;">Show rows:</span> 26 <span class="help-inline" style="padding-top:5px;">Show rows:</span>
27 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize"> 27 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
28 {% with "2 5 10 25 50 100" as list%} 28 {% with "2 5 10 25 50 100" as list%}
29 {% for i in list.split %}<option{%if i == request.GET.count %} selected{%endif%}>{{i}}</option> 29 {% for i in list.split %}<option value="{{i}}">{{i}}</option>
30 {% endfor %} 30 {% endfor %}
31 {% endwith %} 31 {% endwith %}
32 </select> 32 </select>
@@ -56,6 +56,14 @@
56 } 56 }
57 } 57 }
58 58
59 // load cookie for number of entries to be displayed on page
60 pagesize = $.cookie('count');
61 if (!pagesize)
62 pagesize = 10;
63 $('.pagesize option').prop('selected', false)
64 .filter('[value="' + pagesize + '"]')
65 .attr('selected', true);
66
59 $('.chbxtoggle').each(function () { 67 $('.chbxtoggle').each(function () {
60 showhideTableColumn($(this).attr('id'), $(this).is(':checked')) 68 showhideTableColumn($(this).attr('id'), $(this).is(':checked'))
61 }); 69 });
@@ -72,8 +80,9 @@
72 $('.progress, .lead span').tooltip({container:'table', placement:'top'}); 80 $('.progress, .lead span').tooltip({container:'table', placement:'top'});
73 81
74 $(".pagesize").change(function () { 82 $(".pagesize").change(function () {
75 console.log("page size change"); 83 reload_params({"count":$(this).val()});
76 reload_params({"count":$(this).val()}); ; 84 // save cookie with pagesize
85 $.cookie("count", $(this).val(), { path : $(location).attr('pathname') });
77 }); 86 });
78}); 87});
79</script> 88</script>
diff --git a/bitbake/lib/toaster/toastergui/templates/basetable_top.html b/bitbake/lib/toaster/toastergui/templates/basetable_top.html
index 1231e1f924..037554b627 100644
--- a/bitbake/lib/toaster/toastergui/templates/basetable_top.html
+++ b/bitbake/lib/toaster/toastergui/templates/basetable_top.html
@@ -156,6 +156,13 @@
156 showhideImmediateTableAction( clname, sh, orderkey ); 156 showhideImmediateTableAction( clname, sh, orderkey );
157 } 157 }
158 158
159 //
160 // saves a cookie with selected order field
161 //
162 function saveOrderCookie( orderfield ) {
163 $.cookie("orderby", orderfield, { path: $(location).attr('pathname') });
164 }
165
159 </script> 166 </script>
160 167
161<!-- control header --> 168<!-- control header -->
@@ -205,7 +212,7 @@
205 <span class="help-inline" style="padding-top:5px;">Show rows:</span> 212 <span class="help-inline" style="padding-top:5px;">Show rows:</span>
206 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize"> 213 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
207 {% with "2 5 10 25 50 100" as list%} 214 {% with "2 5 10 25 50 100" as list%}
208{% for i in list.split %} <option{%if i == request.GET.count %} selected{%endif%}>{{i}}</option> 215{% for i in list.split %} <option value="{{i}}">{{i}}</option>
209 {% endfor %} 216 {% endfor %}
210 {% endwith %} 217 {% endwith %}
211 </select> 218 </select>
@@ -221,7 +228,7 @@
221 <tr> 228 <tr>
222 {% for tc in tablecols %}<th class="{{tc.dclass}} {{tc.clclass}}"> 229 {% for tc in tablecols %}<th class="{{tc.dclass}} {{tc.clclass}}">
223 {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%} 230 {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%}
224 {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" >{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%} 231 {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" onclick="saveOrderCookie('{{tc.orderfield}}')">{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%}
225 {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%} 232 {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%}
226 {%if tc.filter%}<div class="btn-group pull-right"> 233 {%if tc.filter%}<div class="btn-group pull-right">
227 <a href="#filter_{{tc.filter.class}}" role="button" class="btn btn-mini {%if request.GET.filter%}{{tc.filter.options|filtered_icon:request.GET.filter}} {%endif%}" {%if request.GET.filter and tc.filter.options|filtered_tooltip:request.GET.filter %} title="<p>{{tc.filter.options|filtered_tooltip:request.GET.filter}}</p><p><a class='btn btn-small btn-primary' href=javascript:reload_params({'filter':''})>Show all {% if filter_search_display %}{{filter_search_display}}{% else %}{{objectname}}{% endif %}</a></p>" {%endif%} data-toggle="modal"> <i class="icon-filter filtered"></i> </a> 234 <a href="#filter_{{tc.filter.class}}" role="button" class="btn btn-mini {%if request.GET.filter%}{{tc.filter.options|filtered_icon:request.GET.filter}} {%endif%}" {%if request.GET.filter and tc.filter.options|filtered_tooltip:request.GET.filter %} title="<p>{{tc.filter.options|filtered_tooltip:request.GET.filter}}</p><p><a class='btn btn-small btn-primary' href=javascript:reload_params({'filter':''})>Show all {% if filter_search_display %}{{filter_search_display}}{% else %}{{objectname}}{% endif %}</a></p>" {%endif%} data-toggle="modal"> <i class="icon-filter filtered"></i> </a>