mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-17 14:37:58 +00:00
67 lines
2.4 KiB
HTML
67 lines
2.4 KiB
HTML
{% load seahub_tags avatar_tags i18n %}
|
|
//repo-share-form share-list autocomplete
|
|
var share_list = [], contact_email, group_name, group_name_py;
|
|
{% for contact in contacts %}
|
|
contact_email = '{{ contact.contact_email }}';
|
|
share_list.push({value:contact_email, label:contact_email});
|
|
{% endfor %}
|
|
|
|
{% for group in groups %}
|
|
group_name = '{{ group.group_name }}';
|
|
group_name_py = '{{ group.group_name|char2pinyin }}'
|
|
share_list.push({value:group_name + group_name_py, label:group_name});
|
|
{% endfor %}
|
|
|
|
$(".repo-share-btn").click(function() {
|
|
$("#repo_id").val($(this).data("id"));
|
|
$("#repo-share-form .op-target").html($(this).data("name"));
|
|
$("#repo-share-form").modal({appendTo: "#main", focus:false});
|
|
$('#repo-share-tabs').tabs();
|
|
$('#simplemodal-container').css('height', 'auto');
|
|
addAutocomplete('#email_or_group', '#repo-share-form', share_list);
|
|
});
|
|
|
|
//check before post
|
|
$('#share-submit-btn').click(function() {
|
|
var cur_tab_id = $('#repo-share-tabs-nav .ui-tabs-selected a').attr('href');
|
|
var post_data = '';
|
|
switch(cur_tab_id) {
|
|
case '#share-enter':
|
|
post_data = $('#email_or_group').val();
|
|
break;
|
|
case '#share-grp-options':
|
|
case '#share-contact-options':
|
|
$(cur_tab_id + ' .checkbox-checked .checkbox-orig').each(function() {
|
|
post_data += $(this).val() + ',';
|
|
});
|
|
$('#email_or_group').val(post_data);
|
|
}
|
|
if (!post_data) {
|
|
apply_form_error('repo-share-form', '{% trans "Please enter emails or groups or select some at first." %}');
|
|
return false;
|
|
}
|
|
$("#repo-share-form").submit();
|
|
disable($(this));
|
|
});
|
|
|
|
$('.unshare-btn').click(function() {
|
|
location.href = $(this).data('url');
|
|
});
|
|
addConfirmTo($('.repo-delete-btn'), {
|
|
'title':'{% trans "Delete Library" %}',
|
|
'con':'{% trans "Are you sure you want to delete %s ?" %}'
|
|
});
|
|
|
|
$(".download-btn").click(function() {
|
|
window.open('{{ SITE_ROOT }}seafile_access_check/?repo_id=' + $(this).attr('data'));
|
|
});
|
|
|
|
$("table tr:gt(0)").hover(
|
|
function() {
|
|
$(this).find('.op-icon').css('cursor', 'pointer').removeClass('vh');
|
|
},
|
|
function() {
|
|
$(this).find('.op-icon').addClass('vh');
|
|
}
|
|
);
|