mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 01:41:58 -04:00
fixes various UI issues
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
contextMenuHide();
|
||||
window.stopwatch.updateStartStopLink(
|
||||
'#stopwatch_stop_timer_<%= @issue.id %>',
|
||||
'<%= j Stopwatch::IssueLinks.new(@issue).start_timer %>'
|
||||
'<%= j Stopwatch::IssueLinks.new(@issue, self).start_timer %>'
|
||||
);
|
||||
window.stopwatch.timerStopped();
|
||||
|
||||
@@ -74,7 +74,7 @@ window.initStopwatch = function(config){
|
||||
$('a.stopwatch_issue_timer').each(function(){
|
||||
var a = $(this);
|
||||
a.attr('href', a.attr('href').replace(/stop$/, 'start'));
|
||||
a.text(locales.startTimer);
|
||||
a.find('span').text(locales.startTimer);
|
||||
});
|
||||
},
|
||||
timerStarted: function(data){
|
||||
@@ -94,10 +94,10 @@ window.initStopwatch = function(config){
|
||||
if(data.issue_id) {
|
||||
if(a.data('issueId') == data.issue_id) {
|
||||
a.attr('href', href.replace(/start$/, 'stop'));
|
||||
a.text(locales.stopTimer);
|
||||
a.find('span').text(locales.stopTimer);
|
||||
} else {
|
||||
a.attr('href', href.replace(/stop$/, 'start'));
|
||||
a.text(locales.startTimer);
|
||||
a.find('span').text(locales.startTimer);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ module Stopwatch
|
||||
context.link_to(
|
||||
context.sprite_icon(:time, I18n.t(:label_stopwatch_start)),
|
||||
context.start_issue_timer_path(issue),
|
||||
class: 'stopwatch_issue_timer',
|
||||
class: 'icon stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post'
|
||||
@@ -15,7 +15,7 @@ module Stopwatch
|
||||
context.link_to(
|
||||
context.sprite_icon(:time, I18n.t(:label_stopwatch_stop)),
|
||||
context.stop_issue_timer_path(issue),
|
||||
class: 'stopwatch_issue_timer',
|
||||
class: 'icon stopwatch_issue_timer',
|
||||
data: { issue_id: issue.id },
|
||||
remote: true,
|
||||
method: 'post'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path('../test_helper', __dir__)
|
||||
|
||||
class TicketTimerTest < Redmine::IntegrationTest
|
||||
include ActiveJob::TestHelper
|
||||
@@ -30,6 +30,7 @@ class TicketTimerTest < Redmine::IntegrationTest
|
||||
assert_not_running
|
||||
|
||||
get "/issues/1"
|
||||
assert_response :success
|
||||
assert_select "div.contextual a", text: /start tracking/i
|
||||
assert_no_difference ->{TimeEntry.count} do
|
||||
post "/issues/1/timer/start", xhr: true
|
||||
@@ -77,7 +78,7 @@ class TicketTimerTest < Redmine::IntegrationTest
|
||||
TimeEntry.delete_all
|
||||
assert_no_difference ->{TimeEntry.count} do
|
||||
post "/issues/1/timer/start", xhr: true
|
||||
assert_response 200
|
||||
assert_response :ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +87,7 @@ class TicketTimerTest < Redmine::IntegrationTest
|
||||
TimeEntry.delete_all
|
||||
with_settings plugin_stopwatch: { 'default_activity' => 'system'} do
|
||||
post "/issues/1/timer/start", xhr: true
|
||||
assert_response 201
|
||||
assert_response :created
|
||||
end
|
||||
assert te = TimeEntry.last
|
||||
assert_equal 1, te.issue_id
|
||||
@@ -98,18 +99,17 @@ class TicketTimerTest < Redmine::IntegrationTest
|
||||
TimeEntry.delete_all
|
||||
with_settings plugin_stopwatch: { 'default_activity' => '9'} do
|
||||
post "/issues/1/timer/start", xhr: true
|
||||
assert_response 201
|
||||
assert_response :created
|
||||
end
|
||||
assert te = TimeEntry.last
|
||||
assert_equal 1, te.issue_id
|
||||
assert_equal 9, te.activity_id
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def assert_not_running
|
||||
refute Stopwatch::Timer.new(User.find(@user.id)).running?
|
||||
assert_not Stopwatch::Timer.new(User.find(@user.id)).running?
|
||||
end
|
||||
|
||||
def assert_running
|
||||
|
||||
Reference in New Issue
Block a user