diff --git a/seahub/base/templatetags/seahub_tags.py b/seahub/base/templatetags/seahub_tags.py
index 362198a7cd..8c96f88b8a 100644
--- a/seahub/base/templatetags/seahub_tags.py
+++ b/seahub/base/templatetags/seahub_tags.py
@@ -417,3 +417,7 @@ def trim(value, length):
return value[:length-2] + '...'
else:
return value
+
+@register.filter(name='strip_slash')
+def strip_slash(value):
+ return value.strip('/')
diff --git a/seahub/group/templates/group/group_info_for_pub.html b/seahub/group/templates/group/group_info_for_pub.html
index 1f967efbec..39f8eefa4e 100644
--- a/seahub/group/templates/group/group_info_for_pub.html
+++ b/seahub/group/templates/group/group_info_for_pub.html
@@ -26,7 +26,7 @@
{% endif %}
-
{{ repo.props.name }} |
+ {{ repo.props.name }} |
{{ repo.props.desc }} |
{% if repo.latest_modify %}
diff --git a/seahub/group/templates/group/groups_right_panel.html b/seahub/group/templates/group/groups_right_panel.html
index 2a4919632c..c54b685507 100644
--- a/seahub/group/templates/group/groups_right_panel.html
+++ b/seahub/group/templates/group/groups_right_panel.html
@@ -9,13 +9,13 @@
{% for group in joined_groups %}
-
- {% grp_avatar group.props.id 48 %}
+ {% grp_avatar group.props.id 48 %}
-
+
{% trans "Creator: " %}{{ group.props.creator_name }}
{% trans "Time: "%}{{ group.props.timestamp|tsstr_sec }}
- 
+

{% if group.wiki_enabled %}

diff --git a/seahub/notifications/models.py b/seahub/notifications/models.py
index d5b57fef9b..fb0f3ad56d 100644
--- a/seahub/notifications/models.py
+++ b/seahub/notifications/models.py
@@ -513,7 +513,7 @@ class UserNotification(models.Model):
msg = _(u"%(user)s has shared a library named %(repo_name)s to you.") % {
'user': escape(share_from),
- 'href': reverse('repo', args=[repo.id]),
+ 'href': reverse('view_common_lib_dir', args=[repo.id, '']),
'repo_name': escape(repo.name),
}
return msg
diff --git a/seahub/share/templates/share/links.html b/seahub/share/templates/share/links.html
index ba130c2b84..c5980a2e25 100644
--- a/seahub/share/templates/share/links.html
+++ b/seahub/share/templates/share/links.html
@@ -29,9 +29,9 @@
{{ fs.filename }} |
{% else %}
 |
- {{ fs.filename }} |
+ {{ fs.filename }} |
{% endif %}
- {{ fs.repo.name }} |
+ {{ fs.repo.name }} |
{{ fs.view_cnt }} |
@@ -61,8 +61,8 @@
{% for link in uploadlinks %}
|
 |
