Skip to content

Commit ac07152

Browse files
committed
Keep record of unwinded containers on page refresh
The solution retains a record of the currently un-collapsed container and unwinds it on a page refresh. No extra refresh button and no live-update. The minor inconvenience of this solution is that on a page refresh the unwind animation plays. Helps #568 Signed-off-by: Julien Midedji <[email protected]>
1 parent 7ec1131 commit ac07152

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

resources/static/functions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,21 @@ $(function () {
119119
.removeClass('glyphicon-collapse-down')
120120
.addClass('glyphicon-collapse-up');
121121
event.stopPropagation();
122+
123+
localStorage.setItem("coll_" + this.id, true);
122124
})
123125
$('div.collapse').on('hide.bs.collapse', function (event) {
124126
$(this).prev().find('span.toggle-icon')
125127
.removeClass('glyphicon-collapse-up')
126128
.addClass('glyphicon-collapse-down');
127129
event.stopPropagation();
130+
131+
localStorage.setItem("coll_" + this.id, false);
128132
})
133+
134+
$("div.collapse").each(function() {
135+
if (localStorage.getItem("coll_" + this.id) == "true") {
136+
$(this).collapse("show");
137+
}
138+
});
129139
})

0 commit comments

Comments
 (0)