From d61bcef81b9347daacb59f331128ae5bc4bd8f5a Mon Sep 17 00:00:00 2001 From: Wolfgang Pichler Date: Mon, 18 Sep 2017 09:58:06 +0200 Subject: [PATCH] [IMP] Added draggable support to dialogs --- web_dialog_size/README.rst | 2 ++ web_dialog_size/static/src/js/web_dialog_size.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index d30b2f01..13b4bd1b 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -3,6 +3,7 @@ Expand Dialog A module that lets the user expand/restore the dialog box size through a button in the upper right corner (mimicking most windows managers). +It does also add draggable support to the dialogs. Configuration ============= @@ -22,6 +23,7 @@ Contributors * Pedro M. Baeza * Holger Brunn * Siddharth Bhalgami +* Wolfgang Pichler Maintainer ---------- diff --git a/web_dialog_size/static/src/js/web_dialog_size.js b/web_dialog_size/static/src/js/web_dialog_size.js index df56b8fe..c6beac7c 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.js +++ b/web_dialog_size/static/src/js/web_dialog_size.js @@ -22,6 +22,22 @@ Dialog.include({ }); }, + open: function() { + var res = this._super.apply(this, arguments); + this.$modal.draggable({ + handle: "div.modal-header", + }); + return res; + }, + + close: function() { + var draggable = this.$modal.draggable( "instance" ); + if (draggable) + this.$modal.draggable("destroy"); + var res = this._super.apply(this, arguments); + return res; + }, + _extending: function() { var dialog = this.$modal.find('.modal-dialog'); dialog.addClass('dialog_full_screen');