1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 10:22:46 +00:00

[side nav] modified for myhome & org

This commit is contained in:
llj
2015-04-11 18:03:43 +08:00
committed by Daniel Pan
parent fd3a150717
commit a18b3297bf
3 changed files with 34 additions and 18 deletions

View File

@@ -23,7 +23,7 @@
{% endblock %} {% endblock %}
{% block left_panel %} {% block left_panel %}
<div class="side-tabnav"> <div class="side-tabnav hide" id="myhome-side-nav">
<div class="hd w100 ovhd"> <div class="hd w100 ovhd">
<h3 class="fleft">{% trans "Personal" %}</h3> <h3 class="fleft">{% trans "Personal" %}</h3>
{% if user.permissions.can_add_repo %} {% if user.permissions.can_add_repo %}
@@ -32,28 +32,37 @@
</div> </div>
<ul class="side-tabnav-tabs"> <ul class="side-tabnav-tabs">
<li class="tab tab-cur"><a href="{{ SITE_ROOT }}#my-libs/" class="lib">{% trans "Libraries" %}</a></li> <li class="tab tab-cur"><a href="{{ SITE_ROOT }}#my-libs/" class="lib">{% trans "Libraries" %}</a></li>
<li class="tab {% block cur_stars %}{% endblock %}"><a href="{% url 'starred' %}" class="star">{% trans "Starred" %}</a></li> <li class="tab"><a href="{% url 'starred' %}" class="star">{% trans "Starred" %}</a></li>
{% if events_enabled %} {% if events_enabled %}
<li class="tab {% block cur_activities %}{% endblock %}"><a href="{% url 'activities' %}" class="activity">{% trans "Activities" %}</a></li> <li class="tab"><a href="{% url 'activities' %}" class="activity">{% trans "Activities" %}</a></li>
{% endif %} {% endif %}
{% for mod in request.user.mods_enabled %} {% for mod in request.user.mods_enabled %}
{% if mod == 'personal wiki' %} {% if mod == 'personal wiki' %}
<li class="tab {% block cur_personal_wiki %}{% endblock %}"><a href="{% url 'personal_wiki' %}" class="wiki">{% trans "Personal Wiki" %}</a></li> <li class="tab"><a href="{% url 'personal_wiki' %}" class="wiki">{% trans "Personal Wiki" %}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<li class="tab {% block cur_messages %}{% endblock %}"><a href="{% url 'message_list' %}" class="msgs">{% trans "Messages" %}</a></li> <li class="tab"><a href="{% url 'message_list' %}" class="msgs">{% trans "Messages" %}</a></li>
<li class="tab {% block cur_devices %}{% endblock %}"><a href="{% url 'devices' %}" class="clients">{% trans "Devices" %}</a></li> <li class="tab"><a href="{% url 'devices' %}" class="clients">{% trans "Devices" %}</a></li>
<li class="tab {% block cur_contacts %}{% endblock %}"><a href="{% url 'contacts' %}" class="contacts">{% trans "Contacts" %}</a></li> <li class="tab"><a href="{% url 'contacts' %}" class="contacts">{% trans "Contacts" %}</a></li>
</ul> </ul>
<h3 class="hd">{% trans "Share Admin" %}</h3> <h3 class="hd">{% trans "Share Admin" %}</h3>
<ul class="side-tabnav-tabs"> <ul class="side-tabnav-tabs">
{% if user.permissions.can_add_repo %} {% if user.permissions.can_add_repo %}
<li class="tab {% block cur_share_libs %}{% endblock %}"><a href="{% url 'share_admin' %}" class="lib">{% trans "Libraries" %}</a></li> <li class="tab"><a href="{% url 'share_admin' %}" class="lib">{% trans "Libraries" %}</a></li>
<li class="tab {% block cur_share_folders %}{% endblock %}"><a href="{% url 'list_priv_shared_folders' %}" class="folders">{% trans "Folders" %}</a></li> <li class="tab"><a href="{% url 'list_priv_shared_folders' %}" class="folders">{% trans "Folders" %}</a></li>
{% endif %} {% endif %}
<li class="tab {% block cur_share_files %}{% endblock %}"><a href="{% url 'list_priv_shared_files' %}" class="files">{% trans "Files" %}</a></li> <li class="tab"><a href="{% url 'list_priv_shared_files' %}" class="files">{% trans "Files" %}</a></li>
<li class="tab {% block cur_share_links %}{% endblock %}"><a href="{% url 'list_shared_links' %}" class="links">{% trans "Links" %}</a></li> <li class="tab"><a href="{% url 'list_shared_links' %}" class="links">{% trans "Links" %}</a></li>
</ul>
</div>
<div class="side-tabnav hide" id="org-side-nav">
<h3 class="hd">{% trans "Organization" %}</h3>
<ul class="side-tabnav-tabs">
<li class="tab tab-cur"><a href="{{ SITE_ROOT }}libs/#org" class="lib">{% trans "Libraries" %}</a></li>
<li class="tab"><a href="{% url 'pubgrp' %}" class="group">{% trans "Groups" %}</a></li>
<li class="tab"><a href="{% url 'pubuser' %}" class="members">{% trans "Members" %}</a></li>
</ul> </ul>
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -16,13 +16,10 @@ define([
el: '#main', el: '#main',
initialize: function() { initialize: function() {
//_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide');
//this.$el.ajaxStart(this.ajaxLoadingShow).ajaxStop(this.ajaxLoadingHide);
this.$cont = this.$('#right-panel'); this.$cont = this.$('#right-panel');
this.$sideNav = $('#myhome-side-nav');
this.reposView = new ReposView(); this.reposView = new ReposView();
this.subReposView = new SubReposView(); this.subReposView = new SubReposView();
this.sharedReposView = new SharedReposView(); this.sharedReposView = new SharedReposView();
@@ -32,6 +29,9 @@ define([
$('#initial-loading-view').hide(); $('#initial-loading-view').hide();
}, },
showSideNav: function () {
this.$sideNav.show();
},
ajaxLoadingShow: function() { ajaxLoadingShow: function() {
Common.feedback('Loading...', 'info', Common.INFO_TIMEOUT); Common.feedback('Loading...', 'info', Common.INFO_TIMEOUT);
@@ -50,24 +50,28 @@ define([
}, },
showMyRepos: function() { showMyRepos: function() {
this.showSideNav();
this.currentView.hide(); this.currentView.hide();
this.reposView.show(); this.reposView.show();
this.currentView = this.reposView; this.currentView = this.reposView;
}, },
showMySubRepos: function() { showMySubRepos: function() {
this.showSideNav();
this.currentView.hide(); this.currentView.hide();
this.subReposView.show(); this.subReposView.show();
this.currentView = this.subReposView; this.currentView = this.subReposView;
}, },
showSharedRepos: function() { showSharedRepos: function() {
this.showSideNav();
this.currentView.hide(); this.currentView.hide();
this.sharedReposView.show(); this.sharedReposView.show();
this.currentView = this.sharedReposView; this.currentView = this.sharedReposView;
}, },
showDir: function(category, repo_id, path) { showDir: function(category, repo_id, path) {
this.showSideNav();
var path = path || '/'; var path = path || '/';
this.currentView.hide(); this.currentView.hide();
this.dirView.showDir(category, repo_id, path); this.dirView.showDir(category, repo_id, path);
@@ -76,9 +80,9 @@ define([
hide: function() { hide: function() {
this.currentView.hide(); this.currentView.hide();
this.$sideNav.hide();
} }
}); });
return MyHomeView; return MyHomeView;

View File

@@ -16,6 +16,7 @@ define([
initialize: function() { initialize: function() {
this.$sideNav = $('#org-side-nav');
this.$reposDiv = $('#organization-repos'); this.$reposDiv = $('#organization-repos');
this.$table = $('#organization-repos table'); this.$table = $('#organization-repos table');
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
@@ -62,6 +63,7 @@ define([
}, },
showRepoList: function() { showRepoList: function() {
this.$sideNav.show();
this.dirView.hide(); this.dirView.hide();
this.$reposDiv.show(); this.$reposDiv.show();
this.repos.fetch({reset: true}); this.repos.fetch({reset: true});
@@ -73,6 +75,7 @@ define([
}, },
showDir: function(repo_id, path) { showDir: function(repo_id, path) {
this.$sideNav.show();
var path = path || '/'; var path = path || '/';
this.hideRepoList(); this.hideRepoList();
this.dirView.showDir('org', repo_id, path); this.dirView.showDir('org', repo_id, path);
@@ -83,7 +86,6 @@ define([
sortByName: function() { sortByName: function() {
var repos = this.repos; var repos = this.repos;
console.log(repos);
var el = $('.by-name', this.$table); var el = $('.by-name', this.$table);
repos.comparator = function(a, b) { // a, b: model repos.comparator = function(a, b) { // a, b: model
if (el.hasClass('icon-caret-up')) { if (el.hasClass('icon-caret-up')) {
@@ -115,6 +117,7 @@ define([
}, },
hide: function() { hide: function() {
this.$sideNav.hide();
this.hideRepoList(); this.hideRepoList();
this.dirView.hide(); this.dirView.hide();
} }