Browse Source

[MIG] web_dialog_siza: Migrate to v9.0

pull/1110/head
Siddharth Bhalgami 9 years ago
committed by Pedro M. Baeza
parent
commit
5c6384bc45
  1. 1
      web_dialog_size/README.rst
  2. 14
      web_dialog_size/__openerp__.py
  3. 6
      web_dialog_size/static/src/css/web_dialog_size.css
  4. 59
      web_dialog_size/static/src/js/web_dialog_size.js
  5. 7
      web_dialog_size/view/qweb.xml

1
web_dialog_size/README.rst

@ -21,6 +21,7 @@ Contributors
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Holger Brunn <hbrunn@therp.nl>
* Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
Maintainer
----------

14
web_dialog_size/__openerp__.py

@ -28,14 +28,15 @@
A module that lets the user expand a
dialog box to the full screen width.""",
'author': "ACSONE SA/NV,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza,"
"Therp BV,"
"Odoo Community Association (OCA)",
'website': "http://acsone.eu",
'author': "ACSONE SA/NV, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Therp BV, "
"Odoo Community Association (OCA), "
"Siddharth Bhalgami",
'website': "http://acsone.eu",
'category': 'web',
'version': '8.0.0.1.0',
'version': '9.0.1.0.0',
'license': 'AGPL-3',
'depends': [
@ -47,4 +48,5 @@
'data': [
'view/qweb.xml',
],
'installable': True,
}

6
web_dialog_size/static/src/css/web_dialog_size.css

@ -1,9 +1,9 @@
.modal .modal-header button.dialog_button_extend {
padding-right: 3px;
padding-right: 5px;
}
.modal .modal-header button.dialog_button_restore {
padding-right: 3px;
padding-right: 5px;
}
.dialog_full_screen {
@ -11,5 +11,5 @@
}
.modal .modal-header button.close {
font-size: 14px;
font-size: 18px;
}

59
web_dialog_size/static/src/js/web_dialog_size.js

@ -1,56 +1,41 @@
openerp.web_dialog_size= function (instance) {
instance.web.Dialog = instance.web.Dialog.extend({
init_dialog: function () {
var self = this,
result = this._super();
self.$dialog_box.find('.dialog_button_extend')
.on('click', self.proxy('_extending'));
self.$dialog_box.find('.dialog_button_restore')
.on('click', self.proxy('_restore'));
return jQuery.when(result).then(function()
{
var deferred = null;
if(openerp.web_dialog_size.default_maximize === undefined)
{
deferred = (new openerp.web.Model('ir.config_parameter'))
.call('get_param',
['web_dialog_size.default_maximize'])
.then(function(default_maximize)
{
openerp.web_dialog_size.default_maximize =
default_maximize;
});
}
return jQuery.when(deferred).then(function()
{
if(openerp.web_dialog_size.default_maximize)
{
odoo.define('web_dialog_size.web_dialog_size', function (require) {
'use strict';
var Model = require('web.DataModel');
var Dialog = require('web.Dialog');
Dialog.include({
init: function (parent, options) {
var self = this;
this._super.apply(this, arguments);
self.$modal.find('.dialog_button_extend').on('click', self.proxy('_extending'));
self.$modal.find('.dialog_button_restore').on('click', self.proxy('_restore'));
new Model('ir.config_parameter').query(['key', 'value']).
filter([['key', '=', 'web_dialog_size.default_maximize']]).all().then(function(default_maximize) {
if (default_maximize.length && default_maximize[0]['value'] == 1) {
self._extending();
}
else
{
} else {
self._restore();
}
});
});
},
_extending: function(e) {
_extending: function() {
var dialog = this.$el.parents('.modal-dialog');
dialog.addClass('dialog_full_screen');
dialog.find('.dialog_button_extend').hide();
dialog.find('.dialog_button_restore').show();
},
_restore: function(e) {
_restore: function() {
var dialog = this.$el.parents('.modal-dialog');
dialog.removeClass('dialog_full_screen');
dialog.find('.dialog_button_restore').hide();
dialog.find('.dialog_button_extend').show();
},
});
};
});
});

7
web_dialog_size/view/qweb.xml

@ -1,10 +1,9 @@
<openerp>
<data>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<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>
</odoo>
Loading…
Cancel
Save