Siddharth Bhalgami
9 years ago
5 changed files with 61 additions and 75 deletions
-
1web_dialog_size/README.rst
-
15web_dialog_size/__openerp__.py
-
6web_dialog_size/static/src/css/web_dialog_size.css
-
59web_dialog_size/static/src/js/web_dialog_size.js
-
7web_dialog_size/view/qweb.xml
@ -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(); |
|||
}, |
|||
|
|||
}); |
|||
|
|||
}; |
|||
}); |
|||
|
|||
}); |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue