Browse Source

[ADD] module web_dialog_size

New module that let the user expand a dialog box to the full screen
width.
pull/1110/head
Anthony Muschang 9 years ago
committed by Pedro M. Baeza
parent
commit
642adc75b3
  1. 38
      web_dialog_size/README.rst
  2. 0
      web_dialog_size/__init__.py
  3. 47
      web_dialog_size/__openerp__.py
  4. BIN
      web_dialog_size/static/description/icon.png
  5. 17
      web_dialog_size/static/src/css/web_dialog_size.css
  6. 37
      web_dialog_size/static/src/js/web_dialog_size.js
  7. 9
      web_dialog_size/static/src/xml/web_dialog_size.xml
  8. 10
      web_dialog_size/view/qweb.xml

38
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 <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
`here <https://github.com/OCA/web/issues/new?body=module:%20web_dialog_size%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Anthony Muschang <anthony.muschang@acsone.eu>
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
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.

0
web_dialog_size/__init__.py

47
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 (<http://acsone.eu>)
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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': '8.0.0.1.0',
'license': 'AGPL-3',
'depends': [
'web',
],
'qweb': [
'static/src/xml/web_dialog_size.xml',
],
'data': [
'view/qweb.xml',
],
}

BIN
web_dialog_size/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

17
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);
}

37
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')
},
});
};

9
web_dialog_size/static/src/xml/web_dialog_size.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="Dialog">
<t t-jquery="button" t-operation="after">
<button type="button" class="dialog_button_extend close">o</button>
<button type="button" class="dialog_button_restore close">-</button>
</t>
</t>
</templates>

10
web_dialog_size/view/qweb.xml

@ -0,0 +1,10 @@
<openerp>
<data>
<template id="assets_backend" name="web_dialog_size assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_dialog_size/static/src/css/web_dialog_size.css"/>
<script type="text/javascript" src="/web_dialog_size/static/src/js/web_dialog_size.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save