File management dialogue enhancements:

- Double click on file/folder icon or name will navigate to the folder/file.
- Selected file/folder can be renamed by Rename button only. Double click rename is removed.
- Filename text box will not hide on smaller screen. Setting minimum width of File Browser fixed it.
- Path at top will only show directory name, not the file name and it is greyed out
This commit is contained in:
Surinder Kumar
2016-07-15 10:50:25 +01:00
committed by Dave Page
parent efb254c966
commit 1a129cf30e
4 changed files with 22 additions and 80 deletions

View File

@@ -24,11 +24,15 @@
float: left;
text-align: left;
line-height:1.9em;
text-shadow:1px 1px 0px #ffffff;
max-width: 367px;
text-overflow: ellipsis;
overflow: hidden;
color: #999;
}
#uploader h1 b {
font-weight: normal;
color: #999;
}
.uploadresponse {
@@ -346,6 +350,7 @@ button.list span {
-moz-border-radius: 5px;
float: left;
margin-right: 10px;
background: #EEE;
}
.file_manager #uploader .btn-group .btn[disabled] {
@@ -528,7 +533,9 @@ button.list span {
-moz-border-radius: 3px;
height: 22px;
font-size: 13px;
font-weight: normal;
display: inline;
width: 150px;
}
.allowed_file_types .change_file_types {

View File

@@ -94,6 +94,7 @@ define([
$container.find('.storage_content').remove();
$container.append("<div class='storage_content'></div>");
renderStoragePanel(params);
this.elements.dialog.style.minWidth = '630px';
this.show();
},
settings: {
@@ -203,6 +204,7 @@ define([
$container.find('.storage_content').remove();
$container.append("<div class='storage_content'></div>");
renderStoragePanel(params);
this.elements.dialog.style.minWidth = '630px';
this.show();
},
settings: {
@@ -314,6 +316,7 @@ define([
$container.find('.storage_content').remove();
$container.append("<div class='storage_content'></div>");
renderStoragePanel(params);
this.elements.dialog.style.minWidth = '630px';
this.show();
},
settings: {
@@ -425,6 +428,7 @@ define([
$container.find('.storage_content').remove();
$container.append("<div class='storage_content'></div>");
renderStoragePanel(params);
this.elements.dialog.style.minWidth = '630px';
this.show();
},
settings: {

View File

@@ -195,7 +195,7 @@ var setUploader = function(path) {
path = decodeURI(path);
var display_string = path,
mypath = '';
file_path = '';
// split path
var split_path = display_string.split('/');
@@ -203,29 +203,17 @@ var setUploader = function(path) {
// set empty path if it is windows
if (config.options.platform_type === "win32" && config.options.show_volumes) {
mypath = "";
file_path = "";
} else if (split_path.length === 0) {
mypath = $('<b>/</b>');
file_path = '/';
} else {
mypath = $('<a class="breadcrumbs" href="#" data-path="/">/</a>');
file_path = '/';
}
$(mypath).appendTo($('.storage_dialog #uploader h1'));
Object.keys(split_path).forEach(function (i) {
if (i < split_path.length - 1) {
mypath = $(
'<a class="breadcrumbs" href="#" data-path="' +
display_string.replace(split_path[i+1], '') +
'">' + split_path[i] + '/</a>'
);
$(mypath).appendTo($('.storage_dialog #uploader h1'));
} else {
mypath = $('<b>' + split_path[i] + '/</b>');
$(mypath).appendTo(
$('.storage_dialog #uploader h1')
);
}
file_path += split_path[i] + '/';
});
$('.storage_dialog #uploader h1').html(file_path);
$('.currentpath').val(path);
if ($('.storage_dialog #uploader h1 span').length === 0) {
@@ -908,28 +896,6 @@ var getFolderInfo = function(path, file_type) {
}
});
$('.fileinfo #contents li p').on('dblclick',function(e) {
e.stopPropagation();
var $this = $(this);
var orig_value = decodeURI($this.find('span').attr('title')),
newvalue = orig_value.substring(0, orig_value.indexOf('.'));
if (newvalue === '') {
newvalue = orig_value;
}
$this.find('input').toggle().val(newvalue).focus();
$this.find('span').toggle();
// Rename folder/file on pressing enter key
$('.file_manager').unbind().on('keyup', function(e) {
if (e.keyCode == 13) {
e.stopPropagation();
$this.find('input').trigger('blur');
}
});
});
// Rename UI handling
$('.fileinfo #contents li p').on('blur dblclick','input', function(e) {
e.stopPropagation();
@@ -1008,30 +974,6 @@ var getFolderInfo = function(path, file_type) {
}
});
$('.fileinfo table#contents tr td p').on('dblclick', function(e) {
e.stopPropagation();
var $this = $(this),
orig_value = decodeURI(
$this.find('span').attr('title')
);
var newvalue = orig_value.substring(0, orig_value.lastIndexOf('.'));
if (orig_value.lastIndexOf('/') == orig_value.length - 1 || newvalue === '') {
newvalue = orig_value;
}
$this.find('input').toggle().val(newvalue).focus();
$this.find('span').toggle();
// Rename folder/file on pressing enter key
$('.file_manager').unbind().on('keyup', function(e) {
if (e.keyCode == 13) {
e.stopPropagation();
$this.find('input').trigger('blur');
}
});
});
$('.fileinfo table#contents tr td p').on(
'blur dblclick', 'input', function(e) {
var old_name = decodeURI($(this).siblings('span').attr('title')),
@@ -1148,11 +1090,7 @@ var getFolderInfo = function(path, file_type) {
'disabled'
);
// set selected folder name in breadcrums
$('.file_manager #uploader h1').hide();
$('.file_manager #uploader .show_selected_file').remove();
$('<span class="show_selected_file">'+path+'</span>').appendTo(
'.file_manager #uploader .filemanager-path-group'
);
}
if (
@@ -1200,11 +1138,7 @@ var getFolderInfo = function(path, file_type) {
'disabled'
);
// set selected folder name in breadcrums
$('.file_manager #uploader h1').hide();
$('.file_manager #uploader .show_selected_file').remove();
$('<span class="show_selected_file">' + path + '</span>').appendTo(
'.file_manager #uploader .filemanager-path-group'
);
}
if (
config.options.dialog_type == 'create_file' &&

View File

@@ -1121,16 +1121,13 @@ def load_file():
if request.data:
file_data = json.loads(request.data.decode())
file_path = unquote(file_data['file_name'])
# retrieve storage directory path
storage_manager_path = get_storage_directory()
if storage_manager_path is None:
storage_manager_path = ""
if storage_manager_path:
# generate full path of file
file_path = os.path.join(
storage_manager_path,
unquote(file_data['file_name'].lstrip('/'))
)
file_path = os.path.join(storage_manager_path, file_path.lstrip('/'))
file_data = None
# check if file type is text or binary