Skip to content

Commit c62312b

Browse files
committed
redesign parts of the file manager
ignore yarn.lock file
1 parent 0c1559c commit c62312b

File tree

10 files changed

+179
-158
lines changed

10 files changed

+179
-158
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ Homestead.yaml
99
Vagrantfile
1010
Vagrantfile
1111

12-
node_modules
12+
node_modules
13+
yarn.lock

public/themes/pterodactyl/js/frontend/files/filemanager.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/themes/pterodactyl/js/frontend/files/filemanager.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/themes/pterodactyl/js/frontend/files/src/actions.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,22 @@ class ActionsClass {
2929
this.element = undefined;
3030
}
3131

32-
folder() {
33-
const nameBlock = $(this.element).find('td[data-identifier="name"]');
34-
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
35-
const currentPath = decodeURIComponent(nameBlock.data('path'));
32+
folder(path) {
33+
let inputValue
34+
if (path) {
35+
inputValue = path
36+
} else {
37+
const nameBlock = $(this.element).find('td[data-identifier="name"]');
38+
const currentName = decodeURIComponent(nameBlock.data('name'));
39+
const currentPath = decodeURIComponent(nameBlock.data('path'));
3640

37-
let inputValue = `${currentPath}${currentName}/`;
38-
if ($(this.element).data('type') === 'file') {
39-
inputValue = currentPath;
41+
if ($(this.element).data('type') === 'file') {
42+
inputValue = currentPath;
43+
} else {
44+
inputValue = `${currentPath}${currentName}/`;
45+
}
4046
}
47+
4148
swal({
4249
type: 'input',
4350
title: 'Create Folder',

public/themes/pterodactyl/js/frontend/files/src/contextmenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ContextMenuClass {
3333
$(document).find('#fileOptionMenu').remove();
3434
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
3535

36-
let newFilePath = $('#headerTableRow').attr('data-currentDir');
36+
let newFilePath = $('#file_listing').data('current-dir');
3737
if (parent.data('type') === 'folder') {
3838
const nameBlock = parent.find('td[data-identifier="name"]');
3939
const currentName = decodeURIComponent(nameBlock.attr('data-name'));

public/themes/pterodactyl/js/frontend/files/src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class FileManager {
4444
$('#load_files').slideUp(10).html(data).slideDown(10, () => {
4545
ContextMenu.run();
4646
this.reloadFilesButton();
47+
this.addFolderButton();
4748
if (_.isFunction(next)) {
4849
return next();
4950
}
@@ -82,6 +83,12 @@ class FileManager {
8283
});
8384
}
8485

86+
addFolderButton() {
87+
$('i[data-action="add-folder"]').unbind().on('click', () => {
88+
new ActionsClass().folder($('#file_listing').data('current-dir') || '/');
89+
})
90+
}
91+
8592
decodeHash() {
8693
return decodeURIComponent(window.location.hash.substring(1));
8794
}

public/themes/pterodactyl/js/frontend/files/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
window.onbeforeunload = function () {
8585
return 'A file upload in in progress, are you sure you want to continue?';
8686
};
87-
event.file.meta.path = $('#headerTableRow').attr('data-currentdir');
87+
event.file.meta.path = $('#file_listing').data('current-dir');
8888
event.file.meta.identifier = Math.random().toString(36).slice(2);
8989

9090
$('#append_files_to').append('<tr id="file-upload-' + event.file.meta.identifier +'"> \

resources/lang/en/server.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
'size' => 'Size',
213213
'last_modified' => 'Last Modified',
214214
'add_new' => 'Add New File',
215+
'add_folder' => 'Add New Folder',
215216
'edit' => [
216217
'header' => 'Edit File',
217218
'header_sub' => 'Make modifications to a file from the web.',

resources/themes/pterodactyl/server/files/index.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
<div class="col-xs-12">
3939
<div class="box box-primary">
4040
<div class="overlay file-overlay"><i class="fa fa-refresh fa-spin"></i></div>
41-
<div class="box-body table-responsive no-padding" id="load_files">
42-
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
41+
<div id="load_files">
42+
<div class="box-body table-responsive no-padding">
43+
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
44+
</div>
4345
</div>
4446
<div class="box-footer with-border">
4547
<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>

resources/themes/pterodactyl/server/files/list.blade.php

Lines changed: 145 additions & 142 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)