mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
[repo new_file] go to new file page after creating a new file
This commit is contained in:
@@ -829,29 +829,32 @@ $('#add-new-file-form, #add-new-dir-form, #rename-form, #mv-form').submit(functi
|
||||
return false;
|
||||
}
|
||||
post_url = '{% url 'new_file' repo.id %}?parent_dir=' + e(path);
|
||||
after_op_success = function(data) {
|
||||
location.href = '{% url 'repo_view_file' repo.id %}?p=' + e(path) + e(data['name']);
|
||||
};
|
||||
} else {
|
||||
post_url = '{% url 'new_dir' repo.id %}?parent_dir=' + e(path);
|
||||
after_op_success = function(data) {
|
||||
form.append('<p style="color:red;">' + "{% trans "Creating..." %}" + '</p>');
|
||||
reqDirData('{% url 'repo_dir_data' repo.id %}?p=' + e(cur_path), function() {
|
||||
$.modal.close();
|
||||
var new_dirent = $('#repo-file-list tr[data-name="' + data['name'] + '"]'),
|
||||
new_dirent_pos = new_dirent.offset().top,
|
||||
window_height = $(window).height();
|
||||
var new_dirent_bottom = $(document).height() - new_dirent_pos;
|
||||
$('.dirent-name a', new_dirent).css({'color':'red'});
|
||||
if (new_dirent_pos > $(window).scrollTop() + window_height/2) {
|
||||
if (new_dirent_bottom < window_height/2) {
|
||||
$(window).scrollTop($(document).height() - window_height);
|
||||
} else {
|
||||
$(window).scrollTop(new_dirent_pos - window_height/2);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateCmt();
|
||||
};
|
||||
}
|
||||
post_data['dirent_name'] = dirent_name;
|
||||
after_op_success = function(data) {
|
||||
form.append('<p style="color:red;">' + "{% trans "Creating..." %}" + '</p>');
|
||||
reqDirData('{% url 'repo_dir_data' repo.id %}?p=' + e(cur_path), function() {
|
||||
$.modal.close();
|
||||
var new_dirent = $('#repo-file-list tr[data-name="' + data['name'] + '"]'),
|
||||
new_dirent_pos = new_dirent.offset().top,
|
||||
window_height = $(window).height();
|
||||
var new_dirent_bottom = $(document).height() - new_dirent_pos;
|
||||
$('.dirent-name a', new_dirent).css({'color':'red'});
|
||||
if (new_dirent_pos > $(window).scrollTop() + window_height/2) {
|
||||
if (new_dirent_bottom < window_height/2) {
|
||||
$(window).scrollTop($(document).height() - window_height);
|
||||
} else {
|
||||
$(window).scrollTop(new_dirent_pos - window_height/2);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateCmt();
|
||||
};
|
||||
} else if (form_id == 'rename-form') {
|
||||
var old_name = form.find('input[name="oldname"]').val(),
|
||||
new_name = $.trim(form.find('input[name="newname"]').val()),
|
||||
|
Reference in New Issue
Block a user