From 8f8e4dbbb331a443b32a457ef1a50f21bcefe94d Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Tue, 12 Jul 2011 12:00:28 +0200 Subject: [PATCH] [FIX] daterange selector dialog --- indico/htdocs/css/jquery-ui-custom.css | 4 ++ indico/htdocs/js/indico/Core/Dialogs/Popup.js | 6 ++- .../htdocs/js/indico/Core/Dialogs/PopupWidgets.js | 48 ++++++++++++---------- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/indico/htdocs/css/jquery-ui-custom.css b/indico/htdocs/css/jquery-ui-custom.css index 91463c850..ab78888c7 100644 --- a/indico/htdocs/css/jquery-ui-custom.css +++ b/indico/htdocs/css/jquery-ui-custom.css @@ -8,6 +8,10 @@ width: 37em; } +.ui-dialog-content .ui-daterange { + width: 100%; +} + .ui-dialog { width: auto !important; } diff --git a/indico/htdocs/js/indico/Core/Dialogs/Popup.js b/indico/htdocs/js/indico/Core/Dialogs/Popup.js index f0d756d8b..ec5071043 100644 --- a/indico/htdocs/js/indico/Core/Dialogs/Popup.js +++ b/indico/htdocs/js/indico/Core/Dialogs/Popup.js @@ -141,7 +141,11 @@ type("ExclusivePopup", ["Printable"], { } } - this.postDraw(); + if(this.postDraw() === true) { + // refresh position + var pos = this.canvas.dialog('option', 'position'); + this.canvas.dialog('option', 'position', pos); + } }, postDraw: function() { diff --git a/indico/htdocs/js/indico/Core/Dialogs/PopupWidgets.js b/indico/htdocs/js/indico/Core/Dialogs/PopupWidgets.js index 03fdaa324..868508ef3 100644 --- a/indico/htdocs/js/indico/Core/Dialogs/PopupWidgets.js +++ b/indico/htdocs/js/indico/Core/Dialogs/PopupWidgets.js @@ -3,14 +3,16 @@ * specify a date range. */ type("DateRangeSelector", ["ExclusivePopupWithButtons"], { - _drawButtons: function() { + _getButtons: function() { var self = this; - - var buttonDiv = Html.div({}, Widget.button(command(function() { - self._submit(); - }, $T("Choose")))); - - return buttonDiv; + return [ + [$T('Choose'), function() { + self._submit() + }], + [$T('Cancel'), function() { + self.close() + }] + ]; }, _submit: function() { @@ -43,25 +45,27 @@ type("DateRangeSelector", ["ExclusivePopupWithButtons"], { _drawWidget: function() { var self = this; - var structure = Html.div({style:{height: pixels(245)}}); - _.defer(function() { - self.dateRangeWidget = $(structure.dom).daterange({ - allowPast: true, - useFields: false, - startDate: self.startDate, - endDate: self.endDate, - pickerOptions: { - yearRange: 'c-2:c+2' - } - }); - }); + self.dateRangeWidget = $('
'); + return self.dateRangeWidget; + }, - return structure; + postDraw: function() { + this.dateRangeWidget.daterange({ + allowPast: true, + useFields: false, + startDate: this.startDate, + endDate: this.endDate, + pickerOptions: { + yearRange: 'c-2:c+2' + } + }); + return true; // refresh position }, draw: function() { - var self = this; - return this.ExclusivePopupWithButtons.prototype.draw.call(this, this._drawWidget(), this._drawButtons()); + return this.ExclusivePopupWithButtons.prototype.draw.call(this, this._drawWidget(), null, { + overflow: 'visible' + }); } }, function(startDate, endDate, callback, title, allowEqual) { var self = this; -- 2.11.4.GIT