1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 04:25:47 +00:00

Merge pull request #1072 from haiwen/upgrade_jquery

[non backbone] upgrade jquery.js, bugfix for some pages
This commit is contained in:
Daniel Pan 2016-03-18 18:21:47 +08:00
commit fbfa175ece
11 changed files with 205 additions and 372 deletions

View File

@ -294,6 +294,9 @@ td, th { padding:5px 3px; word-wrap:break-word; border-bottom:1px solid #eee; }
td { color: #333; font-size:14px; }
table img { vertical-align:middle; }
p { margin:0.5em 0; }
:focus {/* to overwrite user agent stylesheet */
outline:none;
}
/********** common class ***********/
.hl { background-color: #f8f8f8; }/*highlight*/

View File

@ -218,17 +218,6 @@ $('#logout').click(function() {
}
}
});
if ($.browser.mozilla || $.browser.msie) {
$('a').focus(function() {
$(this).blur();
});
}
if ($.browser.msie) {
$('button, input[type="checkbox"], input[type="radio"], input[type="submit"]').focus(function() {
$(this).blur();
});
$('.search-input').css({'line-height':$('.search-input').css('height')});
}
/*
* add confirm to an operation, using a popup

169
media/js/jq.min.js vendored

File diff suppressed because one or more lines are too long

5
media/js/jquery-1.12.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,8 @@
{% endif %}
{% else %}
<img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" height="20" class="vam" />
<a href="{% url 'repo' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="vam">{{ ma.name }}</a>
<!--a href="{% url 'view_common_lib_dir' ma.repo_id ma.path %}" target="_blank" class="vam">{{ ma.name }}</a-->
<span class="vam">{{ ma.name }}</span>
{% endif %}
{% endif %}

View File

@ -1,4 +1,4 @@
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
{% load seahub_tags avatar_tags group_avatar_tags i18n staticfiles %}
{% load url from future %}
<!DOCTYPE html>
@ -144,7 +144,10 @@
{% include 'footer.html' %}
</div><!-- wrapper -->
<script type="text/javascript" src="{{ MEDIA_URL }}js/jq.min.js?t=1398068110"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-1.12.1.min.js"></script>
<script type="text/javascript" src="{% static "scripts/lib/jquery.simplemodal.js" %}"></script>
<script type="text/javascript" src="{% static "scripts/lib/jquery.ui.tabs.js" %}"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jq.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/base.js?t=1404370380"></script>
<script type="text/javascript">
$.jstree._themes = '{{ MEDIA_URL }}js/themes/';

View File

@ -32,8 +32,8 @@
<div id="tabs" class="tab-tabs">
<div class="hd ovhd">
<ul class="tab-tabs-nav fleft">
<li class="tab"><a href="#user-tab" class="a" id="user-tab">{% trans "User Permission" %}</a></li>
<li class="tab"><a href="#group-tab" class="a" id="group-tab">{% trans "Group permission" %}</a></li>
<li class="tab"><a href="#user-tab" class="a" id="user-tab-nav">{% trans "User Permission" %}</a></li>
<li class="tab"><a href="#group-tab" class="a" id="group-tab-nav">{% trans "Group permission" %}</a></li>
</ul>
<div class="fright">
<button id="folder-perm-add-btn"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "Add Permission" %}</span></button>
@ -66,21 +66,19 @@
</tr>
{% if 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 data-type="user" 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><span><a href="{% url 'view_common_lib_dir' repo.id perm.path|urlencode|strip_slash %}">{{ perm.folder_name }}</a></span></td>
<td>
<div class="perm-change">
{% if perm.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon op-icon sf2-icon-edit vh"></span>
</div>
{% if perm.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon op-icon sf2-icon-edit vh"></span>
<select class="perm-toggle-select hide">
<option value="rw" {%if perm.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Write" %}</option>
<option value="r" {%if not perm.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Only"%}</option>
<option value="rw" {% if perm.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Write" %}</option>
<option value="r" {% if perm.permission == 'r' %}selected="selected"{% endif %}>{% trans "Read-Only"%}</option>
</select>
</td>
<td>
@ -102,8 +100,7 @@
</tr>
<tr class="group-perm-add-tr hide">
<td>
<input id="perm-add-grp-name" placeholder="{% trans "Group"%}" type="text" />
<input id="perm-add-grp-id" type="hidden" />
<select name="group" class="w100" multiple="multiple"></select>
</td>
<td>
<input class="group-perm-add-folder-name" placeholder="{% trans "Select a folder"%}" /><img src="{{ MEDIA_URL }}img/add.png" alt="" title="Select a folder" class="perm-add-select-folder add vam" />
@ -111,8 +108,8 @@
</td>
<td>
<select name="permission" class="group-perm-add-perm w100">
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
<option value="r">{% trans "Read-Only"%}</option>
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
<option value="r">{% trans "Read-Only"%}</option>
</select>
</td>
<td>
@ -121,18 +118,16 @@
</tr>
{% if 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 data-type="group" data-groupid="{{ perm.group_id }}" data-path="{{ perm.path }}" data-perm="{{ perm.permission }}">
<td><a href="{% url 'view_group' perm.group_id %}">{{ perm.group_name }}</a></td>
<td><span><a href="{% url 'view_common_lib_dir' repo.id perm.path|urlencode|strip_slash %}">{{ perm.folder_name }}</a></span></td>
<td>
<div class="perm-change">
{% if perm.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon op-icon sf2-icon-edit vh"></span>
</div>
{% if perm.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon op-icon sf2-icon-edit vh"></span>
<select class="perm-toggle-select hide">
<option value="rw" {%if perm.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Write" %}</option>
<option value="r" {%if not perm.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Only"%}</option>
@ -161,30 +156,18 @@
{% block extra_script %}
<script type="text/javascript" src="{% static "scripts/lib/select2-3.5.2.js" %}"></script>
<script type="text/javascript">
{% include "repo_setting_extra_js.html" %}
var user_perm_add_tr = $('.user-perm-add-tr'),
group_perm_add_tr = $('.group-perm-add-tr');
$('#user-tab').click(function() {
group_perm_add_tr.addClass('hide');
});
$('#group-tab').click(function() {
user_perm_add_tr.addClass('hide');
});
var group_list = [], group_name, group_id,
user_input = $('#perm-add-user'),
group_input = $('#perm-add-grp-name');
var g_opts = '';
{% for group in request.user.joined_groups %}
group_name = '{{ group.group_name }}';
group_id = '{{ group.id }}';
group_list.push({value:group_id, label:group_name});
g_opts += '<option value="' + '{{ group.id}}'+ '" data-index="' + '{{forloop.counter0}}' + '">' + '{{ group.group_name}}' + '</option>';
{% endfor %}
var user_input = $('#perm-add-user'),
group_input = $('[name="group"]', group_perm_add_tr);
user_input.select2($.extend({
width: '270px',
placeholder: "{% trans "Search users or enter emails" %}",
formatInputTooShort: "{% trans "Please enter 1 or more character" %}",
formatNoMatches: "{% trans "No matches" %}",
@ -192,64 +175,110 @@ user_input.select2($.extend({
formatAjaxError: "{% trans "Loading failed" %}"
}, userInputOPtionsForSelect2('{% url 'search-user' %}')));
group_input.bind('autocompleteopen', function(e, ui) {
var widget = group_input.autocomplete('widget');
widget.css({'max-width':group_input.width() + 2 * parseInt(widget.css('padding-top')), 'max-height':$(window).height() + $(window).scrollTop() - group_input.offset().top - group_input.outerHeight()});
})
.autocomplete({
source: group_list,
select: function(event, ui) {
// prevent autocomplete from updating the textbox
event.preventDefault();
// manually update the textbox and hidden field
group_input.val(ui.item.label);
$('#perm-add-grp-id').val(ui.item.value);
}
});
group_input.html(g_opts).select2({
placeholder: "{% trans "Group" %}",
maximumSelectionSize: 1,
formatSelectionTooBig: "{% trans "You can only select 1 item" %}",
formatNoMatches: "{% trans "No matches" %}",
escapeMarkup: function(m) { return m; }
});
// show/hide 'add perm'
$('#folder-perm-add-btn').click(function() {
if (is_user_tab == true) {
if ($('#user-tab:visible').length) { // cur tab is '#user-tab'
user_perm_add_tr.removeClass('hide');
$('.user-perm-add-folder-name').val('');
user_input.val('');
user_input.select2('val', '');
} else {
group_perm_add_tr.removeClass('hide');
$('.group-perm-add-folder-name').val('');
group_input.focus().val('');
group_input.select2('val', '');
}
});
$('#user-tab-nav').click(function() {
group_perm_add_tr.addClass('hide');
});
$('#group-tab-nav').click(function() {
user_perm_add_tr.addClass('hide');
});
// edit perm
$('.perm-edit-icon').click(function() {
// handle other 'edit' at first
$('.perm-cur-value, .perm-edit-icon').removeClass('hide');
$('.perm-toggle-select').addClass('hide');
var $td = $(this).parent();
$('.perm-cur-value, .perm-edit-icon', $td).addClass('hide');
$('.perm-toggle-select', $td).removeClass('hide');
});
$('.perm-toggle-select').on('change', function() {
var select = $(this),
perm_item = select.parents('.perm-item'),
path = perm_item.attr('data-path'),
perm = select.val();
var $el = $(this),
$tr = $el.closest('tr');
var perm_type = $tr.data('type');
var post_data = {
path: $tr.data('path'),
perm: $el.val(),
type: 'modify'
};
var url;
if (is_user_tab == true) {
var user = perm_item.attr('data-user'),
data = {'user': user, 'path': path, 'perm': perm, 'type': 'modify'},
url = '{% url 'set_user_folder_perm' repo.id %}';
if (perm_type == 'user') {
$.extend(post_data, { user: $tr.attr('data-user') });
url = '{% url 'set_user_folder_perm' repo.id %}';
} else {
var group_id = perm_item.attr('data-group_id'),
data = {'group_id': group_id, 'path': path, 'perm': perm, 'type': 'modify'},
url = '{% url 'set_group_folder_perm' repo.id %}';
$.extend(post_data, { group_id: $tr.attr('data-groupid') });
url = '{% url 'set_group_folder_perm' repo.id %}';
}
perm_toggle(select, data, url)
});
$('.perm-delete-btn').on('click', function() {
var perm_item = $(this).parents('.perm-item'),
perm = perm_item.attr('data-perm'),
path = perm_item.attr('data-path');
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
cache: false,
beforeSend: prepareCSRFToken,
data: post_data,
success: function() {
var $td = $el.parent();
$el.addClass('hide');
$('.perm-edit-icon', $td).removeClass('hide');
$('.perm-cur-value', $td)
.html($('[value="' + $el.val() + '"]', $el).text())
.removeClass('hide');
if (is_user_tab == true) {
var user = perm_item.attr('data-user'),
data = {'user': user, 'path': path, 'perm': perm, 'type': 'delete'},
url = '{% url 'set_user_folder_perm' repo.id %}';
feedback("{% trans "Success" %}", 'success');
},
error: ajaxErrorHandler
});
});
$(document).on('click', function(e) {
var target = e.target || event.srcElement;
if ($('.perm-toggle-select:visible').length > 0 &&
!$('.perm-edit-icon, .perm-toggle-select').is(target)) {
$('.perm-cur-value, .perm-edit-icon').removeClass('hide');
$('.perm-toggle-select').addClass('hide');
}
});
// rm perm
$('.perm-delete-btn').on('click', function() {
var $el = $(this),
$tr = $el.closest('tr');
var perm_type = $tr.data('type');
var post_data = {
path: $tr.data('path'),
perm: $tr.data('perm'),
type: 'delete'
};
var url;
if (perm_type == 'user') {
$.extend(post_data, { user: $tr.attr('data-user') });
url = '{% url 'set_user_folder_perm' repo.id %}';
} else {
var group_id = perm_item.attr('data-group_id'),
data = {'group_id': group_id, 'path': path, 'perm': perm, 'type': 'delete'},
url = '{% url 'set_group_folder_perm' repo.id %}';
$.extend(post_data, { group_id: $tr.attr('data-groupid') });
url = '{% url 'set_group_folder_perm' repo.id %}';
}
$.ajax({
@ -258,17 +287,19 @@ $('.perm-delete-btn').on('click', function() {
cache: false,
dataType: 'json',
beforeSend: prepareCSRFToken,
data: data,
data: post_data,
success: function() {
perm_item.remove();
$tr.remove();
feedback("{% trans "Delete succeeded" %}", 'success');
},
error: ajaxErrorHandler
});
});
// add perm
$('.perm-add-submit').click(function() {
var path, perm, data, url;
if (is_user_tab == true) {
if ($('#user-tab:visible').length) {
var user = user_input.val();
path = $('.user-perm-add-folder-path').val();
if (!user || !path) {
@ -279,14 +310,14 @@ $('.perm-add-submit').click(function() {
data = {'user': user, 'path': path, 'perm': perm, 'type': 'add'};
url = '{% url 'set_user_folder_perm' repo.id %}';
} else {
var group_id = $('#perm-add-grp-id').val();
var group = group_input.val(); // null or [group_id]
path = $('.group-perm-add-folder-path').val();
if (!group_id || !path) {
if (!group || !path) {
return false;
}
perm = $('.group-perm-add-perm').val();
data = {'group_id': group_id, 'path': path, 'perm': perm, 'type': 'add'};
data = {'group_id': group[0], 'path': path, 'perm': perm, 'type': 'add'};
url = '{% url 'set_group_folder_perm' repo.id %}';
}
@ -314,7 +345,7 @@ function selectClickHandler(event) {
var path, folder_name, folder_path,
path_array = event.data.path_array;
if (is_user_tab == true) {
if ($('#user-tab:visible').length) {
folder_name = $('.user-perm-add-folder-name');
folder_path = $('.user-perm-add-folder-path');
} else {

View File

@ -1,58 +0,0 @@
{% load i18n %}
var cur_tab = $('.ui-tabs-selected .a');
if (cur_tab.attr('id') == 'user-tab') {
var is_user_tab = new Boolean(true);
} else {
var is_user_tab = new Boolean(false);
}
$('#user-tab').click(function() {
is_user_tab = new Boolean(true);
});
$('#group-tab').click(function() {
is_user_tab = new Boolean(false);
});
$('.perm-item').on({
mouseenter: function() {
var perm_item = $(this);
perm_item.find('.perm-edit-icon').removeClass('vh');
perm_item.find('.perm-delete-btn').removeClass('vh');
},
mouseleave: function() {
var perm_item = $(this);
perm_item.find('.perm-edit-icon').addClass('vh');
perm_item.find('.perm-delete-btn').addClass('vh');
}
});
$('.perm-edit-icon').on('click', function() {
$(this).parent().addClass('hide')
.next().removeClass('hide');
});
function perm_toggle(select, data, url) {
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
cache: false,
beforeSend: prepareCSRFToken,
data: data,
success: function(data) {
select.addClass('hide')
.prev().removeClass('hide')
.children('span')
.html(select.children('option[value="' + select.val() + '"]').text());
feedback("{% trans "Success" %}", 'success');
},
error: ajaxErrorHandler
});
}
$(document).on('click', function(e) {
var target = e.target || event.srcElement;
if (!$('.perm-edit-icon, .perm-toggle-select').is(target)) {
$('.perm-change').removeClass('hide');
$('.perm-toggle-select').addClass('hide');
}
});

View File

@ -35,8 +35,8 @@
<div id="tabs" class="tab-tabs">
<div class="hd ovhd">
<ul class="tab-tabs-nav fleft">
<li class="tab"><a href="#user-tab" class="a" id="user-tab">{% trans "User" %}</a></li>
<li class="tab"><a href="#group-tab" class="a" id="group-tab">{% trans "Group" %}</a></li>
<li class="tab"><a href="#user-tab" class="a">{% trans "User" %}</a></li>
<li class="tab"><a href="#group-tab" class="a">{% trans "Group" %}</a></li>
</ul>
<div class="fright">
<button class="repo-share-btn"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "Share Library" %}</span></button>
@ -52,17 +52,15 @@
</tr>
{% if repo_share_user %}
{% for share in repo_share_user %}
<tr class="perm-item" data-to_user="{{ share.user }}">
<tr data-type="user" data-user="{{ share.user }}">
<td><a href="{% url 'user_profile' share.user %}">{{ share.user }}</a></td>
<td>
<div class="perm-change">
{% if share.permission == 'rw' %}
<span class="share-perm-cur-value">{% trans "Read-Write" %}</span>
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="share-perm-cur-value">{% trans "Read-Only" %}</span>
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon sf2-icon-edit op-icon vh"></span>
</div>
<select class="perm-toggle-select hide">
<option value="rw" {%if share.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Write" %}</option>
<option value="r" {%if not share.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Only"%}</option>
@ -85,17 +83,15 @@
</tr>
{% if repo_share_group %}
{% for share in repo_share_group %}
<tr class="perm-item" data-group_id="{{ share.group_id }}">
<tr data-type="group" data-groupid="{{ share.group_id }}">
<td><a href="{% url 'group_info' share.group_id%}">{{ share.group_name }}</a></td>
<td>
<div class="perm-change">
{% if share.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon sf2-icon-edit op-icon vh"></span>
</div>
{% if share.permission == 'rw' %}
<span class="perm-cur-value">{% trans "Read-Write" %}</span>
{% else %}
<span class="perm-cur-value">{% trans "Read-Only" %}</span>
{% endif %}
<span title="{% trans "Edit"%}" class="perm-edit-icon sf2-icon-edit op-icon vh"></span>
<select class="perm-toggle-select hide">
<option value="rw" {%if share.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Write" %}</option>
<option value="r" {%if not share.permission == 'rw' %}selected="selected"{% endif %}>{% trans "Read-Only"%}</option>
@ -139,11 +135,11 @@ g_opts += '<option value="' + '{{ group.id}}'+ '" data-index="' + '{{forloop.cou
{% endfor %}
$(".repo-share-btn").click(function() {
var form = $('#dir-private-share');
form.modal({appendTo: "#main", focus:false});
var $form = $('#dir-private-share');
$form.modal({appendTo: "#main", focus:false});
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
$('[name="emails"]', $('#dir-private-share')).select2($.extend({
$('[name="emails"]', $form).select2($.extend({
placeholder: "{% trans "Search users or enter emails" %}",
width: '400px',
formatInputTooShort: "{% trans "Please enter 1 or more character" %}",
@ -153,7 +149,7 @@ $(".repo-share-btn").click(function() {
formatSelectionTooBig: "{% trans "You cannot select any more choices" %}"
}, userInputOPtionsForSelect2('{% url 'search-user' %}')));
$('[name="groups"]', $('#dir-private-share')).html(g_opts).select2({
$('[name="groups"]', $form).html(g_opts).select2({
placeholder: "{% trans "Select groups" %}",
width: '400px',
formatNoMatches: "{% trans "No matches" %}",
@ -187,7 +183,7 @@ $('.submit', $('#dir-private-share')).click(function() {
url: '{% url 'ajax_private_share_dir' %}',
type: 'POST',
dataType: 'json',
cache: 'false',
cache: false,
beforeSend: prepareCSRFToken,
data: post_data,
success: function(data) {
@ -199,24 +195,56 @@ $('.submit', $('#dir-private-share')).click(function() {
return false;
});
{% include "repo_setting_extra_js.html" %}
$('.perm-edit-icon').click(function() {
// handle other 'edit' at first
$('.perm-cur-value, .perm-edit-icon').removeClass('hide');
$('.perm-toggle-select').addClass('hide');
var $td = $(this).parent();
$('.perm-cur-value, .perm-edit-icon', $td).addClass('hide');
$('.perm-toggle-select', $td).removeClass('hide');
});
$('.perm-toggle-select').on('change', function() {
var select = $(this),
perm_item = select.parents('.perm-item'),
perm = select.val();
var $el = $(this),
$tr = $el.closest('tr');
var perm_type = $tr.data('type'),
share_type = perm_type == 'user' ? 'personal': 'group',
url = '{% url 'share_permission_admin' %}?share_type=' + share_type,
post_data = {
repo_id: '{{repo.id}}',
email_or_group: perm_type == 'user' ? $tr.attr('data-user') : $tr.attr('data-groupid'),
permission: $el.val()
};
if (is_user_tab == true) {
var to_user = perm_item.attr('data-to_user'),
data = { repo_id: '{{repo.id}}', email_or_group: to_user, permission: perm },
url = '{% url 'share_permission_admin' %}?share_type=' + 'personal';
} else {
var group_id = perm_item.attr('data-group_id'),
data = { repo_id: '{{repo.id}}', email_or_group: group_id, permission: perm },
url = '{% url 'share_permission_admin' %}?share_type=' + 'group';
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
cache: false,
beforeSend: prepareCSRFToken,
data: post_data,
success: function() {
var $td = $el.parent();
$el.addClass('hide');
$('.perm-edit-icon', $td).removeClass('hide');
$('.perm-cur-value', $td)
.html($('[value="' + $el.val() + '"]', $el).text())
.removeClass('hide');
feedback("{% trans "Success" %}", 'success');
},
error: ajaxErrorHandler
});
});
$(document).on('click', function(e) {
var target = e.target || event.srcElement;
if ($('.perm-toggle-select:visible').length > 0 &&
!$('.perm-edit-icon, .perm-toggle-select').is(target)) {
$('.perm-cur-value, .perm-edit-icon').removeClass('hide');
$('.perm-toggle-select').addClass('hide');
}
perm_toggle(select, data, url)
});
addFormPost($('.cancel-share'));

View File

@ -38,7 +38,7 @@ $('#add-file-popup .submit').click(function() {
$.modal.close();
var files = '';
for (var i = 0, len = selected.length; i < len; i++) {
files += '<li class="item">' + '<img src="{{MEDIA_URL}}img/del.png" class="rm vam" data-index="' + i + '" /><span class="vam">' + selected[i].substr(selected[i].lastIndexOf('/') + 1) + '</span></li>';
files += '<li class="item">' + '<img src="{{MEDIA_URL}}img/del.png" class="rm vam" data-index="' + i + '" /><span class="vam">' + HTMLescape(selected[i].substr(selected[i].lastIndexOf('/') + 1)) + '</span></li>';
}
files_ct.data('files', selected).html(files).removeClass('hide');
$('.rm', files_ct).click(function() {

View File

@ -238,8 +238,8 @@ $('#gen-link-btn').click(function() {
obj = gen_link_btn.data('obj'),
form = $('#link-options'),
form_id = form.attr('id'),
use_passwd = $('#link-passwd-switch').attr('checked'),
set_expiration = $('#link-expire-switch').attr('checked'),
use_passwd = $('#link-passwd-switch').prop('checked'),
set_expiration = $('#link-expire-switch').prop('checked'),
passwd, passwd_again, expire_days, post_data;
if (use_passwd) {
@ -515,7 +515,7 @@ $('#link-passwd-switch').click(function () {
pwd_input = $('input[type="password"]', form);
var link_passwd = $('#link-passwd');
if ($(this).attr('checked')) {
if ($(this).prop('checked')) {
pwd_input.attr('disabled', false).removeClass('input-disabled');
link_passwd.slideDown(100);
} else {
@ -529,7 +529,7 @@ $('#link-expire-switch').click(function () {
days_input = $('input[name="expire-days"]', form);
var link_expire = $('#link-expire');
if ($(this).attr('checked')) {
if ($(this).prop('checked')) {
link_expire.slideDown(100);
days_input.attr('disabled', false).removeClass('input-disabled');
} else {