mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 08:53:14 +00:00
Finish URL design
This commit is contained in:
@@ -47,14 +47,14 @@
|
|||||||
{% block nav %}
|
{% block nav %}
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ SITE_ROOT }}libs/" class="a {% block cur_myhome %}{% endblock %}">{% trans "My Home" %}</a>
|
<a href="{{ SITE_ROOT }}#my-libs/" class="a {% block cur_myhome %}{% endblock %}">{% trans "My Home" %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item nav-item-group" {% if grps %}style="position:relative;"{% endif %}>
|
<li class="nav-item nav-item-group" {% if grps %}style="position:relative;"{% endif %}>
|
||||||
<a href="{% url 'group_list' %}" class="a {% block cur_group %}{% endblock %}" {% if grps %}id="top-nav-grp"{% endif %}>{% trans "Groups" %}{% if grps %} <span class="icon-caret-down"></span>{% endif %}</a>
|
<a href="{% url 'group_list' %}" class="a {% block cur_group %}{% endblock %}" {% if grps %}id="top-nav-grp"{% endif %}>{% trans "Groups" %}{% if grps %} <span class="icon-caret-down"></span>{% endif %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% if user.permissions.can_view_org %}
|
{% if user.permissions.can_view_org %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ SITE_ROOT }}libs/#org" class="a {% block cur_pubinfo %}{% endblock %}">{% trans "Organization" %}</a>
|
<a href="{{ SITE_ROOT }}#org/" class="a {% block cur_pubinfo %}{% endblock %}">{% trans "Organization" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
<td><a href="#/group/<%= group_id %>/<%= id %>"><%- name %></a></td>
|
<td><a href="#/group/<%= group_id %>/lib/<%= id %>"><%- name %></a></td>
|
||||||
<td class="alc">
|
<td class="alc">
|
||||||
<% if (app.pageOptions.isGroupStaff) { %>
|
<% if (app.pageOptions.isGroupStaff) { %>
|
||||||
<img src="<%= app.config.mediaUrl%>img/delete-orange.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
<img src="<%= app.config.mediaUrl%>img/delete-orange.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
<td><a href="#org/<%= id %>"><%- name %></a></td>
|
<td><a href="#org/lib/<%= id %>"><%- name %></a></td>
|
||||||
<td class="alc">
|
<td class="alc">
|
||||||
<% if (show_unshare_btn) { %>
|
<% if (show_unshare_btn) { %>
|
||||||
<img src="<%= app.config.mediaUrl%>img/delete-orange.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
<img src="<%= app.config.mediaUrl%>img/delete-orange.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
||||||
@@ -146,15 +146,18 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/template" id="path-bar-tmpl">
|
<script type="text/template" id="path-bar-tmpl">
|
||||||
<a href="#" class="path-link normal">{% trans "Libraries" %}</a> /
|
<% if (context == 'group') { %>
|
||||||
<% if (category) { %>
|
<a href="#<%= category %>/" 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> /
|
<% } else if (context == 'org') { %>
|
||||||
|
<a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</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> /
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (path == '/') { %>
|
<% if (path == '/') { %>
|
||||||
<%- repo_name %> /
|
<%- repo_name %> /
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href="#<%= category %>/lib/<%= repo_id %>/" class="path-link normal"><%- repo_name %></a> /
|
<a href="#<%= category %>/lib/<%= repo_id %>/" class="path-link normal"><%- repo_name %></a> /
|
||||||
<% for (var i = 0,len = path_list.length - 1; i < len; i++) { %>
|
<% for (var i = 0,len = path_list.length - 1; i < len; i++) { %>
|
||||||
<a href="#<%= category %>/lib/<%= repo_id %>/<% print(path_list_encoded.slice(0, i+1).join('/')); %>" class="path-link normal"><%- path_list[i] %></a> /
|
<a href="#<%= category %>/lib/<%= repo_id %>/<% print(path_list_encoded.slice(0, i+1).join('/')); %>" class="path-link normal"><%- path_list[i] %></a> /
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<ul class="side-tabnav-tabs">
|
<ul class="side-tabnav-tabs">
|
||||||
<li class="tab tab-cur"><a href="{% url 'myhome' %}#" 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 {% block cur_stars %}{% endblock %}"><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 {% block cur_activities %}{% endblock %}"><a href="{% url 'activities' %}" class="activity">{% trans "Activities" %}</a></li>
|
||||||
@@ -67,12 +67,12 @@
|
|||||||
<div class="hd">
|
<div class="hd">
|
||||||
<ul class="tab-tabs-nav fleft">
|
<ul class="tab-tabs-nav fleft">
|
||||||
{% if user.permissions.can_add_repo %}
|
{% if user.permissions.can_add_repo %}
|
||||||
<li class="tab"><a href="#my-libs" class="a" id="mylib-tab">{% trans "Mine" %}</a></li>
|
<li class="tab"><a href="#my-libs/" class="a" id="mylib-tab">{% trans "Mine" %}</a></li>
|
||||||
{% if sub_lib_enabled %}
|
{% if sub_lib_enabled %}
|
||||||
<li class="tab"><a href="#my-sub-libs" class="a" id="sublib-tab">{% trans "Sub-libraries" %}</a></li>
|
<li class="tab"><a href="#my-sub-libs/" class="a" id="sublib-tab">{% trans "Sub-libraries" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="tab"><a href="#shared-libs" class="a" id="shared-lib-tab">{% trans "Shared" %}</a></li>
|
<li class="tab"><a href="#shared-libs/" class="a" id="shared-lib-tab">{% trans "Shared" %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="fright">
|
<div class="fright">
|
||||||
<button id="repo-create" class=""><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Library" %}</span></button>
|
<button id="repo-create" class=""><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Library" %}</span></button>
|
||||||
|
@@ -38,7 +38,7 @@ urlpatterns = patterns('',
|
|||||||
|
|
||||||
(r'^accounts/', include('seahub.base.registration_urls')),
|
(r'^accounts/', include('seahub.base.registration_urls')),
|
||||||
|
|
||||||
(r'^$', myhome),
|
url(r'^$', libraries, name='libraries'),
|
||||||
#url(r'^home/$', direct_to_template, { 'template': 'home.html' } ),
|
#url(r'^home/$', direct_to_template, { 'template': 'home.html' } ),
|
||||||
url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
|
url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
|
||||||
url(r'^home/my/$', myhome, name='myhome'),
|
url(r'^home/my/$', myhome, name='myhome'),
|
||||||
|
@@ -7,22 +7,22 @@ define([
|
|||||||
'app/views/group',
|
'app/views/group',
|
||||||
'app/views/organization',
|
'app/views/organization',
|
||||||
'app/views/group-nav',
|
'app/views/group-nav',
|
||||||
], function($, Backbone, Common, MyHomeView, GroupView, orgView,
|
], function($, Backbone, Common, MyHomeView, GroupView, OrgView,
|
||||||
GroupNavView) {
|
GroupNavView) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var Router = Backbone.Router.extend({
|
var Router = Backbone.Router.extend({
|
||||||
routes: {
|
routes: {
|
||||||
'my-libs': 'showMyRepos',
|
'my-libs/': 'showMyRepos',
|
||||||
'my-libs/lib/:repo_id(/*path)': 'showMyRepoDir',
|
'my-libs/lib/:repo_id(/*path)': 'showMyRepoDir',
|
||||||
'my-sub-libs': 'showMySubRepos',
|
'my-sub-libs/': 'showMySubRepos',
|
||||||
'my-sub-libs/lib/:repo_id(/*path)': 'showMySubRepoDir',
|
'my-sub-libs/lib/:repo_id(/*path)': 'showMySubRepoDir',
|
||||||
'shared-libs': 'showSharedRepos',
|
'shared-libs/': 'showSharedRepos',
|
||||||
'shared-libs/lib/:repo_id(/*path)': 'showSharedRepoDir',
|
'shared-libs/lib/:repo_id(/*path)': 'showSharedRepoDir',
|
||||||
'group/:group_id/': 'showGroupRepos',
|
'group/:group_id/': 'showGroupRepos',
|
||||||
'group/:group_id/:repo_id(/*path)': 'showGroupRepoDir',
|
'group/:group_id/lib/:repo_id(/*path)': 'showGroupRepoDir',
|
||||||
'org': 'showOrgRepos',
|
'org/': 'showOrgRepos',
|
||||||
'org/:repo_id(/*path)': 'showOrgRepoDir',
|
'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
'*actions': 'defaultAction'
|
'*actions': 'defaultAction'
|
||||||
@@ -35,27 +35,31 @@ define([
|
|||||||
|
|
||||||
this.myHomeView = new MyHomeView();
|
this.myHomeView = new MyHomeView();
|
||||||
this.groupView = new GroupView();
|
this.groupView = new GroupView();
|
||||||
this.orgView = new orgView();
|
this.orgView = new OrgView();
|
||||||
this.currentView = this.myHomeView;
|
this.currentView = this.myHomeView;
|
||||||
|
|
||||||
this.groupNavView = new GroupNavView();
|
this.groupNavView = new GroupNavView();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
switchCurrentView: function(newView) {
|
||||||
|
if (this.currentView != newView) {
|
||||||
|
this.currentView.hide();
|
||||||
|
this.currentView = newView;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
showMyRepos: function() {
|
showMyRepos: function() {
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showMyRepos();
|
this.myHomeView.showMyRepos();
|
||||||
},
|
},
|
||||||
|
|
||||||
showMySubRepos: function() {
|
showMySubRepos: function() {
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showMySubRepos();
|
this.myHomeView.showMySubRepos();
|
||||||
},
|
},
|
||||||
|
|
||||||
showSharedRepos: function() {
|
showSharedRepos: function() {
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showSharedRepos();
|
this.myHomeView.showSharedRepos();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -65,8 +69,7 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
path = '/';
|
path = '/';
|
||||||
}
|
}
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showDir('my-libs', repo_id, path);
|
this.myHomeView.showDir('my-libs', repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -76,8 +79,7 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
path = '/';
|
path = '/';
|
||||||
}
|
}
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showDir('my-sub-libs', repo_id, path);
|
this.myHomeView.showDir('my-sub-libs', repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -87,14 +89,12 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
path = '/';
|
path = '/';
|
||||||
}
|
}
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.currentView = this.myHomeView;
|
|
||||||
this.myHomeView.showDir('shared-libs', repo_id, path);
|
this.myHomeView.showDir('shared-libs', repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
showGroupRepos: function(group_id) {
|
showGroupRepos: function(group_id) {
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.groupView);
|
||||||
this.currentView = this.groupView;
|
|
||||||
this.groupView.showRepoList(group_id);
|
this.groupView.showRepoList(group_id);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -104,14 +104,12 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
path = '/';
|
path = '/';
|
||||||
}
|
}
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.groupView);
|
||||||
this.currentView = this.groupView;
|
|
||||||
this.groupView.showDir(group_id, repo_id, path);
|
this.groupView.showDir(group_id, repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
showOrgRepos: function() {
|
showOrgRepos: function() {
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.orgView);
|
||||||
this.currentView = this.orgView;
|
|
||||||
this.orgView.showRepoList();
|
this.orgView.showRepoList();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -121,8 +119,7 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
path = '/';
|
path = '/';
|
||||||
}
|
}
|
||||||
this.currentView.hide();
|
this.switchCurrentView(this.orgView);
|
||||||
this.currentView = this.orgView;
|
|
||||||
this.orgView.showDir(repo_id, path);
|
this.orgView.showDir(repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -130,6 +127,7 @@ define([
|
|||||||
// We have no matching route, lets just log what the URL was
|
// We have no matching route, lets just log what the URL was
|
||||||
console.log('No route:', actions);
|
console.log('No route:', actions);
|
||||||
|
|
||||||
|
this.switchCurrentView(this.myHomeView);
|
||||||
this.myHomeView.showMyRepos();
|
this.myHomeView.showMyRepos();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -225,12 +225,20 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderPath: function() {
|
renderPath: function() {
|
||||||
var dir = this.dir,
|
var dir = this.dir;
|
||||||
path = dir.path,
|
var path = dir.path;
|
||||||
obj = {
|
var context = 'my';
|
||||||
|
|
||||||
|
if (dir.category.startsWith('org')) {
|
||||||
|
context = 'org';
|
||||||
|
} else if (dir.category.startsWith('group')) {
|
||||||
|
context = 'group';
|
||||||
|
}
|
||||||
|
var obj = {
|
||||||
path: path,
|
path: path,
|
||||||
repo_name: dir.repo_name,
|
repo_name: dir.repo_name,
|
||||||
category: dir.category
|
category: dir.category,
|
||||||
|
context: context
|
||||||
};
|
};
|
||||||
|
|
||||||
var path_list = path.substr(1).split('/');
|
var path_list = path.substr(1).split('/');
|
||||||
|
@@ -91,7 +91,7 @@ define([
|
|||||||
showDir: function(group_id, repo_id, path) {
|
showDir: function(group_id, repo_id, path) {
|
||||||
this.group_id = group_id;
|
this.group_id = group_id;
|
||||||
this.hideRepoList();
|
this.hideRepoList();
|
||||||
this.dirView.showDir('', repo_id, path);
|
this.dirView.showDir('group/' + this.group_id, repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
createRepo: function() {
|
createRepo: function() {
|
||||||
@@ -141,6 +141,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
|
console.log("hide group view");
|
||||||
this.hideRepoList();
|
this.hideRepoList();
|
||||||
this.dirView.hide();
|
this.dirView.hide();
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ define([
|
|||||||
showDir: function(repo_id, path) {
|
showDir: function(repo_id, path) {
|
||||||
var path = path || '/';
|
var path = path || '/';
|
||||||
this.hideRepoList();
|
this.hideRepoList();
|
||||||
this.dirView.showDir('', repo_id, path);
|
this.dirView.showDir('org', repo_id, path);
|
||||||
// this.dirent_list = new app.DirentListView({id: id, path: path});
|
// this.dirent_list = new app.DirentListView({id: id, path: path});
|
||||||
// $('#my-own-repos table').children().remove();
|
// $('#my-own-repos table').children().remove();
|
||||||
// $('#my-own-repos table').append(this.dirent_list.render().el);
|
// $('#my-own-repos table').append(this.dirent_list.render().el);
|
||||||
|
Reference in New Issue
Block a user