speedy32129 / time_logger

Redmine Time logger plugin. More than likely there is only going to be one more public release. New version has new time logging with the option of multiple loggers running at the same time, fixes for excessive loggng, and a whole new look.
Other
58 stars 43 forks source link

Redmine 4.1.1 compatibility #66

Open urobasa opened 4 years ago

urobasa commented 4 years ago

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

stepozer commented 4 years ago

@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.

speedy32129 commented 4 years ago

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!!!

stepozer commented 4 years ago

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

chmich commented 3 years ago

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