Remember the state of the menu, so that people are
not forced to customise the columns every
time they search.

[YOCTO #6538]

Signed-off-by: Roxana Ciobanu <[email protected]>
---
 templates/base.html           |  2 +-
 templates/search-details.html | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/templates/base.html b/templates/base.html
index 01453c7..a6f0cf0 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -60,7 +60,7 @@
                <script type = "text/javascript" src = "{% static 
"js/bootstrap.min.js" %}"></script>
                <script type = "text/javascript" src = "{% static "js/d3.v2.js" 
%}"></script>
                <script type = "text/javascript" src = "{% static "js/nv.d3.js" 
%}"></script>
-               
+           <script type = "text/javascript" src = "{% static 
"js/jquery.cookie.js" %}"></script>
                {% block content %}{% endblock %}
        </body>
 </html>
diff --git a/templates/search-details.html b/templates/search-details.html
index 269aa62..fb1f3c1 100644
--- a/templates/search-details.html
+++ b/templates/search-details.html
@@ -14,6 +14,15 @@
                        else {
                                $('.' + clname ).hide( 100 );
                        }
+                       // save cookie for all checkboxes$
+                       save = '';
+                       $( '.chbxtoggle' ).each(function( ) {
+                               if ( $( this ).attr( 'id' ) != undefined ) {
+                                       save += ';' + $( this ).attr( 'id' ) 
+':'+ $( this ).is( ':checked' )
+                               }
+                       });
+                       $.cookie( '_displaycols_{{objectname}}', save );
+                       save = '';
                }
                </script>
 
@@ -163,6 +172,25 @@
                                <script>
                                $(document).ready(function() {
                                        $('.commit > 
div').popover({placement:'left'})
+
+                                       // we load cookies for the column 
display$
+                                       save = 
$.cookie('_displaycols_{{objectname}}');
+                                       if (save != undefined) {
+                                               setting = save.split(';');
+                                               for ( i = 0; i < 
setting.length; i++) {
+                                                       if (setting[i].length > 
0) {
+                                                               splitlist = 
setting[i].split(':');
+                                                               id = 
splitlist[0], v = splitlist[1];
+                                                               if (v == 
'true') {
+                                                                       
$('.chbxtoggle#'+id).prop('checked', true);
+                                                               }
+                                                               else {
+                                                                       
$('.chbxtoggle#'+id).prop('checked', false);
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       
                                        $('.chbxtoggle').each(function () {
                                                
showhideTableColumn($(this).attr('id'), $(this).is(':checked'))
                                        });
-- 
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to