[FIX] web_editor, web_unsplash: fix nested div

The div that is replaced with the existing.attachments template was not
the right target and kept nesting div into each other.
The parent div of the existing.attachments now has the
o_we_existing_attachments class (the target to be replaced by itself).

Part of #33983
This commit is contained in:
fja-odoo
2019-06-19 14:55:30 +00:00
parent 16ee1966af
commit 4ebda2ec2b
5 changed files with 9 additions and 9 deletions
@@ -418,7 +418,7 @@ var FileWidget = SearchableMediaWidget.extend({
var attachments = this.attachments.slice(0, this.numberOfAttachmentsToDisplay);
// Render menu & content
this.$('.existing-attachments').replaceWith(
this.$('.o_we_existing_attachments').replaceWith(
this._renderExisting(attachments)
);
+5 -5
View File
@@ -98,7 +98,7 @@
<form>
<t t-call="wysiwyg.widgets.files.submenu"/>
<div class="form-text o_we_error_text"/>
<div class="existing-attachments"/>
<div class="o_we_existing_attachments"/>
<div class="mt-4 text-center mx-auto">
<button class="btn btn-primary o_load_more" type="button">Load more...</button>
<div class="mt-4 o_load_done_msg d-none">
@@ -243,8 +243,8 @@
</t>
<t t-name="wysiwyg.widgets.image.existing.attachments">
<div class="o_we_images">
<ol class="existing-attachments d-flex flex-wrap mx-auto my-0 p-2">
<div class="o_we_existing_attachments o_we_images">
<ol class="d-flex flex-wrap mx-auto my-0 p-2">
<t t-foreach="attachments" t-as="attachment">
<t t-call="wysiwyg.widgets.image.existing.attachment"/>
</t>
@@ -263,8 +263,8 @@
</t>
<t t-name="wysiwyg.widgets.document.existing.attachments">
<div class="o_we_documents">
<div class="row mx-auto existing-attachments">
<div class="o_we_existing_attachments o_we_documents">
<div class="row mx-auto">
<t t-foreach="attachments" t-as="attachment">
<div class="col-2 o_existing_attachment_cell o_we_attachment_highlight my-2" t-att-data-id="attachment.id">
<t t-call="wysiwyg.widgets.file.existing.remove"/>
@@ -358,7 +358,7 @@ QUnit.test('background-image', function (assert) {
$('#oe_manipulators .oe_overlay_options a.snippet-option-background[data-choose-image]').click();
defMediaDialogInit.then(function () {
$('.o_select_media_dialog .existing-attachments .o_existing_attachment_cell').click();
$('.o_select_media_dialog .o_we_existing_attachments .o_existing_attachment_cell').click();
$('.o_select_media_dialog .modal-footer .btn-primary').click();
});
@@ -177,7 +177,7 @@ widgetsMedia.ImageWidget.include({
*/
_toggleUnsplashContainer: function (show) {
this._unsplash.isActive = show;
this.$('.existing-attachments').toggleClass('d-none', show);
this.$('.o_we_existing_attachments').toggleClass('d-none', show);
this.$('.unsplash_img_container').toggleClass('d-none', !show);
this.$('.o_we_search_icon > span').text(show ? "Unsplash" : "");
},
@@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve">
<t t-extend="wysiwyg.widgets.file">
<t t-jquery=".existing-attachments" t-operation="after">
<t t-jquery=".o_we_existing_attachments" t-operation="after">
<div class="unsplash_img_container"></div>
</t>
</t>