Skip to content

Commit

Permalink
redesign parts of the file manager
Browse files Browse the repository at this point in the history
ignore yarn.lock file
  • Loading branch information
schrej committed Jan 26, 2017
1 parent 0c1559c commit c62312b
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 158 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Homestead.yaml
Vagrantfile
Vagrantfile

node_modules
node_modules
yarn.lock

Large diffs are not rendered by default.

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions public/themes/pterodactyl/js/frontend/files/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
7 changes: 7 additions & 0 deletions public/themes/pterodactyl/js/frontend/files/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion public/themes/pterodactyl/js/frontend/files/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
window.onbeforeunload = function () {
return 'A file upload in in progress, are you sure you want to continue?';
};
event.file.meta.path = $('#headerTableRow').attr('data-currentdir');
event.file.meta.path = $('#file_listing').data('current-dir');
event.file.meta.identifier = Math.random().toString(36).slice(2);

$('#append_files_to').append('<tr id="file-upload-' + event.file.meta.identifier +'"> \
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
'size' => 'Size',
'last_modified' => 'Last Modified',
'add_new' => 'Add New File',
'add_folder' => 'Add New Folder',
'edit' => [
'header' => 'Edit File',
'header_sub' => 'Make modifications to a file from the web.',
Expand Down
6 changes: 4 additions & 2 deletions resources/themes/pterodactyl/server/files/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
<div class="col-xs-12">
<div class="box box-primary">
<div class="overlay file-overlay"><i class="fa fa-refresh fa-spin"></i></div>
<div class="box-body table-responsive no-padding" id="load_files">
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
<div id="load_files">
<div class="box-body table-responsive no-padding">
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
</div>
</div>
<div class="box-footer with-border">
<p class="text-muted small" style="margin: 0 0 2px;">@lang('server.files.path', ['path' => '<code>/home/container</code>', 'size' => '<code>' . $node->upload_size . ' MB</code>'])</p>
Expand Down
287 changes: 145 additions & 142 deletions resources/themes/pterodactyl/server/files/list.blade.php

Large diffs are not rendered by default.

0 comments on commit c62312b

Please sign in to comment.