diff --git a/setup/web_dialog_size/odoo/addons/web_dialog_size b/setup/web_dialog_size/odoo/addons/web_dialog_size new file mode 120000 index 000000000..8dcc87d96 --- /dev/null +++ b/setup/web_dialog_size/odoo/addons/web_dialog_size @@ -0,0 +1 @@ +../../../../web_dialog_size \ No newline at end of file diff --git a/setup/web_dialog_size/setup.py b/setup/web_dialog_size/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_dialog_size/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst new file mode 100644 index 000000000..396db182a --- /dev/null +++ b/web_dialog_size/README.rst @@ -0,0 +1,102 @@ +=============== +Web Dialog Size +=============== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/14.0/web_dialog_size + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_dialog_size + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +A module that lets the user expand/restore the dialog box size through a button +in the upper right corner (imitating most windows managers). +It also adds draggable support to the dialogs. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +If you want to set dialog boxes maximized by default, you need to: + +#. Go to *Settings -> Technical -> Parameters -> System Parameters* +#. Add a new record with the text *web_dialog_size.default_maximize* in + the *Key* field and the text *True* in the *Value* field + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ACSONE SA/NV +* Therp BV +* Siddharth Bhalgami +* Tecnativa +* Amaris + +Contributors +~~~~~~~~~~~~ + +* Anthony Muschang +* Stéphane Bidoul +* Holger Brunn +* Siddharth Bhalgami +* Wolfgang Pichler +* David Vidal +* Quentin Theuret +* `Tecnativa `_: + + * Pedro M. Baeza + * Jairo Llopis + * Ernesto Tejeda + +* Sudhir Arya +* Pierre Pizzetta + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_dialog_size/__init__.py b/web_dialog_size/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/web_dialog_size/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_dialog_size/__manifest__.py b/web_dialog_size/__manifest__.py new file mode 100644 index 000000000..5bcaa5346 --- /dev/null +++ b/web_dialog_size/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2015 ACSONE SA/NV +# Copyright 2018 Amaris +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web Dialog Size", + "summary": """ + A module that lets the user expand a + dialog box to the full screen width.""", + "author": "ACSONE SA/NV, " + "Therp BV, " + "Siddharth Bhalgami," + "Tecnativa, " + "Amaris, " + "Odoo Community Association (OCA)", + "website": "http://github.com/OCA/web", + "category": "web", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "depends": ["web"], + "qweb": ["static/src/xml/web_dialog_size.xml"], + "data": ["templates/assets.xml"], + "installable": True, +} diff --git a/web_dialog_size/i18n/web_dialog_size.pot b/web_dialog_size/i18n/web_dialog_size.pot new file mode 100644 index 000000000..355837b3f --- /dev/null +++ b/web_dialog_size/i18n/web_dialog_size.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_dialog_size +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_dialog_size +#: model:ir.model,name:web_dialog_size.model_ir_config_parameter +msgid "System Parameter" +msgstr "" diff --git a/web_dialog_size/i18n/zh_CN.po b/web_dialog_size/i18n/zh_CN.po new file mode 100644 index 000000000..a46f346ce --- /dev/null +++ b/web_dialog_size/i18n/zh_CN.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_dialog_size +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-01 12:52+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: web_dialog_size +#: model:ir.model,name:web_dialog_size.model_ir_config_parameter +msgid "System Parameter" +msgstr "系统参数" diff --git a/web_dialog_size/models/__init__.py b/web_dialog_size/models/__init__.py new file mode 100644 index 000000000..bd3aa9f10 --- /dev/null +++ b/web_dialog_size/models/__init__.py @@ -0,0 +1 @@ +from . import ir_config_parameter diff --git a/web_dialog_size/models/ir_config_parameter.py b/web_dialog_size/models/ir_config_parameter.py new file mode 100644 index 000000000..493a4f6fb --- /dev/null +++ b/web_dialog_size/models/ir_config_parameter.py @@ -0,0 +1,18 @@ +# Copyright 2018 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.models import Model, api +from odoo.tools.safe_eval import const_eval + + +class IrConfigParameter(Model): + _inherit = "ir.config_parameter" + + @api.model + def get_web_dialog_size_config(self): + get_param = self.sudo().get_param + return { + "default_maximize": const_eval( + get_param("web_dialog_size.default_maximize", "False") + ) + } diff --git a/web_dialog_size/readme/CONFIGURATION.rst b/web_dialog_size/readme/CONFIGURATION.rst new file mode 100644 index 000000000..18b1ad078 --- /dev/null +++ b/web_dialog_size/readme/CONFIGURATION.rst @@ -0,0 +1,3 @@ +By default, the module respects the caller's ``dialog_size`` option. +If you want to override this and have all dialogs maximized by default, +set the configuration parameter ``web_dialog_size.default_maximize`` to ``1``. diff --git a/web_dialog_size/readme/CONFIGURE.rst b/web_dialog_size/readme/CONFIGURE.rst new file mode 100644 index 000000000..902f3316e --- /dev/null +++ b/web_dialog_size/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +If you want to set dialog boxes maximized by default, you need to: + +#. Go to *Settings -> Technical -> Parameters -> System Parameters* +#. Add a new record with the text *web_dialog_size.default_maximize* in + the *Key* field and the text *True* in the *Value* field diff --git a/web_dialog_size/readme/CONTRIBUTORS.rst b/web_dialog_size/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9da11ab82 --- /dev/null +++ b/web_dialog_size/readme/CONTRIBUTORS.rst @@ -0,0 +1,15 @@ +* Anthony Muschang +* Stéphane Bidoul +* Holger Brunn +* Siddharth Bhalgami +* Wolfgang Pichler +* David Vidal +* Quentin Theuret +* `Tecnativa `_: + + * Pedro M. Baeza + * Jairo Llopis + * Ernesto Tejeda + +* Sudhir Arya +* Pierre Pizzetta diff --git a/web_dialog_size/readme/DESCRIPTION.rst b/web_dialog_size/readme/DESCRIPTION.rst new file mode 100644 index 000000000..398e72f50 --- /dev/null +++ b/web_dialog_size/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +A module that lets the user expand/restore the dialog box size through a button +in the upper right corner (imitating most windows managers). +It also adds draggable support to the dialogs. diff --git a/web_dialog_size/static/description/icon.png b/web_dialog_size/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_dialog_size/static/description/icon.png differ diff --git a/web_dialog_size/static/description/index.html b/web_dialog_size/static/description/index.html new file mode 100644 index 000000000..2b0c147fe --- /dev/null +++ b/web_dialog_size/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +Web Dialog Size + + + +
+

