redesign parts of the file manager

ignore yarn.lock file
This commit is contained in:
Jakob Schrettenbrunner 2017-01-27 00:44:59 +01:00
parent 0c1559c922
commit c62312b8af
10 changed files with 179 additions and 158 deletions

View file

@ -29,15 +29,22 @@ class ActionsClass {
this.element = undefined;
}
folder() {
const nameBlock = $(this.element).find('td[data-identifier="name"]');
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
const currentPath = decodeURIComponent(nameBlock.data('path'));
folder(path) {
let inputValue
if (path) {
inputValue = path
} else {
const nameBlock = $(this.element).find('td[data-identifier="name"]');
const currentName = decodeURIComponent(nameBlock.data('name'));
const currentPath = decodeURIComponent(nameBlock.data('path'));
let inputValue = `${currentPath}${currentName}/`;
if ($(this.element).data('type') === 'file') {
inputValue = currentPath;
if ($(this.element).data('type') === 'file') {
inputValue = currentPath;
} else {
inputValue = `${currentPath}${currentName}/`;
}
}
swal({
type: 'input',
title: 'Create Folder',

View file

@ -33,7 +33,7 @@ class ContextMenuClass {
$(document).find('#fileOptionMenu').remove();
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
let newFilePath = $('#headerTableRow').attr('data-currentDir');
let newFilePath = $('#file_listing').data('current-dir');
if (parent.data('type') === 'folder') {
const nameBlock = parent.find('td[data-identifier="name"]');
const currentName = decodeURIComponent(nameBlock.attr('data-name'));

View file

@ -44,6 +44,7 @@ class FileManager {
$('#load_files').slideUp(10).html(data).slideDown(10, () => {
ContextMenu.run();
this.reloadFilesButton();
this.addFolderButton();
if (_.isFunction(next)) {
return next();
}
@ -82,6 +83,12 @@ class FileManager {
});
}
addFolderButton() {
$('i[data-action="add-folder"]').unbind().on('click', () => {
new ActionsClass().folder($('#file_listing').data('current-dir') || '/');
})
}
decodeHash() {
return decodeURIComponent(window.location.hash.substring(1));
}