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:
@@ -2,9 +2,9 @@
|
||||
<% time_entry = @time_entries.first %>
|
||||
<li>
|
||||
<% if User.current.is_running_timer? time_entry %>
|
||||
<%= context_menu_link l(:label_stopwatch_stop), stop_stopwatch_timer_path(time_entry, context: '1'), class: 'icon icon-time', remote: true, method: :put %>
|
||||
<%= context_menu_link sprite_icon(:time, l(:label_stopwatch_stop)), stop_stopwatch_timer_path(time_entry, context: '1'), class: 'icon', remote: true, method: :put %>
|
||||
<% else %>
|
||||
<%= context_menu_link l(:label_stopwatch_start), start_stopwatch_timer_path(time_entry, context: '1'), class: 'icon icon-time', remote: true, method: :put %>
|
||||
<%= context_menu_link sprite_icon(:time, l(:label_stopwatch_start)), start_stopwatch_timer_path(time_entry, context: '1'), class: 'icon', remote: true, method: :put %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
|
||||
<td class="buttons">
|
||||
<% if running %>
|
||||
<%= link_to t(:label_stopwatch_stop), stop_stopwatch_timer_path(entry), remote: true, class: "icon-only icon-time", method: :put %>
|
||||
<%= link_to sprite_icon(:time, t(:label_stopwatch_stop)), stop_stopwatch_timer_path(entry), remote: true, class: "icon-only", method: :put %>
|
||||
<% else %>
|
||||
<%= link_to t(:label_stopwatch_start), start_stopwatch_timer_path(entry), remote: true, class: "icon-only icon-time", method: :put %>
|
||||
<%= link_to sprite_icon(:time, t(:label_stopwatch_start)), start_stopwatch_timer_path(entry), remote: true, class: "icon-only", method: :put %>
|
||||
<% end %>
|
||||
<%= link_to l(:button_edit), edit_stopwatch_timer_path(entry), remote: true, class: "icon-only icon-edit" if entry.editable_by? User.current %>
|
||||
<%= link_to sprite_icon(:edit, l(:button_edit)), edit_stopwatch_timer_path(entry), remote: true, class: "icon-only" if entry.editable_by? User.current %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
|
||||
@@ -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