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 %>
|
<% time_entry = @time_entries.first %>
|
||||||
<li>
|
<li>
|
||||||
<% if User.current.is_running_timer? time_entry %>
|
<% 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 %>
|
<% 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 %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
<td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
|
<td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
|
||||||
<td class="buttons">
|
<td class="buttons">
|
||||||
<% if running %>
|
<% 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 %>
|
<% 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 %>
|
<% 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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ module Stopwatch
|
|||||||
User.current.allowed_to?(:log_time, issue.project)
|
User.current.allowed_to?(:log_time, issue.project)
|
||||||
t = Stopwatch::IssueTimer.new(issue: issue)
|
t = Stopwatch::IssueTimer.new(issue: issue)
|
||||||
if t.running?
|
if t.running?
|
||||||
link << IssueLinks.new(issue).stop_timer
|
link << IssueLinks.new(issue, self).stop_timer
|
||||||
else
|
else
|
||||||
link << IssueLinks.new(issue).start_timer
|
link << IssueLinks.new(issue, self).start_timer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
super + content_tag(:li, link.html_safe)
|
super + content_tag(:li, link.html_safe)
|
||||||
@@ -26,4 +26,3 @@ module Stopwatch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
module Stopwatch
|
module Stopwatch
|
||||||
class IssueLinks < Struct.new(:issue)
|
class IssueLinks < Struct.new(:issue, :context)
|
||||||
include ActionView::Helpers::UrlHelper
|
|
||||||
include Rails.application.routes.url_helpers
|
|
||||||
|
|
||||||
|
|
||||||
def start_timer
|
def start_timer
|
||||||
link_to(I18n.t(:label_stopwatch_start),
|
context.link_to(
|
||||||
start_issue_timer_path(issue),
|
context.sprite_icon(:time, I18n.t(:label_stopwatch_start)),
|
||||||
class: 'icon icon-time stopwatch_issue_timer',
|
context.start_issue_timer_path(issue),
|
||||||
data: { issue_id: issue.id },
|
class: 'stopwatch_issue_timer',
|
||||||
remote: true,
|
data: { issue_id: issue.id },
|
||||||
method: 'post')
|
remote: true,
|
||||||
|
method: 'post'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop_timer
|
def stop_timer
|
||||||
link_to(I18n.t(:label_stopwatch_stop),
|
context.link_to(
|
||||||
stop_issue_timer_path(issue),
|
context.sprite_icon(:time, I18n.t(:label_stopwatch_stop)),
|
||||||
class: 'icon icon-time stopwatch_issue_timer',
|
context.stop_issue_timer_path(issue),
|
||||||
data: { issue_id: issue.id },
|
class: 'stopwatch_issue_timer',
|
||||||
remote: true,
|
data: { issue_id: issue.id },
|
||||||
method: 'post')
|
remote: true,
|
||||||
|
method: 'post'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# to make route helpers happy
|
# to make route helpers happy
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ module Stopwatch
|
|||||||
if User.current.allowed_to?(:log_time, issue.project)
|
if User.current.allowed_to?(:log_time, issue.project)
|
||||||
t = Stopwatch::IssueTimer.new(issue: issue)
|
t = Stopwatch::IssueTimer.new(issue: issue)
|
||||||
if t.running?
|
if t.running?
|
||||||
link << IssueLinks.new(issue).stop_timer
|
link << IssueLinks.new(issue, self).stop_timer
|
||||||
else
|
else
|
||||||
link << IssueLinks.new(issue).start_timer
|
link << IssueLinks.new(issue, self).start_timer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
link.html_safe + super
|
link.html_safe + super
|
||||||
|
|||||||
Reference in New Issue
Block a user