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

Modify share link view

This commit is contained in:
xiez 2012-06-20 21:38:07 +08:00
parent 9c4a54931f
commit 05f709a1a2
4 changed files with 15 additions and 19 deletions

View File

@ -50,7 +50,7 @@
{% else %}
<td>已过期</td>
{% endif %}
<td><a class="op" href="#" class="view-link" data="{{ link.token }}">查看链接</a>
<td><a href="#" class="op view-link" data="{{ link.token }}">查看链接</a>
<a class="op" href="{{ SITE_ROOT }}share/remove/{{ link.token }}/">删除</a></td>
</tr>
{% endfor %}
@ -58,9 +58,9 @@
</table>
{% endif %}
<form id="view-link-form" name="view-link-form" class="hide">
<textarea id="share-link" name="share-link"></textarea>
</form>
<div id="view-link" name="view-link" class="hide">
<p><span class="view-link-alert" style="float:left; margin-left: 120px; "></span></p>
</div>
{% endblock %}
@ -80,10 +80,11 @@ $("table tr:gt(0)").hover(
);
$(".view-link").click(function() {
var t = $(this).attr('data');
var l = '{{ protocol }}://' + '{{ domain }}{{ SITE_ROOT }}share/' + t + '/';
$('textarea[name="share-link"]').val(l);
$("#view-link-form").modal({appendTo: "#main", containerCss:{padding:18}});
$('.view-link-alert').text("共享链接为:" + l);
$("#view-link").modal({appendTo: "#main", containerCss:{padding:18}});
return false;
});

View File

@ -87,16 +87,6 @@ def share_repo(request):
messages.add_message(request, messages.INFO, to_email)
except SearpcError, e:
messages.add_message(request, messages.ERROR, to_email)
# else:
# # add email to contacts if not in contacts list
# # TODO: condition should be removed
# if from_email != to_email and Contact.objects.filter(user_email=from_email, contact_email=to_email).count() = 0:
# contact = Contact()
# contact.user_email = from_email
# contact.contact_email = to_email
# contact.contact_name = ''
# contact.note = ''
# contact.save()
else:
# share repo to anonymous user
kwargs = {'repo_id': repo_id,

View File

@ -24,7 +24,11 @@
{% if not repo.props.encrypted or password_set %}
{% if can_access %}
<div class="latest-commit">
<h3>最新修改<a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/" class="more">(更多)</a></h3>
<h3>最新修改
{% if request.user.is_authenticated %}
<a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/" class="more">(更多)</a>
{% endif %}
</h3>
<p>{{ latest_commit.props.desc|translate_commit_desc }}</p>
<p class="al-rt">
<span class="author">by

View File

@ -252,10 +252,10 @@ def repo(request, repo_id):
return render_repo(request, repo_id)
@login_required
def repo_history(request, repo_id):
"""
If repo is public, anyone can view repo history;
If repo is not public, only persons who repo is share to can view.
View repo history
"""
repo_ap = seafserv_threaded_rpc.repo_query_access_property(repo_id)
if not repo_ap:
@ -310,6 +310,7 @@ def repo_history(request, repo_id):
'is_owner': is_owner,
}, context_instance=RequestContext(request))
@login_required
def repo_history_dir(request, repo_id):
# get repo web access property, if no repo access property in db, then
# assume repo ap is 'own'