mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
Redmine 5
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stopwatch
|
||||
def self.setup
|
||||
Stopwatch::ContextMenusControllerPatch.apply
|
||||
Stopwatch::IssuesControllerPatch.apply
|
||||
::TimeEntry.prepend Stopwatch::TimeEntryPatch
|
||||
::User.prepend Stopwatch::UserPatch
|
||||
Stopwatch::Hooks # just load it
|
||||
end
|
||||
|
||||
|
||||
def self.settings
|
||||
Setting.plugin_stopwatch
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
module Stopwatch
|
||||
module TimeEntryPatch
|
||||
def self.apply
|
||||
TimeEntry.prepend self unless TimeEntry < self
|
||||
end
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def self.prepended(base)
|
||||
base.class_eval do
|
||||
before_destroy :stop_timer
|
||||
end
|
||||
prepended do
|
||||
before_destroy :stop_timer
|
||||
end
|
||||
|
||||
def stop_timer
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
module Stopwatch
|
||||
module UserPatch
|
||||
def self.apply
|
||||
User.prepend self unless User < self
|
||||
end
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def timer_running?
|
||||
Stopwatch::Timer.new(self).running?
|
||||
|
||||
Reference in New Issue
Block a user