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 type="text/template" id="dir-path-bar-tmpl">
<% 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') { %>
<a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</a> /
<a href="#<%= category %>/" class="path-link normal">{% trans "Organization" %}</a> /
<% } 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 { %>
<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> /
<% } %>
<% if (path == '/') { %>
@@ -588,11 +587,11 @@
{% 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>
{% endif %}
{% for mod in request.user.mods_enabled %}
{% if mod == 'personal wiki' %}
<% for (var i = 0, len = mods_enabled.length; i < len; i++) { %>
<% 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>
{% endif %}
{% endfor %}
<% } %>
<% } %>
<li class="tab"><a href="{% url 'devices' %}"><span class="sf2-icon-monitor"></span>{% trans "Devices" %}</a></li>
</ul>

View File

@@ -25,30 +25,12 @@
{% endblock %}
{% block right_panel %}
<div id="repo-tabs" class="tab-tabs hide">
<div class="hd">
<ul class="tab-tabs-nav fleft">
{% 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 id="my-own-repos" class="hide">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Mine" %}</h3>
<button class="repo-create fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Library" %}</span></button>
</div>
</div>
<div id="my-own-repos">
<table class="hide">
<thead></thead>
<tbody></tbody>
@@ -57,9 +39,17 @@
<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>
</div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</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">
<thead>
<tr>
@@ -76,9 +66,13 @@
<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>
</div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</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">
<thead></thead>
<tbody></tbody>
@@ -86,11 +80,10 @@
<div class="empty-tips hide">
<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>
<div id="starred-file" class="hide">
<h3 class="hd">{% trans "Starred" %}</h3>
@@ -147,16 +140,16 @@
</form>
{% endif %}
<div id="group-repo-tabs" class="tab-tabs hide">
<div id="group-repo-tabs" class="hide">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Libraries" %}</h3>
<h3 class="fleft">{% trans "Group" %}</h3>
{% 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>
{% endif %}
</div>
<div id="grp-repos">
<table style="display:none">
<table class="hide">
<thead></thead>
<tbody></tbody>
</table>
@@ -172,9 +165,9 @@
<p class="error error-tip hide"></p>
</div>
<div id="organization-repos" class="tab-tabs hide">
<div id="organization-repos" class="hide">
<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>
<ul id="add-pub-lib-menu" class="hide">
<li class="item share-existing">{% trans "Share existing libraries" %}</li>

View File

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

View File

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

View File

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

View File

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

View File

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