From 149a086aabbc0ce6426148cb78a0fe5355288e45 Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Wed, 20 Nov 2019 15:53:24 +0100 Subject: [PATCH] Fixes issue #2274 - Datepicker in bulk action not usable in bulk action if ticket list is longer the one page. --- .../app/controllers/_ui_element/basedate.coffee | 2 ++ .../app/controllers/ticket_overview.coffee | 4 ++++ .../app/lib/bootstrap/bootstrap-datepicker.js | 15 +++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee index c2ee4bb7c..bdbb61b15 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee @@ -37,6 +37,8 @@ class App.UiElement.basedate rtl: App.i18n.dir() is 'rtl' container: item language: 'custom' + orientation: attribute.orientation + disableScroll: attribute.disableScroll ) @setNewTimeInitial(item, attribute) diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 95b03750e..da10558d1 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -1357,6 +1357,10 @@ class BulkForm extends App.Controller localAttribute.null = true @configure_attributes_ticket.push localAttribute + time_attribute = _.findWhere(@configure_attributes_ticket, {'name': 'pending_time'}) + time_attribute.orientation = 'top' + time_attribute.disableScroll = true + @holder = @options.holder @visible = false diff --git a/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js b/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js index 7e0f13eb8..c188d8560 100755 --- a/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js +++ b/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js @@ -28,6 +28,7 @@ - added rerender method to show correct today if task is longer open the 24 hours - scroll into view - fix vertical auto position + - disableScroll flag to */ (function(factory){ @@ -767,13 +768,15 @@ }); } - // adjust scroll of scrollParent - var scrollParent = this.picker.scrollParent(); - var bottomEdge = offset.top + height + this.picker.outerHeight(); - var scrollBottomEdge = scrollParent.scrollTop() + scrollParent.height(); + if(!this.o.disableScroll) { + // adjust scroll of scrollParent + var scrollParent = this.picker.scrollParent(); + var bottomEdge = offset.top + height + this.picker.outerHeight(); + var scrollBottomEdge = scrollParent.scrollTop() + scrollParent.height(); - if(bottomEdge > scrollBottomEdge){ - scrollParent.scrollTop(scrollParent.scrollTop() + (bottomEdge - scrollBottomEdge) + 10); + if(bottomEdge > scrollBottomEdge){ + scrollParent.scrollTop(scrollParent.scrollTop() + (bottomEdge - scrollBottomEdge) + 10); + } } return this;