1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

[hd] modified mine/shared/org ...pages

This commit is contained in:
llj
2015-11-24 12:10:17 +08:00
parent 4c0c8c10aa
commit 385b32154d
7 changed files with 64 additions and 92 deletions

View File

@@ -137,13 +137,12 @@
</script> </script>
<script type="text/template" id="dir-path-bar-tmpl"> <script type="text/template" id="dir-path-bar-tmpl">
<% if (context == 'group') { %> <% if (context == 'group') { %>
<a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</a> / <a href="#<%= category %>/" class="path-link normal">{% trans "Group" %}</a> /
<% } else if (context == 'org') { %> <% } else if (context == 'org') { %>
<a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</a> / <a href="#<%= category %>/" class="path-link normal">{% trans "Organization" %}</a> /
<% } else if (context == 'common') { %> <% } else if (context == 'common') { %>
<a href="#my-libs/" class="path-link normal">{% trans "Libraries" %}</a> / <a href="#my-libs/" class="path-link normal">{% trans "Mine" %}</a> /
<% } else { %> <% } else { %>
<a href="#" class="path-link normal">{% trans "Libraries" %}</a> /
<a href="#<%= category %>/" class="path-link normal"><% if (category == 'my-libs') { %>{% trans "Mine" %}<% } %><% if (category == 'shared-libs') { %>{% trans "Shared" %}<% } %><% if (category == 'my-sub-libs') { %>{% trans "Sub-libraries" %}<% } %></a> / <a href="#<%= category %>/" class="path-link normal"><% if (category == 'my-libs') { %>{% trans "Mine" %}<% } %><% if (category == 'shared-libs') { %>{% trans "Shared" %}<% } %><% if (category == 'my-sub-libs') { %>{% trans "Sub-libraries" %}<% } %></a> /
<% } %> <% } %>
<% if (path == '/') { %> <% if (path == '/') { %>
@@ -588,11 +587,11 @@
{% if events_enabled %} {% if events_enabled %}
<li class="tab<% if (cur_tab == 'activities') { %> tab-cur<% } %>"><a href="{{ SITE_ROOT }}#activities/"><span class="sf2-icon-clock"></span>{% trans "Activities" %}</a></li> <li class="tab<% if (cur_tab == 'activities') { %> tab-cur<% } %>"><a href="{{ SITE_ROOT }}#activities/"><span class="sf2-icon-clock"></span>{% trans "Activities" %}</a></li>
{% endif %} {% endif %}
{% for mod in request.user.mods_enabled %} <% for (var i = 0, len = mods_enabled.length; i < len; i++) { %>
{% if mod == 'personal wiki' %} <% if (mods_enabled[i] == 'personal wiki') { %>
<li class="tab"><a href="{% url 'personal_wiki' %}"><span class="sf2-icon-wiki"></span>{% trans "Personal Wiki" %}</a></li> <li class="tab"><a href="{% url 'personal_wiki' %}"><span class="sf2-icon-wiki"></span>{% trans "Personal Wiki" %}</a></li>
{% endif %} <% } %>
{% endfor %} <% } %>
<li class="tab"><a href="{% url 'devices' %}"><span class="sf2-icon-monitor"></span>{% trans "Devices" %}</a></li> <li class="tab"><a href="{% url 'devices' %}"><span class="sf2-icon-monitor"></span>{% trans "Devices" %}</a></li>
</ul> </ul>

View File

@@ -25,30 +25,12 @@
{% endblock %} {% endblock %}
{% block right_panel %} {% block right_panel %}
{% if user.permissions.can_add_repo %}
<div id="my-own-repos" class="hide">
<div id="repo-tabs" class="tab-tabs hide"> <div class="hd ovhd">
<div class="hd"> <h3 class="fleft">{% trans "Mine" %}</h3>
<ul class="tab-tabs-nav fleft"> <button class="repo-create fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Library" %}</span></button>
{% if user.permissions.can_add_repo %}
<li class="tab"><a href="#my-libs/" class="a" id="mylib-tab">{% trans "Mine" %}</a></li>
{% if sub_lib_enabled %}
<li class="tab"><a href="#my-sub-libs/" class="a" id="sublib-tab">{% trans "Sub-libraries" %}</a></li>
{% endif %}
{% endif %}
<li class="tab"><a href="#shared-libs/" class="a" id="shared-lib-tab">{% trans "Shared" %}</a></li>
</ul>
<div class="fright">
{% if user.permissions.can_add_repo %}
<button class="repo-create"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Library" %}</span></button>
{% endif %}
{% if sub_lib_enabled %}
<button id="sub-lib-create" class="hide" title="{% trans "New Sub-library" %}"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Sub-library" %}</span></button>
{% endif %}
</div> </div>
</div>
<div id="my-own-repos">
<table class="hide"> <table class="hide">
<thead></thead> <thead></thead>
<tbody></tbody> <tbody></tbody>
@@ -57,9 +39,17 @@
<h2 class="alc">{% trans "You have not created any libraries" %}</h2> <h2 class="alc">{% trans "You have not created any libraries" %}</h2>
<p>{% trans "You can create a library to organize your files. For example, you can create one for each of your projects. Each library can be synchronized and shared separately." %}</p> <p>{% trans "You can create a library to organize your files. For example, you can create one for each of your projects. Each library can be synchronized and shared separately." %}</p>
</div> </div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</div> </div>
{% endif %}
<div id="my-sub-repos"> {% if user.permissions.can_add_repo and sub_lib_enabled %}
<div id="my-sub-repos" class="hide">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Sub-libraries" %}</h3>
<button id="sub-lib-create" class="fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Sub-library" %}</span></button>
</div>
<table class="hide"> <table class="hide">
<thead> <thead>
<tr> <tr>
@@ -76,9 +66,13 @@
<h2 class="center-contents">{% trans "You have not created any sub-libraries" %}</h2> <h2 class="center-contents">{% trans "You have not created any sub-libraries" %}</h2>
<p>{% trans "You can create a sub-library from a directory inside a library. A sub-library can be independently synced and shared. Files in the sub-library will be automatically kept in sync with those in the directory of the origin library." %}</p> <p>{% trans "You can create a sub-library from a directory inside a library. A sub-library can be independently synced and shared. Files in the sub-library will be automatically kept in sync with those in the directory of the origin library." %}</p>
</div> </div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</div> </div>
{% endif %}
<div id="repos-shared-to-me"> <div id="repos-shared-to-me" class="hide">
<h3 class="hd">{% trans "Shared" %}</h3>
<table class="hide"> <table class="hide">
<thead></thead> <thead></thead>
<tbody></tbody> <tbody></tbody>
@@ -86,11 +80,10 @@
<div class="empty-tips hide"> <div class="empty-tips hide">
<h2 class="alc">{% trans "No library is shared to you" %}</h2> <h2 class="alc">{% trans "No library is shared to you" %}</h2>
</div> </div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</div> </div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</div>
<div id="starred-file" class="hide"> <div id="starred-file" class="hide">
<h3 class="hd">{% trans "Starred" %}</h3> <h3 class="hd">{% trans "Starred" %}</h3>
@@ -147,16 +140,16 @@
</form> </form>
{% endif %} {% endif %}
<div id="group-repo-tabs" class="tab-tabs hide"> <div id="group-repo-tabs" class="hide">
<div class="hd ovhd"> <div class="hd ovhd">
<h3 class="fleft">{% trans "Libraries" %}</h3> <h3 class="fleft">{% trans "Group" %}</h3>
{% if user.permissions.can_add_repo %} {% if user.permissions.can_add_repo %}
<button class="repo-create fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Library" %}</span></button> <button class="repo-create fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Library" %}</span></button>
{% endif %} {% endif %}
</div> </div>
<div id="grp-repos"> <div id="grp-repos">
<table style="display:none"> <table class="hide">
<thead></thead> <thead></thead>
<tbody></tbody> <tbody></tbody>
</table> </table>
@@ -172,9 +165,9 @@
<p class="error error-tip hide"></p> <p class="error error-tip hide"></p>
</div> </div>
<div id="organization-repos" class="tab-tabs hide"> <div id="organization-repos" class="hide">
<div class="hd"> <div class="hd">
<h3 class="fleft">{% trans "Libraries" %}</h3> <h3 class="fleft">{% trans "Organization" %}</h3>
<button id="add-pub-lib" class="fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "Add Library"%}</span></button> <button id="add-pub-lib" class="fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "Add Library"%}</span></button>
<ul id="add-pub-lib-menu" class="hide"> <ul id="add-pub-lib-menu" class="hide">
<li class="item share-existing">{% trans "Share existing libraries" %}</li> <li class="item share-existing">{% trans "Share existing libraries" %}</li>

