1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +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', 'jquery',
'underscore', 'underscore',
'backbone', 'backbone',
'common' 'common',
], function($, _, Backbone, Common) { 'js.cookie'
], function($, _, Backbone, Common, Cookie) {
'use strict'; 'use strict';
var sideNavView = Backbone.View.extend({ var sideNavView = Backbone.View.extend({
@@ -23,6 +24,11 @@ define([
}; };
this.render(); this.render();
this.$el.show(); this.$el.show();
this.group_expand = false; // the initial value is false
if (Cookie.get('group_expand') == 'true') {
this.toggleGroupList();
}
}, },
render: function() { render: function() {
@@ -35,9 +41,16 @@ define([
'click #enable-mods': 'enableMods' 'click #enable-mods': 'enableMods'
}, },
toggleGroupList: function () { toggleGroupList: function() {
$('#group-nav .toggle-icon').toggleClass('icon-caret-left icon-caret-down'); $('#group-nav .toggle-icon').toggleClass('icon-caret-left icon-caret-down');
$('#group-nav .grp-list').slideToggle(); $('#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; return false;
}, },