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

Merge pull request #1320 from haiwen/side-nav-fix

[side nav] group list: fix
This commit is contained in:
Daniel Pan
2016-08-19 18:09:18 +08:00
committed by GitHub
4 changed files with 20 additions and 65 deletions

View File

@@ -1,63 +0,0 @@
{% extends "home_base.html" %}
{% load seahub_tags i18n %}
{% block sub_title %}{% trans "Stars" %} - {% endblock %}
{% block cur_stars %}tab-cur{% endblock %}
{% block right_panel %}
<h3 class="hd">{% trans "Starred" %}</h3>
{% if starred_files %}
<table>
<tr>
<th width="5%"></th>
<th width="40%">{% trans "File Name" %}</th>
<th width="32%">{% trans "Library" %}</th>
<th width="18%">{% trans "Last Update" %}</th>
<th width="5%"></th>
</tr>
{% for sfile in starred_files %}
<tr>
<td class="alc"><img src="{{ MEDIA_URL }}img/file/{{ sfile.path|file_icon_filter }}" alt="{% trans "icon" %}" /></td>
<td>
<a href="{% url 'view_lib_file' sfile.repo.id sfile.path %}">{{ sfile.name }}</a>
</td>
<td>{{ sfile.repo.name }}</td>
<td>{{ sfile.last_modified|translate_seahub_time }}</td>
<td>
<span data-repoid="{{sfile.repo.id}}" data-path="{{sfile.path}}" class="sf2-icon-delete unstar op-icon vh" title="{% trans "Unstar" %}"></span>
</td>
</tr>
{% endfor %}
</table>
{% else %}
<div class="empty-tips">
<h2 class="alc">{% trans "You don't have any starred files yet" %}</h2>
<p>{% blocktrans %}You can star important files by clicking the "Star" button on file viewing page, and they will be listed here.{% endblocktrans %}</p>
</div>
{% endif %}
{% endblock %}
{% block extra_script %}{{block.super}}
<script type="text/javascript">
$('.unstar').click(function() {
var op = $(this),
file_ele = op.parents('tr'),
repo_id = op.data('repoid'),
path = op.data('path');
$.ajax({
url: '{{SITE_ROOT}}ajax/repo/' + repo_id + '/file/unstar/?file=' + e(path),
cache: false,
dataType: 'json',
success:function(data) {
if (data['success']) {
file_ele.remove();
feedback("{% trans 'Successfully unstarred.' %}", "success");
}
},
error: ajaxErrorHandler
});
});
</script>
{% endblock %}

View File

@@ -801,6 +801,9 @@ def libraries(request):
else:
joined_groups = seaserv.get_personal_groups_by_user(username)
if joined_groups:
joined_groups.sort(lambda x, y: cmp(x.group_name.lower(), y.group_name.lower()))
return render_to_response('libraries.html', {
"allow_public_share": allow_public_share,
"guide_enabled": guide_enabled,

View File

@@ -54,6 +54,9 @@ def personal_wiki(request, page_name="home"):
else:
joined_groups = seaserv.get_personal_groups_by_user(username)
if joined_groups:
joined_groups.sort(lambda x, y: cmp(x.group_name.lower(), y.group_name.lower()))
wiki_exists = True
try:
content, repo, dirent = get_personal_wiki_page(username, page_name)
@@ -114,8 +117,19 @@ def personal_wiki_pages(request):
"""
List personal wiki pages.
"""
username = request.user.username
if request.cloud_mode and request.user.org is not None:
org_id = request.user.org.org_id
joined_groups = seaserv.get_org_groups_by_user(org_id, username)
else:
joined_groups = seaserv.get_personal_groups_by_user(username)
if joined_groups:
joined_groups.sort(lambda x, y: cmp(x.group_name.lower(), y.group_name.lower()))
try:
username = request.user.username
repo = get_personal_wiki_repo(username)
pages = get_wiki_pages(repo)
except SearpcError:
@@ -128,6 +142,7 @@ def personal_wiki_pages(request):
"repo_id": repo.id,
"search_repo_id": repo.id,
"search_wiki": True,
"grps": joined_groups,
}, context_instance=RequestContext(request))

View File

@@ -25,7 +25,7 @@ define([
'show_group_list': this.group_expanded, // when cur_tab is not 'group'
'groups': app.pageOptions.groups,
'mods_enabled': app.pageOptions.user_mods_enabled,
'can_add_repo': app.pageOptions.can_add_repo,
'can_add_repo': app.pageOptions.can_add_repo
};
var _this = this;
$('#js-toggle-side-nav').click(function() {