View File

@@ -10,23 +10,22 @@ define([
'use strict'; 'use strict';
var ReposView = Backbone.View.extend({ var ReposView = Backbone.View.extend({
el: $('#repo-tabs'), el: $('#my-own-repos'),
reposHdTemplate: _.template($('#my-repos-hd-tmpl').html()), reposHdTemplate: _.template($('#my-repos-hd-tmpl').html()),
events: { events: {
'click .repo-create': 'createRepo', 'click .repo-create': 'createRepo',
'click #my-own-repos .by-name': 'sortByName', 'click .by-name': 'sortByName',
'click #my-own-repos .by-time': 'sortByTime' 'click .by-time': 'sortByTime'
}, },
initialize: function(options) { initialize: function(options) {
this.$tabs = $('#repo-tabs'); this.$table = this.$('table');
this.$table = this.$('#my-own-repos table');
this.$tableHead = $('thead', this.$table); this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
this.$loadingTip = $('.loading-tip', this.$tabs); this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = $('#my-own-repos .empty-tips'); this.$emptyTip = this.$('.empty-tips');
this.$repoCreateBtn = this.$('.repo-create'); this.$repoCreateBtn = this.$('.repo-create');
this.repos = new RepoCollection(); this.repos = new RepoCollection();
@@ -68,8 +67,7 @@ define([
}, },
showMyRepos: function() { showMyRepos: function() {
this.$tabs.show(); this.$el.show();
$('#mylib-tab').parent().addClass('ui-state-active');
this.$table.hide(); this.$table.hide();
var $loadingTip = this.$loadingTip; var $loadingTip = this.$loadingTip;
$loadingTip.show(); $loadingTip.show();
@@ -98,16 +96,11 @@ define([
}, },
show: function() { show: function() {
this.$repoCreateBtn.show();
this.showMyRepos(); this.showMyRepos();
}, },
hide: function() { hide: function() {
this.$repoCreateBtn.hide();
this.$el.hide(); this.$el.hide();
this.$table.hide();
this.$emptyTip.hide();
$('#mylib-tab', this.$tabs).parent().removeClass('ui-state-active');
}, },
createRepo: function() { createRepo: function() {

View File

@@ -9,17 +9,16 @@ define([
'use strict'; 'use strict';
var SharedReposView = Backbone.View.extend({ var SharedReposView = Backbone.View.extend({
el: $('#repo-tabs'), el: $('#repos-shared-to-me'),
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()), reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
initialize: function(options) { initialize: function(options) {
this.$tabs = $('#repo-tabs'); this.$table = this.$('table');
this.$table = $('#repos-shared-to-me table');
this.$tableHead = $('thead', this.$table); this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
this.$loadingTip = $('.loading-tip', this.$tabs); this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = $('#repos-shared-to-me .empty-tips'); this.$emptyTip = this.$('.empty-tips');
this.repos = new RepoCollection({type: 'shared'}); this.repos = new RepoCollection({type: 'shared'});
this.listenTo(this.repos, 'add', this.addOne); this.listenTo(this.repos, 'add', this.addOne);
@@ -55,8 +54,7 @@ define([
}, },
showSharedRepos: function() { showSharedRepos: function() {
this.$tabs.show(); this.$el.show();
$('#shared-lib-tab').parent().addClass('ui-state-active');
this.$table.hide(); this.$table.hide();
var $loadingTip = this.$loadingTip; var $loadingTip = this.$loadingTip;
$loadingTip.show(); $loadingTip.show();
@@ -89,14 +87,11 @@ define([
hide: function() { hide: function() {
this.$el.hide(); this.$el.hide();
this.$table.hide();
this.$emptyTip.hide();
$('#shared-lib-tab', this.$tabs).parent().removeClass('ui-state-active');
}, },
events: { events: {
'click #repos-shared-to-me .by-name': 'sortByName', 'click .by-name': 'sortByName',
'click #repos-shared-to-me .by-time': 'sortByTime' 'click .by-time': 'sortByTime'
}, },
sortByName: function() { sortByName: function() {

View File

@@ -11,19 +11,18 @@ define([
'use strict'; 'use strict';
var ReposView = Backbone.View.extend({ var ReposView = Backbone.View.extend({
el: $('#repo-tabs'), el: $('#my-sub-repos'),
events: { events: {
'click #sub-lib-create': 'createRepo' 'click #sub-lib-create': 'createRepo'
}, },
initialize: function(options) { initialize: function(options) {
this.$tabs = $('#repo-tabs'); this.$table = this.$('table');
this.$table = this.$('#my-sub-repos table');
this.$tableHead = $('thead', this.$table); this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
this.$loadingTip = $('.loading-tip', this.$tabs); this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = $('#my-sub-repos .empty-tips'); this.$emptyTip = this.$('.empty-tips');
this.repos = new RepoCollection({type: 'sub'}); this.repos = new RepoCollection({type: 'sub'});
this.listenTo(this.repos, 'add', this.addOne); this.listenTo(this.repos, 'add', this.addOne);
@@ -54,8 +53,7 @@ define([
}, },
showSubRepos: function() { showSubRepos: function() {
this.$tabs.show(); this.$el.show();
$('#sublib-tab').parent().addClass('ui-state-active');
this.$table.hide(); this.$table.hide();
var $loadingTip = this.$loadingTip; var $loadingTip = this.$loadingTip;
$loadingTip.show(); $loadingTip.show();
@@ -83,16 +81,11 @@ define([
}, },
show: function() { show: function() {
$('#sub-lib-create').show();
this.showSubRepos(); this.showSubRepos();
}, },
hide: function() { hide: function() {
$('#sub-lib-create').hide();
this.$el.hide(); this.$el.hide();
this.$table.hide();
this.$emptyTip.hide();
$('#sublib-tab', this.$tabs).parent().removeClass('ui-state-active');
}, },
createRepo: function() { createRepo: function() {

View File

@@ -12,18 +12,16 @@ define([
'use strict'; 'use strict';
var OrganizationView = Backbone.View.extend({ var OrganizationView = Backbone.View.extend({
el: '#main', el: '#organization-repos',
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()), reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
initialize: function(options) { initialize: function(options) {
this.$table = this.$('table');
this.$reposDiv = $('#organization-repos');
this.$table = $('#organization-repos table');
this.$tableHead = $('thead', this.$table); this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
this.$loadingTip = $('#organization-repos .loading-tip'); this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = $('#organization-repos .empty-tips'); this.$emptyTip = this.$('.empty-tips');
this.repos = new PubRepoCollection(); this.repos = new PubRepoCollection();
this.listenTo(this.repos, 'add', this.addOne); this.listenTo(this.repos, 'add', this.addOne);
@@ -55,10 +53,10 @@ define([
}, },
events: { events: {
'click #organization-repos .share-existing': 'addRepo', 'click .share-existing': 'addRepo',
'click #organization-repos .create-new': 'createRepo', 'click .create-new': 'createRepo',
'click #organization-repos .by-name': 'sortByName', 'click .by-name': 'sortByName',
'click #organization-repos .by-time': 'sortByTime' 'click .by-time': 'sortByTime'
}, },
createRepo: function() { createRepo: function() {
@@ -99,7 +97,7 @@ define([
showRepoList: function() { showRepoList: function() {
this.dirView.hide(); this.dirView.hide();
this.$reposDiv.show(); this.$el.show();
var $loadingTip = this.$loadingTip; var $loadingTip = this.$loadingTip;
$loadingTip.show(); $loadingTip.show();
var _this = this; var _this = this;
@@ -127,7 +125,7 @@ define([
}, },
hideRepoList: function() { hideRepoList: function() {
this.$reposDiv.hide(); this.$el.hide();
}, },
showDir: function(repo_id, path) { showDir: function(repo_id, path) {

View File

@@ -16,6 +16,7 @@ define([
this.default_cur_tab = 'mine'; this.default_cur_tab = 'mine';
this.data = { this.data = {
'cur_tab': this.default_cur_tab, 'cur_tab': this.default_cur_tab,
'mods_enabled': app.pageOptions.user_mods_enabled,
'can_add_repo': app.pageOptions.can_add_repo, 'can_add_repo': app.pageOptions.can_add_repo,
}; };
this.render(); this.render();