diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst new file mode 100644 index 00000000..f508aa0a --- /dev/null +++ b/web_dialog_size/README.rst @@ -0,0 +1,38 @@ +Expand Dialog +============= + +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. + + +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 +`here `_. + + +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..85ee3dda --- /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 lets the user expand a + dialog box to the full screen width.""", + + 'author': "ACSONE SA/NV,Odoo Community Association (OCA)", + '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/description/icon.png b/web_dialog_size/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_dialog_size/static/description/icon.png differ 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