mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
works, basically
This commit is contained in:
24
assets/javascripts/stopwatch.js
Normal file
24
assets/javascripts/stopwatch.js
Normal file
@@ -0,0 +1,24 @@
|
||||
window.Stopwatch = {
|
||||
highlightRunningTimer: function(){
|
||||
$.get(Stopwatch.currentTimerUrl, function(data){
|
||||
if (data.running && data.time_entry_id) {
|
||||
Stopwatch.highlightTimer(data.time_entry_id);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
highlightTimer: function(id){
|
||||
$('table.time-entries tr.time-entry.running').removeClass('running');
|
||||
if(id && id != ''){
|
||||
$('table.time-entries tr.time-entry').each(function(idx, el){
|
||||
var tr = $(el);
|
||||
var trId = tr.attr('id');
|
||||
if (trId && trId == 'time-entry-'+id) {
|
||||
tr.addClass('running');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on('ready', Stopwatch.highlightRunningTimer);
|
||||
3
assets/stylesheets/stopwatch.css
Normal file
3
assets/stylesheets/stopwatch.css
Normal file
@@ -0,0 +1,3 @@
|
||||
tr.time-entry.running td.hours {
|
||||
color: red;
|
||||
}
|
||||
Reference in New Issue
Block a user