mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
switch to svg icons
This commit is contained in:
@@ -10,9 +10,9 @@ module Stopwatch
|
||||
User.current.allowed_to?(:log_time, issue.project)
|
||||
t = Stopwatch::IssueTimer.new(issue: issue)
|
||||
if t.running?
|
||||
link << IssueLinks.new(issue).stop_timer
|
||||
link << IssueLinks.new(issue, self).stop_timer
|
||||
else
|
||||
link << IssueLinks.new(issue).start_timer
|
||||
link << IssueLinks.new(issue, self).start_timer
|
||||
end
|
||||
end
|
||||
super + content_tag(:li, link.html_safe)
|
||||
@@ -26,4 +26,3 @@ module Stopwatch
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
module Stopwatch
|
||||
class IssueLinks < Struct.new(:issue)
|
||||
include ActionView::Helpers::UrlHelper
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
|
||||
class IssueLinks < Struct.new(:issue, :context)
|
||||
def start_timer
|
||||
link_to(I18n.t(:label_stopwatch_start),
|
||||
start_issue_timer_path(issue),
|
||||
class: 'icon icon-time stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post')
|
||||
context.link_to(
|
||||
context.sprite_icon(:time, I18n.t(:label_stopwatch_start)),
|
||||
context.start_issue_timer_path(issue),
|
||||
class: 'stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post'
|
||||
)
|
||||
end
|
||||
|
||||
def stop_timer
|
||||
link_to(I18n.t(:label_stopwatch_stop),
|
||||
stop_issue_timer_path(issue),
|
||||
class: 'icon icon-time stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post')
|
||||
|
||||
context.link_to(
|
||||
context.sprite_icon(:time, I18n.t(:label_stopwatch_stop)),
|
||||
context.stop_issue_timer_path(issue),
|
||||
class: 'stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post'
|
||||
)
|
||||
end
|
||||
|
||||
# to make route helpers happy
|
||||
|
||||
@@ -8,9 +8,9 @@ module Stopwatch
|
||||
if User.current.allowed_to?(:log_time, issue.project)
|
||||
t = Stopwatch::IssueTimer.new(issue: issue)
|
||||
if t.running?
|
||||
link << IssueLinks.new(issue).stop_timer
|
||||
link << IssueLinks.new(issue, self).stop_timer
|
||||
else
|
||||
link << IssueLinks.new(issue).start_timer
|
||||
link << IssueLinks.new(issue, self).start_timer
|
||||
end
|
||||
end
|
||||
link.html_safe + super
|
||||
|
||||
Reference in New Issue
Block a user