Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions app/assets/javascripts/file_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function rename(path) {
$.ajax({
url: "/file_manager/" + rel_path,
type: "PUT",
data: { new_name: new_name, relative_path: rel_path},
data: { new_name: new_name, relative_path: rel_path },
success: function(data) {
console.log(`Renamed: ${rel_path}`)
location.reload();
Expand All @@ -19,11 +19,11 @@ function deleteSelected(path) {
$.ajax({
url: path,
type: "DELETE",
success: function () {
success: function() {
console.log(`Deleted: ${path}`);
resolve();
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
reject(error);
}
});
Expand All @@ -38,7 +38,7 @@ function downloadSelected(path) {
data: {
path: path
},
success: function (data) {
success: function(data) {
let blob = new Blob([data], { type: 'application/x-tar' });
let url = URL.createObjectURL(blob);
let a = document.createElement('a');
Expand All @@ -53,7 +53,7 @@ function downloadSelected(path) {
console.log(`Downloaded: ${data.filename}`);
resolve();
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(`Failed to download ${path}: ${error}`);
reject(error);
}
Expand All @@ -76,11 +76,11 @@ function uploadFile(file, path, name) {
data: formData,
contentType: false,
processData: false,
success: function () {
success: function() {
console.log("Uploaded file successfully");
resolve();
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(`Failed to upload file: ${error}`);
reject(error);
}
Expand All @@ -98,14 +98,14 @@ function uploadAllFiles(path) {
}
if (files.length > 0) {
Promise.all(uploadPromises)
.then(() => {
alert("All files uploaded successfully.");
location.reload();
})
.catch((error) => {
alert("Some files failed to upload successfully. Ensure that you are not in the root directory, the file is smaller than 1 GB, and does not already exist.");
location.reload();
});
.then(() => {
alert("All files uploaded successfully.");
location.reload();
})
.catch((error) => {
alert("Some files failed to upload successfully. Ensure that you are not in the root directory, the file is smaller than 1 GB, and does not already exist.");
location.reload();
});
} else {
console.log('No files selected.');
}
Expand All @@ -130,8 +130,7 @@ function createFolder(path) {
})
.catch((error) => {
alert("Failed to create folder. Check that you are not in the root directory and that the tile/folder does not already exist.");
})
;
});
}
}

Expand Down Expand Up @@ -218,5 +217,5 @@ document.addEventListener('DOMContentLoaded', function() {

$(".check").click(function() {
handleSelectionChange();
})
});
});
});
115 changes: 60 additions & 55 deletions app/assets/stylesheets/file_manager.scss
Original file line number Diff line number Diff line change
@@ -1,91 +1,96 @@
.div-row {
display: flex;
flex-direction: row;
gap: 5rem;
display: flex;
flex-direction: row;
gap: 5rem;
}

[type="checkbox"]:not(:checked) {
opacity: 100;
position: relative;
display: flex;
justify-content: center;
align-items: center;
pointer-events: auto;
opacity: 100;
position: relative;
display: flex;
justify-content: center;
align-items: center;
pointer-events: auto;
}

[type="checkbox"]:checked {
position: relative;
opacity: 1;
pointer-events: unset;
position: relative;
opacity: 1;
pointer-events: unset;
}

.table-col-center {
display: flex;
justify-content: center;
align-items: center;
padding-top: 35%;
display: flex;
justify-content: center;
align-items: center;
padding-top: 35%;
}

.table-scroll {
height: 40rem;
overflow-y: auto;
height: 40rem;
overflow-y: auto;
}

.div-row-cols {
display: flex;
align-items: center;
display: flex;
align-items: center;
}

.button-file {
position: relative;
overflow: hidden;
position: relative;
overflow: hidden;
}

.button-file input[type=submit] {
left: -10px;
right: 0;
padding: 0;
left: -10px;
right: 0;
padding: 0;
}

.button-file input {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: green;
display: block;
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: green;
display: block;
}

.button-file a {
color: white;
color: white;
}

@media screen and (max-width: 1164px) {
.div-row {
display: grid;
grid-template-columns: auto auto;
gap: 1rem;
}
.button-file {
width: 200px;
}
.div-row-cols {
margin: 0;
padding: 0;
}
.div-row {
display: grid;
grid-template-columns: auto auto;
gap: 1rem;
}
.button-file {
width: 200px;
}
.div-row-cols {
margin: 0;
padding: 0;
}
}

@media screen and (max-width: 478px) {
.div-row {
display: grid;
grid-template-columns: auto;
gap: 1rem;
}
.div-row {
display: grid;
grid-template-columns: auto;
gap: 1rem;
}
}

.permissions-display {
font-family: monospace;
font-size: 12px;
color: #333;
}
Loading