Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ToolTip issue #1886

Merged
merged 1 commit into from
Mar 3, 2022
Merged
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
11 changes: 7 additions & 4 deletions apps/dashboard/app/javascript/packs/files/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ $(document).ready(function(){

clipboardjs = new ClipboardJS('#copy-path');

/*
NOTE: Had to move the following functionality to the template (_inline_js.html.erb) so the tooltip would be recognized.

clipboardjs.on('success', function(e) {
//FIXME: for some reason the jQuery function tooltip is not being recognized. Will need to figure out why or move on to new tooltip plugin.

// $(e.trigger).tooltip({title: 'Copied path to clipboard!', trigger: 'manual', placement: 'bottom'}).tooltip('show');
// setTimeout(() => $(e.trigger).tooltip('hide'), 2000);
//FIXME: for some reason the jQuery function tooltip is not being recognized. Will need to figure out why or move on to new tooltip plugin. - gerald
$(e.trigger).popover({title: 'Copied path to clipboard!', trigger: 'manual', placement: 'bottom'}).tooltip('show');
setTimeout(() => $(e.trigger).tooltip('hide'), 2000);
e.clearSelection();
});
clipboardjs.on('error', function(e) {
e.clearSelection();
});
*/

//FIXME: so need to handle updateViewForClipboard based on EVENTS emitted by local storage modifications
updateViewForClipboard();
Expand Down
15 changes: 10 additions & 5 deletions apps/dashboard/app/javascript/packs/files/datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import {} from './uppy.js';
import {} from './clipboard.js';

let table = null;

let onpopstate = null;
let actionsBtnTemplate = null;
let reportTransferTemplate = null;

export {
actionsBtnTemplate, reportTransferTemplate, table, dataFromJsonResponse, getEmptyDirs, getFilesAndDirectoriesFromDirectory,
getShowDotFiles, getShowOwnerMode, Handlebars, reloadTable, update_datatables_status
getShowDotFiles, getShowOwnerMode, Handlebars, onpopstate, reloadTable, update_datatables_status
};

let actionsBtnTemplate = null;
let reportTransferTemplate = null;

global.reloadTable = reloadTable; // Required to be marked as global since we are using this in the template.

$(document).ready(function() {
Expand Down Expand Up @@ -261,6 +260,12 @@ $(document).ready(function() {
updateShowOwnerModeVisibility();
});

onpopstate = function(event){
// FIXME: handle edge case if state ! exist
setTimeout(() => {
goto(event.state.currentDirectoryUrl, false);
}, 0);
};

});

Expand Down
106 changes: 0 additions & 106 deletions apps/dashboard/app/javascript/packs/files/index.js

This file was deleted.

5 changes: 3 additions & 2 deletions apps/dashboard/app/javascript/packs/files/uppy.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ $(document).ready(function(){
});

// https://stackoverflow.com/questions/6756583/prevent-browser-from-loading-a-drag-and-dropped-file
window.addEventListener("dragover",function(e){
global.addEventListener("dragover",function(e){
e = e || event;
e.preventDefault();
},false);
window.addEventListener("drop",function(e){

global.addEventListener("drop",function(e){
e = e || event;
e.preventDefault();
},false);
Expand Down
14 changes: 14 additions & 0 deletions apps/dashboard/app/views/files/_inline_js.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,18 @@ history.replaceState({
reloadTable();
<% end %>

$(document).ready(function(){
clipboardjs = new ClipboardJS('#copy-path');
clipboardjs.on('success', function(e) {
//FIXME: Have to put this in the template so it will recognize tooltip.

$(e.trigger).tooltip({title: 'Copied path to clipboard!', trigger: 'manual', placement: 'bottom'}).tooltip('show');
setTimeout(() => $(e.trigger).tooltip('hide'), 2000);
e.clearSelection();
});
clipboardjs.on('error', function(e) {
e.clearSelection();
});
});

</script>