Browse Source
Merge pull request #356 from bud-e/9.0-web_dialog_size
Merge pull request #356 from bud-e/9.0-web_dialog_size
[MIG] web_dialog_size: Migrate to v9.0pull/386/head
Pedro M. Baeza
8 years ago
committed by
GitHub
6 changed files with 85 additions and 76 deletions
-
25web_dialog_size/README.rst
-
12web_dialog_size/__openerp__.py
-
12web_dialog_size/static/src/css/web_dialog_size.css
-
52web_dialog_size/static/src/js/web_dialog_size.js
-
9web_dialog_size/static/src/xml/web_dialog_size.xml
-
7web_dialog_size/view/qweb.xml
@ -1,17 +1,15 @@ |
|||||
.modal .modal-header button.dialog_button_extend { |
.modal .modal-header button.dialog_button_extend { |
||||
padding-top: 0px; |
|
||||
padding-right: 3px; |
|
||||
|
padding-right: 5px; |
||||
} |
} |
||||
|
|
||||
.modal .modal-header button.dialog_button_restore { |
.modal .modal-header button.dialog_button_restore { |
||||
padding-top: 1px; |
|
||||
padding-right: 5px; |
padding-right: 5px; |
||||
} |
} |
||||
|
|
||||
.modal .modal-header .dialog_button_hide { |
|
||||
display: none; |
|
||||
} |
|
||||
|
|
||||
.dialog_full_screen { |
.dialog_full_screen { |
||||
width: calc(100% - 50px); |
width: calc(100% - 50px); |
||||
} |
} |
||||
|
|
||||
|
.modal .modal-header button.close { |
||||
|
font-size: 18px; |
||||
|
} |
@ -1,37 +1,41 @@ |
|||||
openerp.web_dialog_size= function (instance) { |
|
||||
|
odoo.define('web_dialog_size.web_dialog_size', function (require) { |
||||
|
'use strict'; |
||||
|
|
||||
instance.web.Dialog = instance.web.Dialog.extend({ |
|
||||
|
var Model = require('web.DataModel'); |
||||
|
var Dialog = require('web.Dialog'); |
||||
|
|
||||
init_dialog: function () { |
|
||||
|
Dialog.include({ |
||||
|
|
||||
|
init: function (parent, options) { |
||||
var self = this; |
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); |
|
||||
|
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 { |
||||
|
self._restore(); |
||||
} |
} |
||||
|
}); |
||||
}, |
}, |
||||
|
|
||||
_extending: function() { |
_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') |
|
||||
|
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() { |
_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') |
|
||||
|
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,9 +1,12 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<templates id="template" xml:space="preserve"> |
<templates id="template" xml:space="preserve"> |
||||
<t t-extend="Dialog"> |
<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-jquery="button.close" t-operation="inner"> |
||||
|
<i class="fa fa-close" /> |
||||
|
</t> |
||||
|
<t t-jquery="button.close" t-operation="after"> |
||||
|
<button type="button" class="dialog_button_extend close"><i class="fa fa-expand" /></button> |
||||
|
<button type="button" class="dialog_button_restore close"><i class="fa fa-compress" /></button> |
||||
</t> |
</t> |
||||
</t> |
</t> |
||||
</templates> |
</templates> |
@ -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"> |
<template id="assets_backend" name="web_dialog_size assets" inherit_id="web.assets_backend"> |
||||
<xpath expr="." position="inside"> |
<xpath expr="." position="inside"> |
||||
<link rel="stylesheet" href="/web_dialog_size/static/src/css/web_dialog_size.css"/> |
<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> |
<script type="text/javascript" src="/web_dialog_size/static/src/js/web_dialog_size.js"></script> |
||||
</xpath> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
|
||||
</openerp> |
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue