1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-21 19:00:12 +00:00

new repo/dir/group url

This commit is contained in:
lian
2015-04-25 15:39:06 +08:00
parent cce391e5d2
commit 79efd306a9
28 changed files with 71 additions and 42 deletions

View File

@@ -417,3 +417,7 @@ def trim(value, length):
return value[:length-2] + '...' return value[:length-2] + '...'
else: else:
return value return value
@register.filter(name='strip_slash')
def strip_slash(value):
return value.strip('/')

View File

@@ -26,7 +26,7 @@
<img src="{{MEDIA_URL}}img/folder-no-write-20.png?t=1387267140" title="{% trans "Read-Only" %}" alt="{% trans "directory icon" %}" /> <img src="{{MEDIA_URL}}img/folder-no-write-20.png?t=1387267140" title="{% trans "Read-Only" %}" alt="{% trans "directory icon" %}" />
{% endif %} {% endif %}
</td> </td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id '' %}">{{ repo.props.name }}</a></td>
<td>{{ repo.props.desc }}</td> <td>{{ repo.props.desc }}</td>
<td> <td>
{% if repo.latest_modify %} {% if repo.latest_modify %}

View File

@@ -9,13 +9,13 @@
<ul class="group-list w100 ovhd"> <ul class="group-list w100 ovhd">
{% for group in joined_groups %} {% for group in joined_groups %}
<li class="group ovhd"> <li class="group ovhd">
<a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" class="no-deco fleft" title="{{ group.props.group_name }}">{% grp_avatar group.props.id 48 %}</a> <a href="{% url 'view_group' group.props.id %}" class="no-deco fleft" title="{{ group.props.group_name }}">{% grp_avatar group.props.id 48 %}</a>
<div class="txt fright"> <div class="txt fright">
<h4><a href="{% url 'group_info' group.props.id %}">{{ group.props.group_name }}</a></h4> <h4><a href="{% url 'view_group' group.props.id %}">{{ group.props.group_name }}</a></h4>
<p><span class="item-name">{% trans "Creator: " %}</span>{{ group.props.creator_name }}</p> <p><span class="item-name">{% trans "Creator: " %}</span>{{ group.props.creator_name }}</p>
<p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p> <p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p>
<div class="fast vh"> <div class="fast vh">
<a href="{% url 'group_info' group.props.id %}" title="{% trans "Libraries" %}" class="a"><img src="{{MEDIA_URL}}img/lib.png" alt="" /></a> <a href="{% url 'view_group' group.props.id %}" title="{% trans "Libraries" %}" class="a"><img src="{{MEDIA_URL}}img/lib.png" alt="" /></a>
<a href="{% url 'group_discuss' group.props.id %}" title="{% trans "Discussion" %}" class="a"><img src="{{MEDIA_URL}}img/msgs.png" alt="" /></a> <a href="{% url 'group_discuss' group.props.id %}" title="{% trans "Discussion" %}" class="a"><img src="{{MEDIA_URL}}img/msgs.png" alt="" /></a>
{% if group.wiki_enabled %} {% if group.wiki_enabled %}
<a href="{% url 'group_wiki' group.props.id %}" title="{% trans "Wiki" %}" class="a"><img src="{{MEDIA_URL}}img/wiki.png" alt="" /></a> <a href="{% url 'group_wiki' group.props.id %}" title="{% trans "Wiki" %}" class="a"><img src="{{MEDIA_URL}}img/wiki.png" alt="" /></a>

View File

@@ -513,7 +513,7 @@ class UserNotification(models.Model):
msg = _(u"%(user)s has shared a library named <a href='%(href)s'>%(repo_name)s</a> to you.") % { msg = _(u"%(user)s has shared a library named <a href='%(href)s'>%(repo_name)s</a> to you.") % {
'user': escape(share_from), 'user': escape(share_from),
'href': reverse('repo', args=[repo.id]), 'href': reverse('view_common_lib_dir', args=[repo.id, '']),
'repo_name': escape(repo.name), 'repo_name': escape(repo.name),
} }
return msg return msg

