From a18b3297bfad8247f848673de6a80a198d055d12 Mon Sep 17 00:00:00 2001 From: llj Date: Sat, 11 Apr 2015 18:03:43 +0800 Subject: [PATCH] [side nav] modified for myhome & org --- seahub/templates/libraries.html | 31 +++++++++++++++--------- static/scripts/app/views/myhome.js | 16 +++++++----- static/scripts/app/views/organization.js | 5 +++- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/seahub/templates/libraries.html b/seahub/templates/libraries.html index 93d98e4ccf..b6f725c9d7 100644 --- a/seahub/templates/libraries.html +++ b/seahub/templates/libraries.html @@ -23,7 +23,7 @@ {% endblock %} {% block left_panel %} -
+

{% trans "Personal" %}

{% if user.permissions.can_add_repo %} @@ -32,28 +32,37 @@

{% trans "Share Admin" %}

+
+ + {% endblock %} diff --git a/static/scripts/app/views/myhome.js b/static/scripts/app/views/myhome.js index bc88362b11..8e1c2fd6b2 100644 --- a/static/scripts/app/views/myhome.js +++ b/static/scripts/app/views/myhome.js @@ -16,13 +16,10 @@ define([ el: '#main', initialize: function() { - - - //_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide'); - //this.$el.ajaxStart(this.ajaxLoadingShow).ajaxStop(this.ajaxLoadingHide); - this.$cont = this.$('#right-panel'); + this.$sideNav = $('#myhome-side-nav'); + this.reposView = new ReposView(); this.subReposView = new SubReposView(); this.sharedReposView = new SharedReposView(); @@ -32,6 +29,9 @@ define([ $('#initial-loading-view').hide(); }, + showSideNav: function () { + this.$sideNav.show(); + }, ajaxLoadingShow: function() { Common.feedback('Loading...', 'info', Common.INFO_TIMEOUT); @@ -50,24 +50,28 @@ define([ }, showMyRepos: function() { + this.showSideNav(); this.currentView.hide(); this.reposView.show(); this.currentView = this.reposView; }, showMySubRepos: function() { + this.showSideNav(); this.currentView.hide(); this.subReposView.show(); this.currentView = this.subReposView; }, showSharedRepos: function() { + this.showSideNav(); this.currentView.hide(); this.sharedReposView.show(); this.currentView = this.sharedReposView; }, showDir: function(category, repo_id, path) { + this.showSideNav(); var path = path || '/'; this.currentView.hide(); this.dirView.showDir(category, repo_id, path); @@ -76,9 +80,9 @@ define([ hide: function() { this.currentView.hide(); + this.$sideNav.hide(); } - }); return MyHomeView; diff --git a/static/scripts/app/views/organization.js b/static/scripts/app/views/organization.js index f19ecadba7..f2a4450dc7 100644 --- a/static/scripts/app/views/organization.js +++ b/static/scripts/app/views/organization.js @@ -16,6 +16,7 @@ define([ initialize: function() { + this.$sideNav = $('#org-side-nav'); this.$reposDiv = $('#organization-repos'); this.$table = $('#organization-repos table'); this.$tableBody = $('tbody', this.$table); @@ -62,6 +63,7 @@ define([ }, showRepoList: function() { + this.$sideNav.show(); this.dirView.hide(); this.$reposDiv.show(); this.repos.fetch({reset: true}); @@ -73,6 +75,7 @@ define([ }, showDir: function(repo_id, path) { + this.$sideNav.show(); var path = path || '/'; this.hideRepoList(); this.dirView.showDir('org', repo_id, path); @@ -83,7 +86,6 @@ define([ sortByName: function() { var repos = this.repos; - console.log(repos); var el = $('.by-name', this.$table); repos.comparator = function(a, b) { // a, b: model if (el.hasClass('icon-caret-up')) { @@ -115,6 +117,7 @@ define([ }, hide: function() { + this.$sideNav.hide(); this.hideRepoList(); this.dirView.hide(); }