forked from Techsystech/web
[FIX] prevent drop when no record id is found
[UPD] Update web_drop_target.pot [UPD] README.rst Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: web-13.0/web-13.0-web_drop_target Translate-URL: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_drop_target/14.0
parent
613e8b1f4a
commit
10509eb374
|
@ -14,13 +14,13 @@ Drop target support
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/web/tree/12.0/web_drop_target
|
:target: https://github.com/OCA/web/tree/13.0/web_drop_target
|
||||||
:alt: OCA/web
|
:alt: OCA/web
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_drop_target
|
:target: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_drop_target
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/162/12.0
|
:target: https://runbot.odoo-community.org/runbot/162/13.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -69,7 +69,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_drop_target%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_drop_target%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -102,6 +102,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/12.0/web_drop_target>`_ project on GitHub.
|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/13.0/web_drop_target>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -18,7 +18,14 @@ msgstr ""
|
||||||
|
|
||||||
#. module: web_drop_target
|
#. module: web_drop_target
|
||||||
#. openerp-web
|
#. openerp-web
|
||||||
#: code:addons/web_drop_target/static/src/xml/widgets.xml:11
|
#: code:addons/web_drop_target/static/src/xml/widgets.xml:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Drop your files here"
|
msgid "Drop your files here"
|
||||||
msgstr "Déposez les fichiers ici"
|
msgstr "Déposez les fichiers ici"
|
||||||
|
|
||||||
|
#. module: web_drop_target
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/web_drop_target/static/src/xml/widgets.xml:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please save the record before dropping a file"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# Translation of Odoo Server.
|
# Translation of Odoo Server.
|
||||||
# This file contains the translation of the following modules:
|
# This file contains the translation of the following modules:
|
||||||
# * web_drop_target
|
# * web_drop_target
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -15,8 +15,14 @@ msgstr ""
|
||||||
|
|
||||||
#. module: web_drop_target
|
#. module: web_drop_target
|
||||||
#. openerp-web
|
#. openerp-web
|
||||||
#: code:addons/web_drop_target/static/src/xml/widgets.xml:11
|
#: code:addons/web_drop_target/static/src/xml/widgets.xml:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Drop your files here"
|
msgid "Drop your files here"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: web_drop_target
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/web_drop_target/static/src/xml/widgets.xml:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please save the record before dropping a file"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_drop_target"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_drop_target"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_drop_target"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_drop_target"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module extends the functionality of the web client to support dropping local files into the web client.</p>
|
<p>This module extends the functionality of the web client to support dropping local files into the web client.</p>
|
||||||
<p>By default, an attachment will be created when dropping a file on a form.</p>
|
<p>By default, an attachment will be created when dropping a file on a form.</p>
|
||||||
<p>Further, this module is meant as a base drag&drop module supporting other actions after some file is dropped so that other modules can add more features.</p>
|
<p>Further, this module is meant as a base drag&drop module supporting other actions after some file is dropped so that other modules can add more features.</p>
|
||||||
|
@ -417,7 +417,7 @@ ul.auto-toc {
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_drop_target%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_drop_target%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -444,7 +444,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_drop_target">OCA/web</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_drop_target">OCA/web</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
//Copyright 2018 Therp BV <https://therp.nl>
|
// Copyright 2018 Therp BV <https://therp.nl>
|
||||||
//License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
/*global Uint8Array base64js*/
|
/* global Uint8Array base64js*/
|
||||||
|
|
||||||
odoo.define('web_drop_target', function(require) {
|
odoo.define("web_drop_target", function(require) {
|
||||||
var FormController = require('web.FormController');
|
"use strict";
|
||||||
var core = require('web.core');
|
|
||||||
|
var FormController = require("web.FormController");
|
||||||
|
var core = require("web.core");
|
||||||
var qweb = core.qweb;
|
var qweb = core.qweb;
|
||||||
|
|
||||||
// This is the main contribution of this addon: A mixin you can use
|
// This is the main contribution of this addon: A mixin you can use
|
||||||
|
@ -18,15 +20,15 @@ odoo.define('web_drop_target', function(require) {
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
var result = this._super.apply(this, arguments);
|
var result = this._super.apply(this, arguments);
|
||||||
this.$el.on('drop.widget_events', this.proxy('_on_drop'));
|
this.$el.on("drop.widget_events", this.proxy("_on_drop"));
|
||||||
this.$el.on('dragenter.widget_events', this.proxy('_on_dragenter'));
|
this.$el.on("dragenter.widget_events", this.proxy("_on_dragenter"));
|
||||||
this.$el.on('dragover.widget_events', this.proxy('_on_dragenter'));
|
this.$el.on("dragover.widget_events", this.proxy("_on_dragenter"));
|
||||||
this.$el.on('dragleave.widget_events', this.proxy('_on_dragleave'));
|
this.$el.on("dragleave.widget_events", this.proxy("_on_dragleave"));
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_on_drop: function(e) {
|
_on_drop: function(e) {
|
||||||
if (!this._drop_overlay){
|
if (!this._drop_overlay) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var drop_items = this._get_drop_items(e);
|
var drop_items = this._get_drop_items(e);
|
||||||
|
@ -35,7 +37,7 @@ odoo.define('web_drop_target', function(require) {
|
||||||
if (!drop_items) {
|
if (!drop_items) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._handle_drop_items(drop_items, e)
|
this._handle_drop_items(drop_items, e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_on_dragenter: function(e) {
|
_on_dragenter: function(e) {
|
||||||
|
@ -50,21 +52,24 @@ odoo.define('web_drop_target', function(require) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_get_drop_items: function(e) {
|
_get_drop_items: function(e) {
|
||||||
var self = this,
|
if (this.renderer.state.res_id) {
|
||||||
dataTransfer = e.originalEvent.dataTransfer,
|
var self = this,
|
||||||
drop_items = [];
|
dataTransfer = e.originalEvent.dataTransfer,
|
||||||
_.each(dataTransfer.files, function(item) {
|
drop_items = [];
|
||||||
if (
|
_.each(dataTransfer.files, function(item) {
|
||||||
_.contains(self._drop_allowed_types, item.type) ||
|
if (
|
||||||
_.isEmpty(self._drop_allowed_types)
|
_.contains(self._drop_allowed_types, item.type) ||
|
||||||
) {
|
_.isEmpty(self._drop_allowed_types)
|
||||||
drop_items.push(item);
|
) {
|
||||||
}
|
drop_items.push(item);
|
||||||
});
|
}
|
||||||
return drop_items;
|
});
|
||||||
|
return drop_items;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
_handle_drop_items: function(drop_items, e) {
|
_handle_drop_items: function(drop_items, e) {
|
||||||
// Do something here, for example call the helper function below
|
// Do something here, for example call the helper function below
|
||||||
// e is the on_load_end handler for the FileReader above,
|
// e is the on_load_end handler for the FileReader above,
|
||||||
|
@ -75,38 +80,38 @@ odoo.define('web_drop_target', function(require) {
|
||||||
// Helper to upload an attachment and update the sidebar
|
// Helper to upload an attachment and update the sidebar
|
||||||
var self = this;
|
var self = this;
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
model: 'ir.attachment',
|
model: "ir.attachment",
|
||||||
method: 'create',
|
method: "create",
|
||||||
args: [
|
args: [
|
||||||
_.extend({
|
_.extend(
|
||||||
name: file.name,
|
{
|
||||||
datas: base64js.fromByteArray(
|
name: file.name,
|
||||||
new Uint8Array(reader.result)
|
datas: base64js.fromByteArray(
|
||||||
),
|
new Uint8Array(reader.result)
|
||||||
res_model: res_model,
|
),
|
||||||
res_id: res_id,
|
res_model: res_model,
|
||||||
}, extra_data || {})
|
res_id: res_id,
|
||||||
|
},
|
||||||
|
extra_data || {}
|
||||||
|
),
|
||||||
],
|
],
|
||||||
})
|
}).then(function() {
|
||||||
.then(function() {
|
|
||||||
// Find the chatter among the children, there should be only
|
// Find the chatter among the children, there should be only
|
||||||
// one
|
// one
|
||||||
var res = _.filter(self.getChildren(), 'chatter')
|
var res = _.filter(self.getChildren(), "chatter");
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
res[0].chatter._reloadAttachmentBox();
|
res[0].chatter._reloadAttachmentBox();
|
||||||
res[0].chatter.trigger_up('reload');
|
res[0].chatter.trigger_up("reload");
|
||||||
res[0].chatter.$('.o_chatter_button_attachment').click();
|
res[0].chatter.$(".o_chatter_button_attachment").click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_file_reader_error_handler: function(e){
|
_file_reader_error_handler: function(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handle_file_drop_attach: function(
|
_handle_file_drop_attach: function(item, e, res_model, res_id, extra_data) {
|
||||||
item, e, res_model, res_id, extra_data
|
|
||||||
) {
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var file = item;
|
var file = item;
|
||||||
if (!file || !(file instanceof Blob)) {
|
if (!file || !(file instanceof Blob)) {
|
||||||
|
@ -114,26 +119,40 @@ odoo.define('web_drop_target', function(require) {
|
||||||
}
|
}
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = self.proxy(
|
reader.onloadend = self.proxy(
|
||||||
_.partial(self._create_attachment, file, reader, e, res_model, res_id, extra_data)
|
_.partial(
|
||||||
|
self._create_attachment,
|
||||||
|
file,
|
||||||
|
reader,
|
||||||
|
e,
|
||||||
|
res_model,
|
||||||
|
res_id,
|
||||||
|
extra_data
|
||||||
|
)
|
||||||
);
|
);
|
||||||
reader.onerror = self.proxy('_file_reader_error_handler');
|
reader.onerror = self.proxy("_file_reader_error_handler");
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(file);
|
||||||
},
|
},
|
||||||
|
|
||||||
_add_overlay: function() {
|
_add_overlay: function() {
|
||||||
if (!this._drop_overlay){
|
var self = this;
|
||||||
var o_content = jQuery('.o_content'),
|
if (!this._drop_overlay) {
|
||||||
view_manager = jQuery('.o_view_manager_content');
|
var o_content = jQuery(".o_content"),
|
||||||
|
view_manager = jQuery(".o_view_manager_content");
|
||||||
this._drop_overlay = jQuery(
|
this._drop_overlay = jQuery(
|
||||||
qweb.render('web_drop_target.drop_overlay')
|
qweb.render("web_drop_target.drop_overlay", {
|
||||||
|
id: self.renderer.state.res_id,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
var o_content_position = o_content.position();
|
var o_content_position = o_content.position();
|
||||||
this._drop_overlay.css({
|
this._drop_overlay.css({
|
||||||
'top': o_content_position.top,
|
top: o_content_position.top,
|
||||||
'left': o_content_position.left,
|
left: o_content_position.left,
|
||||||
'width': view_manager.width(),
|
width: view_manager.width(),
|
||||||
'height': view_manager.height()
|
height: view_manager.height(),
|
||||||
});
|
});
|
||||||
|
if (!this.renderer.state.res_id) {
|
||||||
|
this._drop_overlay.css("background", "#FF000020");
|
||||||
|
}
|
||||||
o_content.append(this._drop_overlay);
|
o_content.append(this._drop_overlay);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -143,32 +162,29 @@ odoo.define('web_drop_target', function(require) {
|
||||||
this._drop_overlay.remove();
|
this._drop_overlay.remove();
|
||||||
this._drop_overlay = null;
|
this._drop_overlay = null;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// And here we apply the mixin to form views, allowing any files and
|
// And here we apply the mixin to form views, allowing any files and
|
||||||
// adding them as attachment
|
// adding them as attachment
|
||||||
FormController.include(_.extend(DropTargetMixin, {
|
FormController.include(
|
||||||
_get_drop_file: function() {
|
_.extend(DropTargetMixin, {
|
||||||
// Disable drag&drop when we're on an unsaved record
|
// eslint-disable-next-line no-unused-vars
|
||||||
if (!this.datarecord.id) {
|
_handle_drop_items: function(drop_items, e) {
|
||||||
return null;
|
var self = this;
|
||||||
}
|
_.each(drop_items, function(item, e) {
|
||||||
return this._super.apply(this, arguments);
|
return self._handle_file_drop_attach(
|
||||||
},
|
item,
|
||||||
_handle_drop_items: function(drop_items, e) {
|
e,
|
||||||
var self = this;
|
self.renderer.state.model,
|
||||||
_.each(drop_items, function(item, e) {
|
self.renderer.state.res_id
|
||||||
return self._handle_file_drop_attach(
|
);
|
||||||
item, e, self.renderer.state.model,
|
});
|
||||||
self.renderer.state.res_id
|
},
|
||||||
);
|
})
|
||||||
});
|
);
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'DropTargetMixin': DropTargetMixin,
|
DropTargetMixin: DropTargetMixin,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
.o_content {
|
.o_content {
|
||||||
.o_drag_over{
|
.o_drag_over {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgba(255,255,255,0.6);
|
background-color: rgba(255, 255, 255, 0.6);
|
||||||
border: 1px dashed #4c4c4c;
|
border: 1px dashed #4c4c4c;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
.o_drag_over_content{
|
.o_drag_over_content {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(0%, -50%);
|
transform: translate(0%, -50%);
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<t t-name="web_drop_target.drop_overlay">
|
<t t-name="web_drop_target.drop_overlay">
|
||||||
<div class="o_drag_over">
|
<div class="o_drag_over">
|
||||||
<div class="o_drag_over_content">
|
<div class="o_drag_over_content">
|
||||||
<div>
|
<div>
|
||||||
<i class="fa fa-file-o fa-5x" aria-hidden="true"></i>
|
<i class="fa fa-file-o fa-5x" aria-hidden="true" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>Drop your files here</h2>
|
<t t-if="id">
|
||||||
|
<h2>Drop your files here</h2>
|
||||||
|
</t>
|
||||||
|
<t t-else="">
|
||||||
|
<h2>Please save the record before dropping a file</h2>
|
||||||
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="assets_backend" name="web_drop_target assets" inherit_id="web.assets_backend">
|
<template
|
||||||
|
id="assets_backend"
|
||||||
|
name="web_drop_target assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<script type="text/javascript" src="/web_drop_target/static/lib/base64js.min.js"></script>
|
<script
|
||||||
<script type="text/javascript" src="/web_drop_target/static/src/js/web_drop_target.js"></script>
|
type="text/javascript"
|
||||||
<link rel="stylesheet" href="/web_drop_target/static/src/less/web_drop_target.less"/>
|
src="/web_drop_target/static/lib/base64js.min.js"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/web_drop_target/static/src/js/web_drop_target.js"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/web_drop_target/static/src/less/web_drop_target.less"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
Loading…
Reference in New Issue