From 0b1165943779bb4a8607245de01249a592087122 Mon Sep 17 00:00:00 2001 From: Anthony Muschang Date: Fri, 27 Feb 2015 00:29:22 +0100 Subject: [PATCH 1/3] [ADD] module web_dialog_size New module that let the user expand a dialog box to the full screen width. --- web_dialog_size/README.rst | 28 +++++++++++ web_dialog_size/__init__.py | 0 web_dialog_size/__openerp__.py | 47 +++++++++++++++++++ .../static/src/css/web_dialog_size.css | 17 +++++++ .../static/src/js/web_dialog_size.js | 37 +++++++++++++++ .../static/src/xml/web_dialog_size.xml | 9 ++++ web_dialog_size/view/qweb.xml | 10 ++++ 7 files changed, 148 insertions(+) create mode 100644 web_dialog_size/README.rst create mode 100644 web_dialog_size/__init__.py create mode 100644 web_dialog_size/__openerp__.py create mode 100644 web_dialog_size/static/src/css/web_dialog_size.css create mode 100644 web_dialog_size/static/src/js/web_dialog_size.js create mode 100644 web_dialog_size/static/src/xml/web_dialog_size.xml create mode 100644 web_dialog_size/view/qweb.xml diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst new file mode 100644 index 00000000..b9fc24ef --- /dev/null +++ b/web_dialog_size/README.rst @@ -0,0 +1,28 @@ +Expand Dialog +============= + +A module that let the user expand a dialog box to the full screen width. + +It is named web_dialog_size as it could be extended to propose other dialog size management feature. + +Credits +======= + +Contributors +------------ + +* Anthony Muschang +* Stéphane Bidoul + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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 http://odoo-community.org. \ No newline at end of file diff --git a/web_dialog_size/__init__.py b/web_dialog_size/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_dialog_size/__openerp__.py b/web_dialog_size/__openerp__.py new file mode 100644 index 00000000..0f65f8a5 --- /dev/null +++ b/web_dialog_size/__openerp__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This file is part of web_dialog_sizes, an Odoo module. +# +# Copyright (c) 2015 ACSONE SA/NV () +# +# web_expand_dialog 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. +# +# web_expand_dialog 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 web_expand_dialog. +# If not, see . +# +############################################################################## +{ + 'name': "Web Dialog Size", + + 'summary': """ + A module that let the user expand a + dialog box to the full screen width.""", + + 'author': "ACSONE SA/NV", + 'website': "http://acsone.eu", + + 'category': 'web', + 'version': '0.1', + 'license': 'AGPL-3', + + 'depends': [ + 'web', + ], + 'qweb': [ + 'static/src/xml/web_dialog_size.xml', + ], + 'data': [ + 'view/qweb.xml', + ], +} diff --git a/web_dialog_size/static/src/css/web_dialog_size.css b/web_dialog_size/static/src/css/web_dialog_size.css new file mode 100644 index 00000000..10fba0f0 --- /dev/null +++ b/web_dialog_size/static/src/css/web_dialog_size.css @@ -0,0 +1,17 @@ +.modal .modal-header button.dialog_button_extend { + padding-top: 0px; + padding-right: 3px; +} + +.modal .modal-header button.dialog_button_restore { + padding-top: 1px; + padding-right: 5px; +} + +.modal .modal-header .dialog_button_hide { + display: none; +} + +.dialog_full_screen { + width: calc(100% - 50px); +} \ No newline at end of file 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 00000000..d1d0299c --- /dev/null +++ b/web_dialog_size/static/src/js/web_dialog_size.js @@ -0,0 +1,37 @@ +openerp.web_dialog_size= function (instance) { + + instance.web.Dialog = instance.web.Dialog.extend({ + + init_dialog: function () { + var self = this; + this._super(); + self.$dialog_box.find('.dialog_button_restore').addClass('dialog_button_hide'); + if (this.dialog_options.size !== 'large'){ + self.$dialog_box.find('.dialog_button_extend').addClass('dialog_button_hide'); + } + else{ + self.$dialog_box.find('.dialog_button_extend').on('click', self._extending); + self.$dialog_box.find('.dialog_button_restore').on('click', self._restore); + } + }, + + _extending: function() { + var self = this; + $(this).parents('.modal-dialog').addClass('dialog_full_screen'); + $(this).addClass('dialog_button_hide'); + + $(this).parents('.modal-dialog').find('.dialog_button_restore').removeClass('dialog_button_hide') + }, + + _restore: function() { + var self = this; + $(this).parents('.modal-dialog').removeClass('dialog_full_screen'); + $(this).addClass('dialog_button_hide'); + + $(this).parents('.modal-dialog').find('.dialog_button_extend').removeClass('dialog_button_hide') + }, + + }); + +}; + 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 00000000..1808dd2a --- /dev/null +++ b/web_dialog_size/static/src/xml/web_dialog_size.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/web_dialog_size/view/qweb.xml b/web_dialog_size/view/qweb.xml new file mode 100644 index 00000000..31dcd70f --- /dev/null +++ b/web_dialog_size/view/qweb.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file From 427da0c39e339fe077c3fb8644c3d24ba94a5756 Mon Sep 17 00:00:00 2001 From: "Anthony Muschang (ACSONE)" Date: Mon, 2 Mar 2015 10:17:27 +0100 Subject: [PATCH 2/3] [FIX] web_dialog_size: fix typo in module summary --- web_dialog_size/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_dialog_size/__openerp__.py b/web_dialog_size/__openerp__.py index 0f65f8a5..5fd1f3fc 100644 --- a/web_dialog_size/__openerp__.py +++ b/web_dialog_size/__openerp__.py @@ -25,7 +25,7 @@ 'name': "Web Dialog Size", 'summary': """ - A module that let the user expand a + A module that lets the user expand a dialog box to the full screen width.""", 'author': "ACSONE SA/NV", From fccfd889589d5183757879e666461707da6df3e0 Mon Sep 17 00:00:00 2001 From: Anthony Muschang Date: Mon, 2 Mar 2015 13:14:13 +0100 Subject: [PATCH 3/3] [FIX] web_dialog_size: fix typo in module summary --- web_dialog_size/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index b9fc24ef..3d73cdea 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -1,7 +1,7 @@ Expand Dialog ============= -A module that let the user expand a dialog box to the full screen width. +A module that lets the user expand a dialog box to the full screen width. It is named web_dialog_size as it could be extended to propose other dialog size management feature.