saving work, removed testing buttons

This commit is contained in:
Zanz2 2018-08-17 11:52:10 +02:00
parent 637c7dfb19
commit e1cadfc75e
2 changed files with 41 additions and 47 deletions

View file

@ -2,41 +2,47 @@
'use strict'; 'use strict';
$(document).ready(function() { $(document).ready(function() {
$('.popover_v2').each(function(i,obj) { //if( user has popovers turned on from settings ){
var link = $(obj).data('popover-link') $('.popover_v2').each(function(i,obj) {
$(obj).popover({ var link = $(obj).data('popover-link')
html: true, $(obj).popover({
container: 'body', html: true,
placement: 'auto right', container: 'body',
trigger: 'manual', placement: 'auto right',
template: '<div class="popover popover_'+i+'_window" role="tooltip" style="background-color:#F0F0F0;font-family:Lato;font-size:14px;" color="#000000" ><div class="popover-body" >' + trigger: 'manual',
$(obj).data('content') + template: '<div class="popover popover_'+i+'_window" role="tooltip" style="background-color:#F0F0F0;font-family:Lato;font-size:14px;" color="#000000" ><div class="popover-body" >' +
'</div><br><br><br><div class="popover-footer" style="position:absolute;bottom:5px;right:5px;background-color:#E8E8E8;border-radius: 3px;">' + $(obj).data('content') +
'<a style="color:grey;" class="btn btn-link text-nowrap" href="'+link+'">Read more&nbsp;&nbsp;&nbsp;<i class="fas fa-external-link-alt"></i></a></div></div>' '</div><br><br><br><div class="popover-footer" style="position:absolute;bottom:5px;right:5px;background-color:#E8E8E8;border-radius: 3px;">' +
}).on("mouseenter", function () { '<a style="color:grey;" class="btn btn-link text-nowrap" href="'+link+'">Read more&nbsp;&nbsp;&nbsp;<i class="fas fa-external-link-alt"></i></a></div></div>'
setTimeout(function () { }).on("mouseenter", function () {
if ($(obj).hover().length) { setTimeout(function () {
$(obj).popover("show") if ($(obj).hover().length) {
var top = $(obj).offset().top; $(obj).popover("show")
$('.popover_'+i+'_window').css({ var top = $(obj).offset().top;
top: (top) + 'px' $('.popover_'+i+'_window').css({
}); top: (top) + 'px'
$(".popover_"+i+"_window").on("mouseleave", function () { });
$(".popover_"+i+"_window").css("background-color","#F0F0F0"); $(".popover_"+i+"_window").on("mouseleave", function () {
$(obj).popover('hide'); $(".popover_"+i+"_window").css("background-color","#F0F0F0");
}); $(obj).popover('hide');
$(".popover_"+i+"_window").on("mouseenter", function () { });
$(".popover_"+i+"_window").css("background-color","#DADADA"); $(".popover_"+i+"_window").on("mouseenter", function () {
}); $(".popover_"+i+"_window").css("background-color","#DADADA");
} });
}, 1000);
}).on("mouseleave", function () {
setTimeout(function () {
if (!$(".popover_"+i+"_window:hover").length) {
$(obj).popover("hide")
} }
}, 500); }, 1000);
}); }).on("mouseleave", function () {
}) setTimeout(function () {
if (!$(".popover_"+i+"_window:hover").length) {
$(obj).popover("hide")
}
}, 500);
});
})
//}
}); });
}()); }());
/* copy and paste shortcut
<button class="btn btn-default popover_v2" data-popover-link="popover_test.link" data-content="<%= I18n.t('popover_test.text') %>">
*/

View file

@ -70,18 +70,6 @@
<!-- profile info --> <!-- profile info -->
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<!-- search form --> <!-- search form -->
<li>
<button class="btn btn-default popover_v2" data-popover-link="https://www.google.com/" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-popover-link="https://www.google.com/1" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-popover-link="https://www.google.com/2" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-popover-link="https://www.google.com/3" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li> <li>
<%= form_tag search_path, <%= form_tag search_path,
method: :get, method: :get,