- {{ link.dir_name }} |
- {{ link.repo.name }} |
+ {{ link.dir_name }} |
+ {{ link.repo.name }} |
{{ link.view_cnt }} |
diff --git a/seahub/share/templates/share/priv_shared_files.html b/seahub/share/templates/share/priv_shared_files.html
index 639f22af45..664f5903cb 100644
--- a/seahub/share/templates/share/priv_shared_files.html
+++ b/seahub/share/templates/share/priv_shared_files.html
@@ -71,7 +71,7 @@
|  |
{{e.file_or_dir}} |
{% endif %}
- {{e.repo.name}} |
+ {{e.repo.name}} |
{{e.to_user|email2nickname}} |
diff --git a/seahub/share/templates/share/repos.html b/seahub/share/templates/share/repos.html
index 0e4374511b..5437850644 100644
--- a/seahub/share/templates/share/repos.html
+++ b/seahub/share/templates/share/repos.html
@@ -25,7 +25,7 @@
{% else %}
|  |
{% endif %}
- {{ repo.props.repo_name }} |
+ {{ repo.props.repo_name }} |
{{ repo.props.user }} |
diff --git a/seahub/share/views.py b/seahub/share/views.py
index 4bf5c247ae..7f0fbeeba0 100644
--- a/seahub/share/views.py
+++ b/seahub/share/views.py
@@ -665,7 +665,8 @@ def view_priv_shared_folder(request, repo_id):
if not repo.is_virtual:
raise Http404
- url = reverse('repo', args=[repo.origin_repo_id]) + '?p=' + repo.origin_path
+ url = reverse('view_common_lib_dir',
+ args=[repo.origin_repo_id, repo.origin_path.strip('/')])
return HttpResponseRedirect(url)
@login_required_ajax
diff --git a/seahub/templates/file_edit.html b/seahub/templates/file_edit.html
index c90c7f33f3..96192e4868 100644
--- a/seahub/templates/file_edit.html
+++ b/seahub/templates/file_edit.html
@@ -84,9 +84,9 @@
{% trans "Current path: " %}
{% for name, link in zipped %}
{% if not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
- {{ name }}
+ {{ name }}
{% endif %}
{% endfor %}
diff --git a/seahub/templates/file_revisions.html b/seahub/templates/file_revisions.html
index 0ed4e65d5f..057dc74ea4 100644
--- a/seahub/templates/file_revisions.html
+++ b/seahub/templates/file_revisions.html
@@ -12,9 +12,9 @@
{% trans 'Current Path:' %}
{% for name, link in zipped %}
{% if not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
- {{ name }}
+ {{ name }}
{% endif %}
{% endfor %}
diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html
index 6ec1c67b46..c430ff116c 100644
--- a/seahub/templates/js/templates.html
+++ b/seahub/templates/js/templates.html
@@ -150,6 +150,8 @@
{% trans "Libraries" %} /
<% } else if (context == 'org') { %>
{% trans "Libraries" %} /
+ <% } else if (context == 'common') { %>
+ {% trans "Libraries" %} /
<% } else { %>
{% trans "Libraries" %} /
<% if (category == 'my-libs') { %>{% trans "Mine" %}<% } %><% if (category == 'shared-libs') { %>{% trans "Shared" %}<% } %><% if (category == 'my-sub-libs') { %>{% trans "Sub-libraries" %}<% } %> /
diff --git a/seahub/templates/pubgrp.html b/seahub/templates/pubgrp.html
index cb4c10a2a8..fd0e705e2f 100644
--- a/seahub/templates/pubgrp.html
+++ b/seahub/templates/pubgrp.html
@@ -18,9 +18,9 @@
{% for group in groups %}
-
- {% grp_avatar group.props.id 48 %}
+ {% grp_avatar group.props.id 48 %}
-
+
{% trans "Creator: "%}{{ group.props.creator_name }}
{% trans "Time: "%}{{ group.props.timestamp|tsstr_sec }}
diff --git a/seahub/templates/repo_folder_perm.html b/seahub/templates/repo_folder_perm.html
index c1d691f0ec..8a8ffd154f 100644
--- a/seahub/templates/repo_folder_perm.html
+++ b/seahub/templates/repo_folder_perm.html
@@ -69,7 +69,7 @@
{% for perm in user_folder_perms %}
{{ perm.user }} |
- {{ perm.folder_name }} |
+ {{ perm.folder_name }} |
{% if perm.permission == 'rw' %}
@@ -123,10 +123,8 @@
{% if group_folder_perms %}
{% for perm in group_folder_perms %}
- {{ perm.group_name }} |
-
- {{ perm.folder_name }}
- |
+ {{ perm.group_name }} |
+ {{ perm.folder_name }} |
{% if perm.permission == 'rw' %}
diff --git a/seahub/templates/repo_shared_link.html b/seahub/templates/repo_shared_link.html
index 1c47d80faf..30eb7c61d5 100644
--- a/seahub/templates/repo_shared_link.html
+++ b/seahub/templates/repo_shared_link.html
@@ -51,7 +51,7 @@
{% for link in uploadlinks %}
 |
- {{ link.dir_name }} |
+ {{ link.dir_name }} |
{{ link.username|email2nickname }} |
-- |
{{ link.view_cnt }} |
@@ -78,7 +78,7 @@
{% if link.s_type == 'd'%}
 |
- {{ link.filename }} |
+ {{ link.filename }} |
{{ link.username|email2nickname }} |
{% else %}
 |
diff --git a/seahub/templates/snippets/events_body.html b/seahub/templates/snippets/events_body.html
index b6bde567c8..5b217d632a 100644
--- a/seahub/templates/snippets/events_body.html
+++ b/seahub/templates/snippets/events_body.html
@@ -10,7 +10,7 @@
{% if e.etype == "repo-update" %}
{% with repo=e.repo commit=e.commit %}
- {{ repo.name }}
+ {{ repo.name }}
{{ commit.converted_cmmt_desc|translate_commit_desc_escape|safe }}
{% if commit.more_files %}
@@ -26,7 +26,7 @@
{% endif %}
{% if e.etype == "repo-create" %}
- {% trans "Created library" %} {{ e.repo_name }}
+ {% trans "Created library" %} {{ e.repo_name }}
{% endif %}
{% if e.etype == "repo-delete" %}
diff --git a/seahub/templates/snippets/repo_dir_data.html b/seahub/templates/snippets/repo_dir_data.html
index ab3174a81c..aa0a1b89f4 100644
--- a/seahub/templates/snippets/repo_dir_data.html
+++ b/seahub/templates/snippets/repo_dir_data.html
@@ -3,7 +3,7 @@
{% for name, link in zipped %}
{% if forloop.first or not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
{{ name }} /
{% endif %}
diff --git a/seahub/templates/sysadmin/sys_admin_group_info.html b/seahub/templates/sysadmin/sys_admin_group_info.html
index 9bd2b8f34f..d0691ba9b8 100644
--- a/seahub/templates/sysadmin/sys_admin_group_info.html
+++ b/seahub/templates/sysadmin/sys_admin_group_info.html
@@ -46,7 +46,7 @@
{% for repo in repos %}
 |
- {{ repo.name }} |
+ {{ repo.name }} |
{{ repo.size|filesizeformat }} |
{{ repo.user }} |
diff --git a/seahub/templates/sysadmin/sys_list_system.html b/seahub/templates/sysadmin/sys_list_system.html
index 751688981f..0ace510be2 100644
--- a/seahub/templates/sysadmin/sys_list_system.html
+++ b/seahub/templates/sysadmin/sys_list_system.html
@@ -27,7 +27,7 @@
|
{% for repo in repos %}
- {{ repo.props.name }} |
+ {{ repo.props.name }} |
{{ repo.id }} |
{{ repo.props.desc }} |
diff --git a/seahub/templates/sysadmin/userinfo.html b/seahub/templates/sysadmin/userinfo.html
index b1b2bee7aa..f8cc299067 100644
--- a/seahub/templates/sysadmin/userinfo.html
+++ b/seahub/templates/sysadmin/userinfo.html
@@ -84,7 +84,7 @@
{% for repo in owned_repos %}
 |
- {{ repo.props.name }} |
+ {{ repo.props.name }} |
{{ repo.props.desc }} |
@@ -110,7 +110,7 @@
{% for repo in in_repos %}
|
 |
- {{ repo.props.repo_name }} |
+ {{ repo.props.repo_name }} |
{{ repo.props.user }} |
{{ repo.props.repo_desc }} |
diff --git a/seahub/templates/text_diff.html b/seahub/templates/text_diff.html
index 8e8d6703dc..c9bce26eb6 100644
--- a/seahub/templates/text_diff.html
+++ b/seahub/templates/text_diff.html
@@ -10,7 +10,7 @@
{% trans "Current Path:" %}
{% for name, link in zipped %}
{% if not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
{{ name }}
{% endif %}
diff --git a/seahub/templates/update_file_error.html b/seahub/templates/update_file_error.html
index 845452cfae..25cf018321 100644
--- a/seahub/templates/update_file_error.html
+++ b/seahub/templates/update_file_error.html
@@ -6,9 +6,9 @@
{% trans "Update file " %}
{% for name, link in zipped %}
{% if not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
- {{ name }}
+ {{ name }}
{% endif %}
{% endfor %}
{% trans "error: " %}
diff --git a/seahub/templates/upload_file_error.html b/seahub/templates/upload_file_error.html
index abfac98127..c8542c7ae8 100644
--- a/seahub/templates/upload_file_error.html
+++ b/seahub/templates/upload_file_error.html
@@ -5,7 +5,7 @@
{% trans "Upload file" %} {% if filename %} {{ filename }} {% endif %} {% trans "to" %}
{% for name, link in zipped %}
- {{ name }} /
+ {{ name }} /
{% endfor %}
{% trans "error: " %}
diff --git a/seahub/templates/view_file_base.html b/seahub/templates/view_file_base.html
index 8d57062e23..61befe4b96 100644
--- a/seahub/templates/view_file_base.html
+++ b/seahub/templates/view_file_base.html
@@ -34,7 +34,7 @@
{% trans "Current Path: "%}
{% for name, link in zipped %}
{% if not forloop.last %}
- {{ name }} /
+ {{ name }} /
{% else %}
{{ name }}
{% endif %}
@@ -324,7 +324,7 @@ $('#discuss-submit').click(function() {
$('#file-group-icon').click(function() {
{% if groups|length == 1 %}
{% for group in groups %}
- location.href= "{% url 'group_info' group.id %}";
+ location.href= "{% url 'view_group' group.id %}";
{% endfor %}
{% else %}
diff --git a/seahub/urls.py b/seahub/urls.py
index e0953e477e..7c0e4c721d 100644
--- a/seahub/urls.py
+++ b/seahub/urls.py
@@ -93,6 +93,8 @@ urlpatterns = patterns('',
### lib (replace the old `repo` urls) ###
# url(r'^lib/(?P [-0-9a-f]{36})/dir/(?P.*)$', view_lib_dir, name='view_lib_dir'),
url(r'^lib/(?P[-0-9a-f]{36})/file(?P.*)$', view_lib_file, name='view_lib_file'),
+ url(r'^#common/lib/(?P[-0-9a-f]{36})/(?P.*)$', fake_view, name='view_common_lib_dir'),
+ url(r'^#group/(?P\d+)/$', fake_view, name='view_group'),
# url(r'^home/my/lib/(?P[-0-9a-f]{36})/dir/(?P.*)$', myhome_lib, name='myhome_lib'),
### share file/dir, upload link ###
diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py
index 3bcc11ea62..ec5f66d204 100644
--- a/seahub/views/__init__.py
+++ b/seahub/views/__init__.py
@@ -1023,7 +1023,7 @@ def repo_history_revert(request, repo_id):
def fpath_to_link(repo_id, path, is_dir=False):
"""Translate file path of a repo to its view link"""
if is_dir:
- href = reverse("repo", args=[repo_id]) + '?p=/%s' % urllib2.quote(path.encode('utf-8'))
+ href = reverse("view_common_lib_dir", args=[repo_id, urllib2.quote(path.encode('utf-8')).strip('/')])
else:
href = reverse("view_lib_file", args=[repo_id, urllib2.quote(path.encode('utf-8'))])
@@ -1990,7 +1990,7 @@ def convert_cmmt_desc_link(request):
reverse('view_lib_file', args=[repo_id, '/' + urlquote(d.new_name)]))
elif d.status == 'newdir':
return HttpResponseRedirect(
- reverse('repo', args=[repo_id]) + '?p=/%s' % urlquote(d.name))
+ reverse('view_common_lib_dir', args=[repo_id, urlquote(d.name).strip('/')]))
else:
continue
@@ -2073,3 +2073,13 @@ def underscore_template(request, template):
return render_to_response(template, {},
context_instance=RequestContext(request))
+
+def fake_view(request, **kwargs):
+ """
+ Used for 'view_common_lib_dir' and 'view_group' url
+
+ As the two urls aboved starts with '#',
+ http request will not access this function
+ """
+ pass
+
diff --git a/seahub/views/file.py b/seahub/views/file.py
index 42fcea5b5f..7c905f4c87 100644
--- a/seahub/views/file.py
+++ b/seahub/views/file.py
@@ -415,13 +415,12 @@ def _file_view(request, repo_id, path):
img_prev = posixpath.join(parent_dir, img_list[cur_img_index - 1])
if cur_img_index != len(img_list) - 1:
img_next = posixpath.join(parent_dir, img_list[cur_img_index + 1])
-
+
template = 'view_file_%s.html' % ret_dict['filetype'].lower()
else:
ret_dict['err'] = err_msg
template = 'view_file_base.html'
-
# generate file path navigator
zipped = gen_path_link(path, repo.name)
diff --git a/static/scripts/app/router.js b/static/scripts/app/router.js
index 406e412267..55617bbba8 100644
--- a/static/scripts/app/router.js
+++ b/static/scripts/app/router.js
@@ -26,6 +26,7 @@ define([
'org/': 'showOrgRepos',
'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
+ 'common/lib/:repo_id(/*path)': 'showCommonDir',
// Default
'*actions': 'defaultAction'
},
@@ -81,6 +82,16 @@ define([
this.myHomeView.showDir('my-libs', repo_id, path);
},
+ showCommonDir: function(repo_id, path) {
+ if (path) {
+ path = '/' + path;
+ } else {
+ path = '/';
+ }
+ this.switchCurrentView(this.myHomeView);
+ this.myHomeView.showDir('common', repo_id, path);
+ },
+
showMySubRepoDir: function(repo_id, path) {
if (path) {
path = '/' + path;
diff --git a/static/scripts/app/views/dir.js b/static/scripts/app/views/dir.js
index 8539f87528..5b981ed092 100644
--- a/static/scripts/app/views/dir.js
+++ b/static/scripts/app/views/dir.js
@@ -226,6 +226,8 @@ define([
context = 'org';
} else if (category_start == 'group') {
context = 'group';
+ } else if (category_start == 'common') {
+ context = 'common';
}
var obj = {
path: path,
| | | |