mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
added 'recent changes' to group_info & improved 'tabs'
This commit is contained in:
43
templates/snippets/repo_decrypt_js.html
Normal file
43
templates/snippets/repo_decrypt_js.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
$('#repo-decrypt-form').submit(function() {
|
||||
var form = $(this);
|
||||
var form_id = form.attr('id');
|
||||
var input_password = form.find('input[name="password"]');
|
||||
var repo_id = form.find('input[name="repo_id"]').val();
|
||||
var password = input_password.val();
|
||||
var cur_data = form.data();
|
||||
if (!password) {
|
||||
apply_form_error(form_id, '{% trans "Password is required." %}');
|
||||
} else {
|
||||
apply_form_error(form_id, '');
|
||||
$.ajax({
|
||||
url: '{% url 'repo_set_password' %}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
beforeSend: prepareCSRFToken,
|
||||
data: {
|
||||
repo_id: repo_id,
|
||||
password: password,
|
||||
username: '{{request.user.username}}'
|
||||
},
|
||||
success: function(data) {
|
||||
$.modal.close();
|
||||
$('.lsch-encrypted[data-repoid="' + repo_id + '"]').attr('data-passwordset', true);
|
||||
listCommitDetails(cur_data.url, cur_data.time);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
var err = '';
|
||||
if (jqXHR.responseText) {
|
||||
err = $.parseJSON(jqXHR.responseText).error;
|
||||
} else {
|
||||
err = '{% trans "Failed. Please check the network." %}';
|
||||
}
|
||||
apply_form_error(form_id, err);
|
||||
input_password.val('');
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
Reference in New Issue
Block a user