mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-11-17 11:50:36 -05:00
- New top-menu page listing running timers: owner, issue, project, activity, start time, time on this run and entry total, oldest first; refreshes every minute - Role permissions "View running timers" and "Stop other users' timers", checked against each timer's project; users can always stop their own - A timer can be stopped at an earlier time (when the person left): hours logged after it are taken off the entry, and the comment notes who stopped it and when - Timers now record when they were started (session_started_at); timers running from before show "unknown" until restarted - Integration tests for permissions, project scoping and stopping; unit tests for Timer#stop_for Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
33 lines
1.3 KiB
Ruby
33 lines
1.3 KiB
Ruby
Redmine::Plugin.register :stopwatch do
|
|
name 'Redmine Stopwatch Plugin'
|
|
author 'Jens Krämer'
|
|
author_url 'https://jkraemer.net/'
|
|
description "Start/stop timer and quick access to today's time bookings for Redmine"
|
|
version '2026.10.0'
|
|
|
|
requires_redmine version_or_higher: '7.0.0'
|
|
settings default: {
|
|
'default_activity' => 'always_ask',
|
|
'highlighted_links' => '0',
|
|
'max_timer_hours' => '10',
|
|
}, partial: 'stopwatch/settings'
|
|
|
|
# Running timers page: see everyone's running timers, and stop one someone forgot. Both are role
|
|
# permissions, so they apply to timers on time entries in the projects where the role has them.
|
|
permission :view_running_timers, { stopwatch_running_timers: [:index] }
|
|
permission :stop_running_timers, { stopwatch_running_timers: [:stop] }
|
|
|
|
menu :top_menu, :stopwatch_running_timers,
|
|
{ controller: 'stopwatch_running_timers', action: 'index' },
|
|
caption: :label_stopwatch_running_timers,
|
|
if: ->(*_){ User.current.allowed_to?(:view_running_timers, nil, global: true) }
|
|
|
|
menu :account_menu, :stopwatch,
|
|
:new_stopwatch_timer_path,
|
|
caption: :button_log_time,
|
|
html: { method: :get, id: 'stopwatch-menu', 'data-remote': true },
|
|
before: :my_account,
|
|
if: ->(*_){ User.current.logged? and User.current.allowed_to?(:log_time, nil, global: true) }
|
|
end
|
|
|
|
Stopwatch.setup |