Skip to content

Commit

Permalink
Fixed ToolTip issue (#1886)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerald Byrket <gbyrket@osc.edu>
  • Loading branch information
gbyrket and gerald-byrket authored Mar 3, 2022
1 parent 8f46195 commit 35c8cfa
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 117 deletions.
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>

0 comments on commit 35c8cfa

Please sign in to comment.