View File

@@ -29,9 +29,9 @@
<td><a href="{% url 'view_lib_file' fs.repo.id fs.path|urlencode %}">{{ fs.filename }}</a></td> <td><a href="{% url 'view_lib_file' fs.repo.id fs.path|urlencode %}">{{ fs.filename }}</a></td>
{% else %} {% else %}
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
<td><a href="{% url 'repo' fs.repo.id %}?p={{ fs.path|urlencode }}">{{ fs.filename }}</a></td> <td><a href="{% url 'view_common_lib_dir' fs.repo.id fs.path|urlencode|strip_slash %}">{{ fs.filename }}</a></td>
{% endif %} {% endif %}
<td><a href="{{ SITE_ROOT }}repo/{{ fs.repo.id }}/">{{ fs.repo.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' fs.repo.id '' %}">{{ fs.repo.name }}</a></td>
<td>{{ fs.view_cnt }}</td> <td>{{ fs.view_cnt }}</td>
<td> <td>
<img src="{{ MEDIA_URL }}img/link.png" alt="" class="view-link op-icon vh" data-link="{{ fs.shared_link }}" title="{% trans "View"%}" /> <img src="{{ MEDIA_URL }}img/link.png" alt="" class="view-link op-icon vh" data-link="{{ fs.shared_link }}" title="{% trans "View"%}" />
@@ -61,8 +61,8 @@
{% for link in uploadlinks %} {% for link in uploadlinks %}
<tr> <tr>
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
<td><a href="{% url 'repo' link.repo.id %}?p={{ link.path|urlencode }}">{{ link.dir_name }}</a></td> <td><a href="{% url 'view_common_lib_dir' link.repo.id link.path|urlencode|strip_slash %}">{{ link.dir_name }}</a></td>
<td><a href="{{ SITE_ROOT }}repo/{{ link.repo.id }}/">{{ link.repo.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' link.repo.id '' %}">{{ link.repo.name }}</a></td>
<td>{{ link.view_cnt }}</td> <td>{{ link.view_cnt }}</td>
<td> <td>
<img src="{{ MEDIA_URL }}img/link.png" alt="" class="view-link op-icon vh" data-link="{{ link.shared_link }}" title="{% trans "View"%}" /> <img src="{{ MEDIA_URL }}img/link.png" alt="" class="view-link op-icon vh" data-link="{{ link.shared_link }}" title="{% trans "View"%}" />

View File

@@ -71,7 +71,7 @@
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
<td><a href="{% url 'repo' e.repo_id %}?p={{ e.path|urlencode}}">{{e.file_or_dir}}</a></td> <td><a href="{% url 'repo' e.repo_id %}?p={{ e.path|urlencode}}">{{e.file_or_dir}}</a></td>
{% endif %} {% endif %}
<td><a href="{% url 'repo' e.repo_id %}">{{e.repo.name}}</a></td> <td><a href="{% url 'view_common_lib_dir' e.repo_id '' %}">{{e.repo.name}}</a></td>
<td>{{e.to_user|email2nickname}}</td> <td>{{e.to_user|email2nickname}}</td>
<td> <td>
<a href="{% url 'rm_private_file_share' e.token %}" class="op-icon vh" title="{% trans "Unshare" %}"> <a href="{% url 'rm_private_file_share' e.token %}" class="op-icon vh" title="{% trans "Unshare" %}">

View File

@@ -25,7 +25,7 @@
{% else %} {% else %}
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write"%}" alt="{% trans "directory icon" %}" /></td> <td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write"%}" alt="{% trans "directory icon" %}" /></td>
{% endif %} {% endif %}
<td><a href="{% url 'repo' repo.props.repo_id %}">{{ repo.props.repo_name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.props.repo_id '' %}">{{ repo.props.repo_name }}</a></td>
<td>{{ repo.props.user }}</td> <td>{{ repo.props.user }}</td>
<td> <td>
<div class="share-permission"> <div class="share-permission">

View File

@@ -665,7 +665,8 @@ def view_priv_shared_folder(request, repo_id):
if not repo.is_virtual: if not repo.is_virtual:
raise Http404 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) return HttpResponseRedirect(url)
@login_required_ajax @login_required_ajax

View File

@@ -84,9 +84,9 @@
{% trans "Current path: " %} {% trans "Current path: " %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/files/?p={{ path }}">{{ name }}</a> <a href="{% url 'view_lib_file' repo.id path %}" target="_blank">{{ name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>

View File

@@ -12,9 +12,9 @@
{% trans 'Current Path:' %} {% trans 'Current Path:' %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/files/?p={{ path|urlencode }}">{{ name }}</a> <a href="{% url 'view_lib_file' repo.id path|urlencode %}" target="_blank" >{{ name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>

View File

@@ -150,6 +150,8 @@
<a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</a> / <a href="#<%= category %>/" class="path-link normal">{% trans "Libraries" %}</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 "Libraries" %}</a> /
<% } else if (context == 'common') { %>
<a href="#my-libs/" class="path-link normal">{% trans "Libraries" %}</a> /
<% } else { %> <% } else { %>
<a href="#" class="path-link normal">{% trans "Libraries" %}</a> / <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> /

View File

@@ -18,9 +18,9 @@
<ul class="group-list"> <ul class="group-list">
{% for group in groups %} {% for group in groups %}
<li class="group ovhd"> <li class="group ovhd">
<a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" class="no-deco pic fleft">{% grp_avatar group.props.id 48 %}</a> <a href="{% url 'view_group' group.props.id %}" class="no-deco pic fleft">{% grp_avatar group.props.id 48 %}</a>
<div class="txt fright"> <div class="txt fright">
<h4><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/">{{ group.props.group_name }}</a></h4> <h4><a href="{% url 'view_group' group.props.id %}">{{ group.props.group_name }}</a></h4>
<p><span class="item-name">{% trans "Creator: "%}</span>{{ group.props.creator_name }}</p> <p><span class="item-name">{% trans "Creator: "%}</span>{{ group.props.creator_name }}</p>
<p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p> <p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p>
</div> </div>

View File

@@ -69,7 +69,7 @@
{% for perm in user_folder_perms %} {% for perm in user_folder_perms %}
<tr class="perm-item" data-user="{{ perm.user }}" data-path="{{ perm.path }}" data-perm="{{ perm.permission }}"> <tr class="perm-item" data-user="{{ perm.user }}" data-path="{{ perm.path }}" data-perm="{{ perm.permission }}">
<td><a href="{% url 'user_profile' perm.user %}">{{ perm.user }}</a></td> <td><a href="{% url 'user_profile' perm.user %}">{{ perm.user }}</a></td>
<td><span><a href="{{ perm.folder_link }}">{{ perm.folder_name }}</a></span></td> <td><span><a href="{% url 'view_common_lib_dir' repo.id perm.path|urlencode|strip_slash %}">{{ perm.folder_name }}</a></span></td>
<td> <td>
<div class="perm-change"> <div class="perm-change">
{% if perm.permission == 'rw' %} {% if perm.permission == 'rw' %}
@@ -123,10 +123,8 @@
{% if group_folder_perms %} {% if group_folder_perms %}
{% for perm in group_folder_perms %} {% for perm in group_folder_perms %}
<tr class="perm-item" data-group_id="{{ perm.group_id }}" data-path="{{ perm.path }}" data-perm="{{ perm.permission }}"> <tr class="perm-item" data-group_id="{{ perm.group_id }}" data-path="{{ perm.path }}" data-perm="{{ perm.permission }}">
<td><a href="{% url 'group_info' perm.group_id %}">{{ perm.group_name }}</a></td> <td><a href="{% url 'view_group' perm.group_id %}">{{ perm.group_name }}</a></td>
<td> <td><span><a href="{% url 'view_common_lib_dir' repo.id perm.path|urlencode|strip_slash %}">{{ perm.folder_name }}</a></span></td>
<span><a href="{{ perm.folder_link }}">{{ perm.folder_name }}</a></span>
</td>
<td> <td>
<div class="perm-change"> <div class="perm-change">
{% if perm.permission == 'rw' %} {% if perm.permission == 'rw' %}

View File

@@ -51,7 +51,7 @@
{% for link in uploadlinks %} {% for link in uploadlinks %}
<tr> <tr>
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
<td><a href="{% url 'repo' repo.id %}?p={{ link.path|urlencode }}">{{ link.dir_name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id link.path|urlencode|strip_slash %}">{{ link.dir_name }}</a></td>
<td><a href="{% url 'user_profile' link.username %}">{{ link.username|email2nickname }}</a></td> <td><a href="{% url 'user_profile' link.username %}">{{ link.username|email2nickname }}</a></td>
<td>--</td> <td>--</td>
<td>{{ link.view_cnt }}</td> <td>{{ link.view_cnt }}</td>
@@ -78,7 +78,7 @@
<tr> <tr>
{% if link.s_type == 'd'%} {% if link.s_type == 'd'%}
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
<td><a href="{% url 'repo' repo.id %}?p={{ link.path|urlencode }}">{{ link.filename }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id link.path|urlencode|strip_slash %}">{{ link.filename }}</a></td>
<td><a href="{% url 'user_profile' link.username %}">{{ link.username|email2nickname }}</a></td> <td><a href="{% url 'user_profile' link.username %}">{{ link.username|email2nickname }}</a></td>
{% else %} {% else %}
<td class="alc"><img src="{{ MEDIA_URL }}img/file/{{ link.filename|file_icon_filter }}" alt="{% trans "File"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/file/{{ link.filename|file_icon_filter }}" alt="{% trans "File"%}" /></td>

View File

@@ -10,7 +10,7 @@
{% if e.etype == "repo-update" %} {% if e.etype == "repo-update" %}
{% with repo=e.repo commit=e.commit %} {% with repo=e.repo commit=e.commit %}
<p class="w100 ovhd"> <p class="w100 ovhd">
<a href="{% url 'repo' repo.id %}" class="updated-repo normal fright">{{ repo.name }}</a> <a href="{% url 'view_common_lib_dir' repo.id '' %}" class="updated-repo normal fright">{{ repo.name }}</a>
<span class="cmt-desc"> <span class="cmt-desc">
{{ commit.converted_cmmt_desc|translate_commit_desc_escape|safe }} {{ commit.converted_cmmt_desc|translate_commit_desc_escape|safe }}
{% if commit.more_files %} {% if commit.more_files %}
@@ -26,7 +26,7 @@
{% endif %} {% endif %}
{% if e.etype == "repo-create" %} {% if e.etype == "repo-create" %}
<p>{% trans "Created library" %} <a href="{% url 'repo' e.repo_id %}" class="normal">{{ e.repo_name }}</a></p> <p>{% trans "Created library" %} <a href="{% url 'view_common_lib_dir' e.repo_id '' %}" class="normal">{{ e.repo_name }}</a></p>
{% endif %} {% endif %}
{% if e.etype == "repo-delete" %} {% if e.etype == "repo-delete" %}

View File

@@ -3,7 +3,7 @@
<p class="path fleft"> <p class="path fleft">
{% for name, link in zipped %} {% for name, link in zipped %}
{% if forloop.first or not forloop.last %} {% if forloop.first or not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}" class="dir-link normal">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}" class="dir-link normal">{{ name }}</a> /
{% else %} {% else %}
<span id="cur-dir-name" data-name="{{ name }}">{{ name }}</span> / <span id="cur-dir-name" data-name="{{ name }}">{{ name }}</span> /
{% endif %} {% endif %}

View File

@@ -46,7 +46,7 @@
{% for repo in repos %} {% for repo in repos %}
<tr> <tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td> <td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.id }}/">{{ repo.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id '' %}">{{ repo.name }}</a></td>
<td>{{ repo.size|filesizeformat }}</td> <td>{{ repo.size|filesizeformat }}</td>
<td><a href="{% url 'user_info' repo.user %}">{{ repo.user }}</a></td> <td><a href="{% url 'user_info' repo.user %}">{{ repo.user }}</a></td>
<td data-id="{{ repo.id }}" data-name="{{repo.name}}"> <td data-id="{{ repo.id }}" data-name="{{repo.name}}">

View File

@@ -27,7 +27,7 @@
</tr> </tr>
{% for repo in repos %} {% for repo in repos %}
<tr> <tr>
<td><a href="{% url 'repo' repo.id %}">{{ repo.props.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id '' %}">{{ repo.props.name }}</a></td>
<td style="font-size:11px;">{{ repo.id }}</td> <td style="font-size:11px;">{{ repo.id }}</td>
<td>{{ repo.props.desc }}</td> <td>{{ repo.props.desc }}</td>
</tr> </tr>

View File

@@ -84,7 +84,7 @@
{% for repo in owned_repos %} {% for repo in owned_repos %}
<tr> <tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td> <td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id '' %}">{{ repo.props.name }}</a></td>
<td>{{ repo.props.desc }}</td> <td>{{ repo.props.desc }}</td>
<td data-id="{{ repo.props.id }}" data-name="{{repo.name}}"> <td data-id="{{ repo.props.id }}" data-name="{{repo.name}}">
<div><a href="#" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}"><img src="{{MEDIA_URL}}img/rm.png" alt="" /></a></div> <div><a href="#" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}"><img src="{{MEDIA_URL}}img/rm.png" alt="" /></a></div>
@@ -110,7 +110,7 @@
{% for repo in in_repos %} {% for repo in in_repos %}
<tr> <tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="library icon" /></td> <td><img src="{{MEDIA_URL}}img/sync-folder-20.png?t=1387267140" title="{% trans "Read-Write" %}" alt="library icon" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.repo_name }}</a></td> <td><a href="{% url 'view_common_lib_dir' repo.id '' %}">{{ repo.props.repo_name }}</a></td>
<td>{{ repo.props.user }}</td> <td>{{ repo.props.user }}</td>
<td>{{ repo.props.repo_desc }}</td> <td>{{ repo.props.repo_desc }}</td>
</tr> </tr>

View File

@@ -10,7 +10,7 @@
{% trans "Current Path:" %} {% trans "Current Path:" %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{% url 'repo' repo.id %}?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{% url 'view_lib_file' repo.id link|urlencode %}">{{ name }}</a> <a href="{% url 'view_lib_file' repo.id link|urlencode %}">{{ name }}</a>
{% endif %} {% endif %}

View File

@@ -6,9 +6,9 @@
<h3>{% trans "Update file " %} <h3>{% trans "Update file " %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% trans "error: " %} {% trans "error: " %}

View File

@@ -5,7 +5,7 @@
<div class="narrow-panel"> <div class="narrow-panel">
<h3>{% trans "Upload file" %} {% if filename %} {{ filename }} {% endif %} {% trans "to" %} <h3>{% trans "Upload file" %} {% if filename %} {{ filename }} {% endif %} {% trans "to" %}
{% for name, link in zipped %} {% for name, link in zipped %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% endfor %} {% endfor %}
{% trans "error: " %} {% trans "error: " %}
</h3> </h3>

View File

@@ -34,7 +34,7 @@
{% trans "Current Path: "%} {% trans "Current Path: "%}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
{{ name }} {{ name }}
{% endif %} {% endif %}
@@ -324,7 +324,7 @@ $('#discuss-submit').click(function() {
$('#file-group-icon').click(function() { $('#file-group-icon').click(function() {
{% if groups|length == 1 %} {% if groups|length == 1 %}
{% for group in groups %} {% for group in groups %}
location.href= "{% url 'group_info' group.id %}"; location.href= "{% url 'view_group' group.id %}";
{% endfor %} {% endfor %}
{% else %} {% else %}

View File

@@ -93,6 +93,8 @@ urlpatterns = patterns('',
### lib (replace the old `repo` urls) ### ### lib (replace the old `repo` urls) ###
# url(r'^lib/(?P<repo_id>[-0-9a-f]{36})/dir/(?P<path>.*)$', view_lib_dir, name='view_lib_dir'), # url(r'^lib/(?P<repo_id>[-0-9a-f]{36})/dir/(?P<path>.*)$', view_lib_dir, name='view_lib_dir'),
url(r'^lib/(?P<repo_id>[-0-9a-f]{36})/file(?P<path>.*)$', view_lib_file, name='view_lib_file'), url(r'^lib/(?P<repo_id>[-0-9a-f]{36})/file(?P<path>.*)$', view_lib_file, name='view_lib_file'),
url(r'^#common/lib/(?P<repo_id>[-0-9a-f]{36})/(?P<path>.*)$', fake_view, name='view_common_lib_dir'),
url(r'^#group/(?P<group_id>\d+)/$', fake_view, name='view_group'),
# url(r'^home/my/lib/(?P<repo_id>[-0-9a-f]{36})/dir/(?P<path>.*)$', myhome_lib, name='myhome_lib'), # url(r'^home/my/lib/(?P<repo_id>[-0-9a-f]{36})/dir/(?P<path>.*)$', myhome_lib, name='myhome_lib'),
### share file/dir, upload link ### ### share file/dir, upload link ###

View File

@@ -1023,7 +1023,7 @@ def repo_history_revert(request, repo_id):
def fpath_to_link(repo_id, path, is_dir=False): def fpath_to_link(repo_id, path, is_dir=False):
"""Translate file path of a repo to its view link""" """Translate file path of a repo to its view link"""
if is_dir: 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: else:
href = reverse("view_lib_file", args=[repo_id, urllib2.quote(path.encode('utf-8'))]) 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)])) reverse('view_lib_file', args=[repo_id, '/' + urlquote(d.new_name)]))
elif d.status == 'newdir': elif d.status == 'newdir':
return HttpResponseRedirect( 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: else:
continue continue
@@ -2073,3 +2073,13 @@ def underscore_template(request, template):
return render_to_response(template, {}, return render_to_response(template, {},
context_instance=RequestContext(request)) 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

View File

@@ -415,13 +415,12 @@ def _file_view(request, repo_id, path):
img_prev = posixpath.join(parent_dir, img_list[cur_img_index - 1]) img_prev = posixpath.join(parent_dir, img_list[cur_img_index - 1])
if cur_img_index != len(img_list) - 1: if cur_img_index != len(img_list) - 1:
img_next = posixpath.join(parent_dir, img_list[cur_img_index + 1]) img_next = posixpath.join(parent_dir, img_list[cur_img_index + 1])
template = 'view_file_%s.html' % ret_dict['filetype'].lower() template = 'view_file_%s.html' % ret_dict['filetype'].lower()
else: else:
ret_dict['err'] = err_msg ret_dict['err'] = err_msg
template = 'view_file_base.html' template = 'view_file_base.html'
# generate file path navigator # generate file path navigator
zipped = gen_path_link(path, repo.name) zipped = gen_path_link(path, repo.name)

View File

@@ -26,6 +26,7 @@ define([
'org/': 'showOrgRepos', 'org/': 'showOrgRepos',
'org/lib/:repo_id(/*path)': 'showOrgRepoDir', 'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
'common/lib/:repo_id(/*path)': 'showCommonDir',
// Default // Default
'*actions': 'defaultAction' '*actions': 'defaultAction'
}, },
@@ -81,6 +82,16 @@ define([
this.myHomeView.showDir('my-libs', repo_id, path); 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) { showMySubRepoDir: function(repo_id, path) {
if (path) { if (path) {
path = '/' + path; path = '/' + path;

View File

@@ -226,6 +226,8 @@ define([
context = 'org'; context = 'org';
} else if (category_start == 'group') { } else if (category_start == 'group') {
context = 'group'; context = 'group';
} else if (category_start == 'common') {
context = 'common';
} }
var obj = { var obj = {
path: path, path: path,