time_logger icon indicating copy to clipboard operation
time_logger copied to clipboard

Redmine 4.1.1 compatibility

Open urobasa opened this issue 4 years ago • 4 comments

After click start - status not refresh. see the timer only if refresh page or timeout refresh plugin time

urobasa avatar Apr 22 '20 09:04 urobasa

@urobasa and @speedy32129 I found what is the issue with this plugin for redmine 4.1.1. Right now redmine use rails 5 and in official doc for rails we can see (https://guides.rubyonrails.org/working_with_javascript_in_rails.html):

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.

so we must replace code for 'ajax:success' event handler into something like this:

  $(document).on('ajax:success', '[data-remote][data-replace]', function(event) {
    var $this = $(this);
    $($this.data('replace')).html(event.detail[2].response);
    $this.trigger('ajax:replaced');
    return true;
  });

After this fix everything work for me. Let me know if I can help with PR.

stepozer avatar Jun 22 '20 09:06 stepozer

stepozer thanks for your contribution is much appreciated! I just tested this and that works. I did see the page update after the refresh interval was meet but that seems to make it instant. I'm not a javascript person at all so once again thanks for the contribution!!!

speedy32129 avatar Jun 25 '20 16:06 speedy32129

@speedy32129 I created PR with backward compatibility - https://github.com/speedy32129/time_logger/pull/67

stepozer avatar Jun 26 '20 06:06 stepozer

@stepozer Thanks a lot, worked for me (Redmine 4.1.1)

chmich avatar Mar 04 '21 10:03 chmich