Web Dialog Size

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

A module that lets the user expand/restore the dialog box size through a button +in the upper right corner (imitating most windows managers). +It also adds draggable support to the dialogs.

+

Table of contents

+ +
+

Configuration

+

If you want to set dialog boxes maximized by default, you need to:

+
    +
  1. Go to Settings -> Technical -> Parameters -> System Parameters
  2. +
  3. +
    Add a new record with the text web_dialog_size.default_maximize in
    +
    the Key field and the text True in the Value field
    +
    +
  4. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
  • Therp BV
  • +
  • Siddharth Bhalgami
  • +
  • Tecnativa
  • +
  • Amaris
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_dialog_size/static/src/js/web_dialog_size.js b/web_dialog_size/static/src/js/web_dialog_size.js new file mode 100644 index 000000000..02f1a6f17 --- /dev/null +++ b/web_dialog_size/static/src/js/web_dialog_size.js @@ -0,0 +1,69 @@ +odoo.define("web_dialog_size.web_dialog_size", function (require) { + "use strict"; + + var rpc = require("web.rpc"); + var Dialog = require("web.Dialog"); + + var config = rpc.query({ + model: "ir.config_parameter", + method: "get_web_dialog_size_config", + }); + + Dialog.include({ + willStart: function () { + var self = this; + return this._super.apply(this, arguments).then(function () { + self.$modal + .find(".dialog_button_extend") + .on("click", self.proxy("_extending")); + self.$modal + .find(".dialog_button_restore") + .on("click", self.proxy("_restore")); + return config.then(function (r) { + if (r.default_maximize) { + self._extending(); + } else { + self._restore(); + } + }); + }); + }, + + opened: function () { + return this._super.apply(this, arguments).then( + function () { + if (this.$modal) { + this.$modal.find(">:first-child").draggable({ + handle: ".modal-header", + helper: false, + }); + } + }.bind(this) + ); + }, + + close: function () { + if (this.$modal) { + var draggable = this.$modal.find(">:first-child").draggable("instance"); + if (draggable) { + this.$modal.find(">:first-child").draggable("destroy"); + } + } + return this._super.apply(this, arguments); + }, + + _extending: function () { + var dialog = this.$modal.find(".modal-dialog"); + dialog.addClass("dialog_full_screen"); + dialog.find(".dialog_button_extend").hide(); + dialog.find(".dialog_button_restore").show(); + }, + + _restore: function () { + var dialog = this.$modal.find(".modal-dialog"); + dialog.removeClass("dialog_full_screen"); + dialog.find(".dialog_button_restore").hide(); + dialog.find(".dialog_button_extend").show(); + }, + }); +}); diff --git a/web_dialog_size/static/src/scss/web_dialog_size.scss b/web_dialog_size/static/src/scss/web_dialog_size.scss new file mode 100644 index 000000000..abf3aba73 --- /dev/null +++ b/web_dialog_size/static/src/scss/web_dialog_size.scss @@ -0,0 +1,24 @@ +.modal { + .dialog_full_screen { + @include media-breakpoint-up(sm) { + max-width: 100%; + width: calc(100% - 50px); + } + } + .modal-header button.close { + font-size: 18px; + + &:not(.dialog_button_extend):not(.dialog_button_restore) { + @include media-breakpoint-up(sm) { + margin-left: 15px; + } + } + + &.dialog_button_extend, + .dialog_button_restore { + @include media-breakpoint-down(sm) { + display: none !important; + } + } + } +} diff --git a/web_dialog_size/static/src/xml/web_dialog_size.xml b/web_dialog_size/static/src/xml/web_dialog_size.xml new file mode 100644 index 000000000..d43a79b73 --- /dev/null +++ b/web_dialog_size/static/src/xml/web_dialog_size.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/web_dialog_size/templates/assets.xml b/web_dialog_size/templates/assets.xml new file mode 100644 index 000000000..cb68c4697 --- /dev/null +++ b/web_dialog_size/templates/assets.xml @@ -0,0 +1,19 @@ + + +