Browse Source

[9.0] [PORT] web_send_message_popup

pull/369/head
Yannick Vaucher 8 years ago
parent
commit
ac15504381
  1. 59
      web_send_message_popup/README.rst
  2. 46
      web_send_message_popup/__openerp__.py
  3. 29
      web_send_message_popup/static/src/js/chatter.js
  4. 11
      web_send_message_popup/static/src/xml/mail.xml
  5. 8
      web_send_message_popup/views/web_send_message_popup.xml

59
web_send_message_popup/README.rst

@ -0,0 +1,59 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=========================
Web Send Message as Popup
=========================
In the email/notes threads below the form views, the link 'Send a
message' unfold a text field. From there, a button allows to open the
text field in a full featured email popup with the subject, templates,
attachments and followers.
This module changes the link 'Send a message' so it opens directly the
full featured popup instead of the text field, avoiding an extra click
if the popup is always wanted.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/9.0
Bug Tracker
===========
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. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

46
web_send_message_popup/__openerp__.py

@ -1,49 +1,17 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2014-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{'name': 'Web Send Message as Popup',
'version': '1.0',
'author': "Camptocamp,Odoo Community Association (OCA)",
'version': '9.0.1.0.0',
'author': "Camptocamp, Odoo Community Association (OCA)",
'maintainer': 'Camptocamp',
'license': 'AGPL-3',
'category': 'Hidden',
'depends': ['web',
],
'description': """
Web Send Message as Popup
=========================
In the email/notes threads below the form views, the link 'Send a
message' unfold a text field. From there, a button allows to open the
text field in a full featured email popup with the subject, templates,
attachments and followers.
This module changes the link 'Send a message' so it opens directly the
full featured popup instead of the text field, avoiding an extra click
if the popup is always wanted.
""",
'website': 'http://www.camptocamp.com',
'qweb': ['static/src/xml/mail.xml',
'data': ['views/web_send_message_popup.xml'
],
'installable': False,
'installable': True,
'auto_install': False,
}
}

29
web_send_message_popup/static/src/js/chatter.js

@ -0,0 +1,29 @@
/* © 2016 Camptocamp SA
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web_send_message_popup.Chatter', function (require) {
"use strict";
var core = require('web.core');
var composer = require('mail.composer');
var Chatter = core.form_widget_registry.get('mail_thread');
Chatter.include({
on_open_composer_new_message: function () {
var self = this;
this.open_composer();
// wait for composer input to be initialized
// taken from http://stackoverflow.com/questions/7307983/while-variable-is-not-defined-wait
function checkVariable() {
if (typeof self.composer !== 'undefined' && typeof self.composer.$input !== 'undefined') {
self.composer.on_open_full_composer();
}
else {
setTimeout(function() {
checkVariable();
}, 50);
}
}
checkVariable();
}
});
});

11
web_send_message_popup/static/src/xml/mail.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<t t-extend="mail.compose_message">
<t t-jquery="a.oe_compose_post:eq(0)" t-operation="replace">
<a class="oe_compose_post oe_full" t-if="widget.options.compose_placeholder"><t t-raw="widget.options.compose_placeholder"/></a>
</t>
<t t-jquery="a.oe_compose_post:eq(1)" t-operation="replace">
<a class="oe_compose_post oe_full" t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox">Send a message</a>
</t>
</t>
</template>

8
web_send_message_popup/views/web_send_message_popup.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend" name="web_send_message_popup assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_send_message_popup/static/src/js/chatter.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save