mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-11-17 19:50:36 -05:00
Readable Start/Stop colours, exact selectors, fork notes
- Colour-coded Start/Stop links use #2e7d32 / #c62828, which meet the 4.5:1 text contrast ratio on white and on the mobile backgrounds (limegreen was ~2:1, red ~4:1) - Selectors match the end of the link address (/timer/start, /timer/stop), exactly what stopwatch.js rewrites, instead of any address containing "start"/"stop" - highlighted_links setting uses a string key like default_activity, has a default, and the form sends 0 when unticked - Context-menu hook uses the calling view (hook_caller) instead of building a new view context - README: "Changes in this fork" section (GPLv3 modification notice) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
6 files changed
+37
-18
No files matched your search
+2
-1
@@ -41,7 +41,8 @@ module Stopwatch
|
||||
end
|
||||
end
|
||||
|
||||
# Colour-code the issue Start/Stop links (green to start, red to stop)
|
||||
def self.highlighted_links
|
||||
settings[:highlighted_links]
|
||||
settings['highlighted_links'].to_s == '1'
|
||||
end
|
||||
end
|
||||
@@ -17,17 +17,17 @@ module Stopwatch
|
||||
issue = issues.first
|
||||
return '' unless User.current.allowed_to?(:log_time, issue.project)
|
||||
|
||||
# 'controller' in this context gives access to view helper context
|
||||
view = context[:controller].view_context
|
||||
# hook_caller is the view rendering the context menu
|
||||
view = context[:hook_caller]
|
||||
timer = Stopwatch::IssueTimer.new(issue: issue)
|
||||
|
||||
|
||||
link = if timer.running?
|
||||
IssueLinks.new(issue, view).stop_timer
|
||||
else
|
||||
IssueLinks.new(issue, view).start_timer
|
||||
end
|
||||
|
||||
view.content_tag(:li, link.html_safe)
|
||||
view.content_tag(:li, link)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user