From 338abfc56ee611e62eac8d348916962a60194b96 Mon Sep 17 00:00:00 2001 From: "d.stepanenko" Date: Fri, 26 Jun 2020 09:18:14 +0300 Subject: [PATCH] Redmine 4.1.1 compatibility --- assets/javascripts/time_logger.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/javascripts/time_logger.js b/assets/javascripts/time_logger.js index 9535934..71e693d 100644 --- a/assets/javascripts/time_logger.js +++ b/assets/javascripts/time_logger.js @@ -24,6 +24,12 @@ $(function() { // Pass an jQuery selector that should be replaced with the response from server. $(document).on('ajax:success', '[data-remote][data-replace]', function(event, data) { var $this = $(this); + + // As of Rails 5.1 and the new rails-ujs, the parameters data, status, xhr have been bundled into event.detail. + // For information about the previously used jquery-ujs in Rails 5 and earlier, read the jquery-ujs wiki. + if (typeof(data) === "undefined") { + data = event.detail[2].response; + } $($this.data('replace')).html(data); $this.trigger('ajax:replaced'); return true;