Skip to content
Snippets Groups Projects
Commit 7303d1ca authored by srosse's avatar srosse
Browse files

OO-3617: better closing of popover with title in portfolio especially

parent 97506a38
No related branches found
No related tags found
No related merge requests found
#set($imageWidth = ${imageSize.width} + 25) #set($imageWidth = ${imageSize.width} + 25)
<div class="o_image o_image_size_style_${imageSizeStyle} #if($r.isNotEmpty($alignment)) o_image_align_$alignment #end #if($r.isNotEmpty($style)) $style #end" style='#if($imageSizeStyle == "none" && $r.isNotNull($imageSize)) width: 100%; max-width:${imageWidth}px #end'> <div class="o_image o_image_size_style_${imageSizeStyle} #if($r.isNotEmpty($alignment)) o_image_align_$alignment #end #if($r.isNotEmpty($style)) $style #end" style='#if($imageSizeStyle == "none" && $r.isNotNull($imageSize)) width: 100%; max-width:${imageWidth}px #end'>
#if($r.isTrue($showDescription)) #if($r.isTrue($showDescription))
<span id="ldesc_${someId}" onclick="o_popoverWithTitle('ldesc_${someId}','desc_${someId}','$r.translate("show.description")','top').popover('show');" class="o_popover"><i class="o_icon o_icon-lg o_icon_help"> </i></span> <a id="ldesc_${someId}" href='javascript:;' onclick="o_popoverWithTitle('ldesc_${someId}','desc_${someId}','$r.translate("show.description")','top').popover('show');" class="o_popover"><i class="o_icon o_icon-lg o_icon_help"> </i></a>
#end #end
#if($r.isTrue($showSource)) #if($r.isTrue($showSource))
<span id="lsource_${someId}" onclick="o_popoverWithTitle('lsource_${someId}','source_${someId}','$r.translate("show.source")','top').popover('show');" class="o_popover"><i class="o_icon o_icon-lg o_icon_origin"> </i></span> <a id="lsource_${someId}" href='javascript:;' onclick="o_popoverWithTitle('lsource_${someId}','source_${someId}','$r.translate("show.source")','top').popover('show');" class="o_popover"><i class="o_icon o_icon-lg o_icon_origin"> </i></a>
#end #end
<div class="o_figure_caption_bottom"> <div class="o_figure_caption_bottom">
#if($r.isTrue($showTitle) && $titlePosition == "above") #if($r.isTrue($showTitle) && $titlePosition == "above")
......
...@@ -983,23 +983,25 @@ function o_popover(id, contentId, loc) { ...@@ -983,23 +983,25 @@ function o_popover(id, contentId, loc) {
function o_popoverWithTitle(id, contentId, title, loc) { function o_popoverWithTitle(id, contentId, title, loc) {
if(typeof(loc)==='undefined') loc = 'bottom'; if(typeof(loc)==='undefined') loc = 'bottom';
return jQuery('#' + id).popover({ var popover = jQuery('#' + id).popover({
placement : loc, placement : loc,
html: true, html: true,
title: title, title: title,
trigger: 'click', trigger: 'click',
container: 'body', container: 'body',
content: function() { return jQuery('#' + contentId).clone().html(); } content: function() { return jQuery('#' + contentId).clone().html(); }
}).on('shown.bs.popover', function () { });
popover.on('shown.bs.popover', function () {
var clickListener = function (e) { var clickListener = function (e) {
jQuery('#' + id).popover('destroy'); jQuery('#' + id).popover('hide');
jQuery('body').unbind('click', clickListener); jQuery('body').unbind('click', clickListener);
}; };
setTimeout(function() { setTimeout(function() {
jQuery('body').on('click', clickListener); jQuery('body').on('click', clickListener);
},5); },5);
}); });
return popover;
} }
function o_shareLinkPopup(id, text, loc) { function o_shareLinkPopup(id, text, loc) {
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
} }
// make sure drake is destroyed after an AJAX call and only one is active at the same time // make sure drake is destroyed after an AJAX call and only one is active at the same time
destroyDrakes(); destroyDrakes();
destroyPopovers();
registerDrake(editor.drake); registerDrake(editor.drake);
return editor; return editor;
}; };
...@@ -48,19 +47,14 @@ ...@@ -48,19 +47,14 @@
this.container = container; this.container = container;
this.drake = initDragAndDrop(container); this.drake = initDragAndDrop(container);
}; };
function destroyPopovers() {
jQuery(".o_popover").each(function(index, el) {
var popoveredEl = jQuery(el);
if(popoveredEl.closest(".o_page_with_side_options_wrapper").length == 0) {
popoveredEl.popover('hide');
}
});
}
function initEdit() { function initEdit() {
jQuery(".o_page_part").each(function(index, el) { jQuery(".o_page_part").each(function(index, el) {
jQuery(el).on('click', function(e) { jQuery(el).on('click', function(e) {
if(jQuery(e.target).closest(".o_popover").length > 0) {
return true;
}
var element = jQuery(el); var element = jQuery(el);
if(element.parents('.o_page_fragment_edit').length == 0 if(element.parents('.o_page_fragment_edit').length == 0
&& jQuery(".o_page_fragment_edit", element).length == 0) { && jQuery(".o_page_fragment_edit", element).length == 0) {
...@@ -81,7 +75,8 @@ ...@@ -81,7 +75,8 @@
} else { } else {
var edited = jQuery(e.target).closest(".o_page_fragment_edit").length > 0 var edited = jQuery(e.target).closest(".o_page_fragment_edit").length > 0
|| jQuery(e.target).closest(".o_page_side_options").length > 0; || jQuery(e.target).closest(".o_page_side_options").length > 0;
if(!edited && jQuery(".o_layered_panel .modal-dialog").length == 0) { var excludedEls = jQuery(e.target).closest(".o_popover").length > 0;
if(!edited && !excludedEls && jQuery(".o_layered_panel .modal-dialog").length == 0) {
o_XHREvent(componentUrl, false, false, 'cid', 'close_edit_fragment'); o_XHREvent(componentUrl, false, false, 'cid', 'close_edit_fragment');
} }
} }
......
This diff is collapsed.
...@@ -715,6 +715,11 @@ ...@@ -715,6 +715,11 @@
.o_portfolio_entry_done { .o_portfolio_entry_done {
background-color: $o-portfolio-entry-done-color; background-color: $o-portfolio-entry-done-color;
} }
.o_popover, .popover:hover {
color: $o-content-text-color;
text-decoration: none;
}
} }
.o_portfolio_content { .o_portfolio_content {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment