mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 08:28:11 +00:00
Move share repos to myhome page
This commit is contained in:
@@ -34,22 +34,23 @@
|
||||
<p>暂无</p>
|
||||
{% endif %}
|
||||
|
||||
<h3>我获取的同步目录</h3>
|
||||
{% if fetched_repos %}
|
||||
<h3>共享给我的同步目录</h3>
|
||||
{% if in_repos %}
|
||||
<table class="repo-list">
|
||||
<tr>
|
||||
<th width="30%">名字</th>
|
||||
<th width="50%">描述</th>
|
||||
<th width="20%">操作</th>
|
||||
<th width="20%">共享来源</th>
|
||||
<th width="35%">描述</th>
|
||||
<th width="15%">操作</th>
|
||||
</tr>
|
||||
|
||||
{% for repo in fetched_repos %}
|
||||
{% for repo in in_repos %}
|
||||
<tr>
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
|
||||
<td>{{ repo.props.shared_email }}</td>
|
||||
<td>{{ repo.props.desc }}</td>
|
||||
<td>
|
||||
<button data="{{ SITE_ROOT }}download/repo/?repo_id={{ repo.props.id }}" class="download-btn">下载</button>
|
||||
<button data="{{ SITE_ROOT }}repo/removefetched/{{ repo.userid }}/{{ repo.props.id }}/" class="repo-delete-btn">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@@ -27,30 +27,6 @@
|
||||
<p>暂无</p>
|
||||
{% endif %}
|
||||
|
||||
<h3>共享给我的同步目录</h3>
|
||||
{% if in_repos %}
|
||||
<table class="repo-list">
|
||||
<tr>
|
||||
<th width="12%">名字</th>
|
||||
<th width="33%">共享来源</th>
|
||||
<th width="40%">描述</th>
|
||||
<th width="15%">操作</th>
|
||||
</tr>
|
||||
|
||||
{% for repo in in_repos %}
|
||||
<tr>
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
|
||||
<td>{{ repo.props.shared_email }}</td>
|
||||
<td>{{ repo.props.desc }}</td>
|
||||
<td>
|
||||
<button data="{{ SITE_ROOT }}download/repo/?repo_id={{ repo.props.id }}" class="download-btn">下载</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>暂无</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
|
22
views.py
22
views.py
@@ -259,7 +259,7 @@ def remove_fetched_repo(request, user_id, repo_id):
|
||||
@login_required
|
||||
def myhome(request):
|
||||
owned_repos = []
|
||||
fetched_repos = []
|
||||
# fetched_repos = []
|
||||
quota_usage = 0
|
||||
|
||||
userid_list = get_binding_userids(request.user.username)
|
||||
@@ -268,18 +268,22 @@ def myhome(request):
|
||||
owned_repos.extend(seafserv_threaded_rpc.list_owned_repos(user_id))
|
||||
quota_usage = quota_usage + seafserv_threaded_rpc.get_user_quota_usage(user_id)
|
||||
|
||||
frepos = seafserv_threaded_rpc.list_fetched_repos(user_id)
|
||||
for repo in frepos:
|
||||
repo.userid = user_id # associate a fetched repo with the user id
|
||||
|
||||
fetched_repos.extend(frepos)
|
||||
# frepos = seafserv_threaded_rpc.list_fetched_repos(user_id)
|
||||
# for repo in frepos:
|
||||
# repo.userid = user_id # associate a fetched repo with the user id
|
||||
#
|
||||
# fetched_repos.extend(frepos)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Repos that are share to me
|
||||
in_repos = seafserv_threaded_rpc.list_share_repos(request.user.username, 'to_email', -1, -1)
|
||||
|
||||
return render_to_response('myhome.html', {
|
||||
"owned_repos": owned_repos,
|
||||
"quota_usage": quota_usage,
|
||||
"fetched_repos": fetched_repos,
|
||||
# "fetched_repos": fetched_repos,
|
||||
"in_repos": in_repos,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
@@ -390,11 +394,11 @@ def repo_list_share(request):
|
||||
username = request.user.username
|
||||
|
||||
out_repos = seafserv_threaded_rpc.list_share_repos(username, 'from_email', -1, -1)
|
||||
in_repos = seafserv_threaded_rpc.list_share_repos(username, 'to_email', -1, -1)
|
||||
# in_repos = seafserv_threaded_rpc.list_share_repos(username, 'to_email', -1, -1)
|
||||
|
||||
return render_to_response('share_repos.html', {
|
||||
"out_repos": out_repos,
|
||||
"in_repos": in_repos,
|
||||
# "in_repos": in_repos,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
|
Reference in New Issue
Block a user