-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23e6fa8
commit cc1a521
Showing
3 changed files
with
58 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,70 @@ | ||
odoo.define('web_dialog_size.web_dialog_size', function (require) { | ||
'use strict'; | ||
'use strict'; | ||
|
||
var rpc = require('web.rpc'); | ||
var Dialog = require('web.Dialog'); | ||
var rpc = require('web.rpc'); | ||
var Dialog = require('web.Dialog'); | ||
|
||
var config = rpc.query({ | ||
model: 'ir.config_parameter', | ||
method: 'get_web_dialog_size_config', | ||
}); | ||
var config = rpc.query({ | ||
model: 'ir.config_parameter', | ||
method: 'get_web_dialog_size_config', | ||
}); | ||
|
||
Dialog.include({ | ||
Dialog.include({ | ||
|
||
willStart: function () { | ||
var self = this; | ||
return this._super.apply(this, arguments).then(function () { | ||
self.$modal.find('.dialog_button_extend').on('click', self.proxy('_extending')); | ||
self.$modal.find('.dialog_button_restore').on('click', self.proxy('_restore')); | ||
return config.then(function(r) { | ||
if (r.default_maximize) { | ||
self._extending(); | ||
} else { | ||
self._restore(); | ||
} | ||
willStart: function () { | ||
var self = this; | ||
return this._super.apply(this, arguments).then(function () { | ||
self.$modal.find('.dialog_button_extend').on('click', | ||
self.proxy('_extending') | ||
); | ||
self.$modal.find('.dialog_button_restore').on('click', | ||
self.proxy('_restore') | ||
); | ||
return config.then(function (r) { | ||
if (r.default_maximize) { | ||
self._extending(); | ||
} else { | ||
self._restore(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}, | ||
}, | ||
|
||
opened: function(handler) { | ||
return this._super.apply(this, arguments).then(function(){ | ||
if (this.$modal) { | ||
this.$modal.draggable({ | ||
handle: '.modal-header', | ||
helper: false | ||
}); | ||
} | ||
}.bind(this)); | ||
}, | ||
opened: function () { | ||
return this._super.apply(this, arguments).then(function () { | ||
if (this.$modal) { | ||
this.$modal.draggable({ | ||
handle: '.modal-header', | ||
helper: false, | ||
}); | ||
} | ||
}.bind(this)); | ||
}, | ||
|
||
close: function() { | ||
if (this.$modal) { | ||
var draggable = this.$modal.draggable("instance"); | ||
if (draggable) { | ||
this.$modal.draggable("destroy"); | ||
close: function () { | ||
if (this.$modal) { | ||
var draggable = this.$modal.draggable("instance"); | ||
if (draggable) { | ||
this.$modal.draggable("destroy"); | ||
} | ||
} | ||
} | ||
return this._super.apply(this, arguments); | ||
}, | ||
return this._super.apply(this, arguments); | ||
}, | ||
|
||
_extending: function() { | ||
var dialog = this.$modal.find('.modal-dialog'); | ||
dialog.addClass('dialog_full_screen'); | ||
dialog.find('.dialog_button_extend').hide(); | ||
dialog.find('.dialog_button_restore').show(); | ||
}, | ||
_extending: function () { | ||
var dialog = this.$modal.find('.modal-dialog'); | ||
dialog.addClass('dialog_full_screen'); | ||
dialog.find('.dialog_button_extend').hide(); | ||
dialog.find('.dialog_button_restore').show(); | ||
}, | ||
|
||
_restore: function() { | ||
var dialog = this.$modal.find('.modal-dialog'); | ||
dialog.removeClass('dialog_full_screen'); | ||
dialog.find('.dialog_button_restore').hide(); | ||
dialog.find('.dialog_button_extend').show(); | ||
}, | ||
_restore: function () { | ||
var dialog = this.$modal.find('.modal-dialog'); | ||
dialog.removeClass('dialog_full_screen'); | ||
dialog.find('.dialog_button_restore').hide(); | ||
dialog.find('.dialog_button_extend').show(); | ||
}, | ||
|
||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters