mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-23 09:11:15 +00:00
[lib/dirent] improved 'rename'
This commit is contained in:
parent
c4ffca620e
commit
ab380bf361
@ -15,9 +15,17 @@ define([
|
|||||||
this.dir = options.dir;
|
this.dir = options.dir;
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
this.$el.modal({appendTo:'#main'});
|
this.$el.modal({appendTo:'#main', focus: false});
|
||||||
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
||||||
|
|
||||||
|
var $input = this.$('[name="newname"]');
|
||||||
|
var dot_index = this.dirent.get('obj_name').lastIndexOf('.');
|
||||||
|
if (!this.dirent.get('is_dir') && dot_index != -1) {
|
||||||
|
$input[0].setSelectionRange(0, dot_index);
|
||||||
|
} else {
|
||||||
|
$input.select();
|
||||||
|
}
|
||||||
|
|
||||||
this.$error = this.$('.error');
|
this.$error = this.$('.error');
|
||||||
this.$form = this.$('form');
|
this.$form = this.$('form');
|
||||||
},
|
},
|
||||||
|
@ -253,7 +253,6 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
rename: function() {
|
rename: function() {
|
||||||
var is_dir = this.model.get('is_dir');
|
|
||||||
var dirent_name = this.model.get('obj_name');
|
var dirent_name = this.model.get('obj_name');
|
||||||
|
|
||||||
var form = $(this.renameTemplate({
|
var form = $(this.renameTemplate({
|
||||||
@ -269,7 +268,14 @@ define([
|
|||||||
}).append(form);
|
}).append(form);
|
||||||
$op.hide();
|
$op.hide();
|
||||||
$name.hide();
|
$name.hide();
|
||||||
$('[name="newname"]', form).focus();
|
|
||||||
|
var $input = $('[name="newname"]', form);
|
||||||
|
var dot_index = dirent_name.lastIndexOf('.');
|
||||||
|
if (!this.model.get('is_dir') && dot_index != -1) {
|
||||||
|
$input[0].setSelectionRange(0, dot_index);
|
||||||
|
} else {
|
||||||
|
$input.select();
|
||||||
|
}
|
||||||
|
|
||||||
this._hideMenu();
|
this._hideMenu();
|
||||||
app.ui.freezeItemHightlight = true;
|
app.ui.freezeItemHightlight = true;
|
||||||
|
@ -118,7 +118,7 @@ define([
|
|||||||
}).append(form);
|
}).append(form);
|
||||||
$op_td.hide();
|
$op_td.hide();
|
||||||
$name_span.hide();
|
$name_span.hide();
|
||||||
$('[name="newname"]', form).focus();
|
$('[name="newname"]', form).select();
|
||||||
|
|
||||||
this.togglePopup();
|
this.togglePopup();
|
||||||
app.ui.freezeItemHightlight = true;
|
app.ui.freezeItemHightlight = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user