javascript - Saving application user interface options with rails -
i'm using bit of javascript let users collapse , hide 8 different tables on main index page.
$(".priority-header").click -> //on click $(this).next().toggle() // hide table $(this).toggleclass('closed') //assign class "closed"
i able save user's configuration, when hide or show table, remains hidden or displayed next time navigate home page. best way save user configuration rails. thinking of using session variable or cookie, wasn't sure how this. doesn't have database save, , session or cookie fine.
you can use user localstorage store user preference. requieres user use modern, html5 complient, browser.
//when user click "hide" button localstorage['hidepreference'] = 'hidden'; ... //when page loads if(localstorage['hidepreference'] === 'hidden') { //hide stuff jquery }
Comments
Post a Comment