summaryrefslogtreecommitdiff
path: root/addons/web_unsplash
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-05-23 14:47:40 +0000
committerSébastien Theys <seb@odoo.com>2019-05-27 16:32:52 +0000
commit8ab696dc824bdcb832d81f2540dd7030dd291d0a (patch)
tree8a62cf0a31f9dfd6305991b02d87dea334689bf1 /addons/web_unsplash
parentd25d3324e2ae105429a965c8f9cfb08c861e95d9 (diff)
[IMP] web_editor, web_unsplash: split media widget (image & document)
The common code is kept in a generic File widget, while the split allows for easier customization. PR: #33509
Diffstat (limited to 'addons/web_unsplash')
-rw-r--r--addons/web_unsplash/static/src/js/unsplash_image_widget.js24
-rw-r--r--addons/web_unsplash/static/src/xml/unsplash_image_widget.xml2
2 files changed, 11 insertions, 15 deletions
diff --git a/addons/web_unsplash/static/src/js/unsplash_image_widget.js b/addons/web_unsplash/static/src/js/unsplash_image_widget.js
index 3c0d1964513..5f5100c3da2 100644
--- a/addons/web_unsplash/static/src/js/unsplash_image_widget.js
+++ b/addons/web_unsplash/static/src/js/unsplash_image_widget.js
@@ -56,9 +56,7 @@ widgetsMedia.ImageWidget.include({
* @override
*/
start: function () {
- if (!this.options.document) {
- this.$('.o_we_search_icon').replaceWith(core.qweb.render('web_unsplash.dialog.media.search_icon'));
- }
+ this.$('.o_we_search_icon').replaceWith(core.qweb.render('web_unsplash.dialog.media.search_icon'));
return this._super.apply(this, arguments);
},
/**
@@ -286,18 +284,16 @@ widgetsMedia.ImageWidget.include({
* @override
*/
_onSearchInput: function (ev) {
- if (!this.options.document) {
- var $input = $(ev.currentTarget);
- var inputValue = $input.val();
- this.$('.o_search_value_input').text(inputValue);
+ var $input = $(ev.currentTarget);
+ var inputValue = $input.val();
+ this.$('.o_search_value_input').text(inputValue);
- var $icon = this.$('.o_we_search_icon');
- if ($icon.parent().is('.show')) {
- $icon.dropdown('update');
- } else if (!this.hasSearched) {
- $icon.dropdown('toggle');
- $input.focus();
- }
+ var $icon = this.$('.o_we_search_icon');
+ if ($icon.parent().is('.show')) {
+ $icon.dropdown('update');
+ } else if (!this.hasSearched) {
+ $icon.dropdown('toggle');
+ $input.focus();
}
this._super.apply(this, arguments);
},
diff --git a/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml b/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml
index dc680ef00c4..6ecf304034b 100644
--- a/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml
+++ b/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
-<t t-extend="wysiwyg.widgets.image">
+<t t-extend="wysiwyg.widgets.file">
<t t-jquery=".existing-attachments" t-operation="after">
<div class="unsplash_img_container"></div>
</t>