1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 23:29:49 +00:00

Remember group expended status

This commit is contained in:
Daniel Pan
2016-04-23 13:56:46 +08:00
parent fb439f1aef
commit f06b03edf2

View File

@@ -2,8 +2,9 @@ define([
'jquery',
'underscore',
'backbone',
'common'
], function($, _, Backbone, Common) {
'common',
'js.cookie'
], function($, _, Backbone, Common, Cookie) {
'use strict';
var sideNavView = Backbone.View.extend({
@@ -23,6 +24,11 @@ define([
};
this.render();
this.$el.show();
this.group_expand = false; // the initial value is false
if (Cookie.get('group_expand') == 'true') {
this.toggleGroupList();
}
},
render: function() {
@@ -35,9 +41,16 @@ define([
'click #enable-mods': 'enableMods'
},
toggleGroupList: function () {
toggleGroupList: function() {
$('#group-nav .toggle-icon').toggleClass('icon-caret-left icon-caret-down');
$('#group-nav .grp-list').slideToggle();
if ($('#group-nav .toggle-icon').hasClass('icon-caret-down')) {
Cookie.set('group_expand', 'true');
this.group_expand = true;
} else {
Cookie.set('group_expand', 'false');
this.group_expand = false;
}
return false;
},