Make links inside event-panel work with ctrl+click

Function introduce to be used in links inside event-panel to make ctrl + click work.
This commit is contained in:
Ana 2016-08-11 12:43:10 +02:00 committed by Ana María Martínez Gómez
parent 56f09474eb
commit cf5d4e4dbe
2 changed files with 26 additions and 12 deletions

View file

@ -116,3 +116,28 @@ $(document).ready( function() {
}
});
});
function eventClicked(e, element){
var url = $(element).data('url');
if(e.ctrlKey)
window.open(url,'_blank');
else
window.location = url;
}
/* Links inside event-panel (to make ctrl + click work for these links):
= link_to text, '#', onClick: 'insideLinkClicked();', 'data-url' => url
*/
function insideLinkClicked(event){
// stops the click from propagating
if (!event) // for IE
var event = window.event;
event.cancelBubble = true;
if (event.stopPropagation) event.stopPropagation();
var url = $(event.target).data('url');
if(event.ctrlKey)
window.open(url,'_blank');
else
window.location = url;
}