updating panel

This commit is contained in:
Simon Vieille 2015-01-11 23:45:35 +01:00
parent 6802f0c845
commit 2e1afa499e
2 changed files with 19 additions and 7 deletions

View file

@ -109,13 +109,19 @@ var App = (function() {
this.loadUpdatePanel = function() {
if (app.counters.length) {
var counters = [];
var today = new Date();
var currentDate = [today.getFullYear(), today.getMonth() + 1, today.getDate()].join('-');
for (i in app.counters) {
if (app.counters[i]) {
var c = app.counters[i];
if (c.value !== 0) {
counters.push(c);
if (app.counters[i].value !== 0) {
app.counters[i].started = false;
var c = app.counters[i];
c.update = {
time: app.convertTime(c.time + 60, true),
date: currentDate
};
counters.push(c);
}
}
}
@ -206,11 +212,15 @@ var App = (function() {
}
}
this.convertTime = function(s) {
this.convertTime = function(s, redmineFormat) {
var hours = parseInt(s / 3600) % 24;
var minutes = parseInt(s / 60) % 60;
var seconds = s % 60;
if (redmineFormat) {
return hours + 'h' + minutes;
}
return hours + 'h ' + minutes + 'm ' + seconds + 's';
}

View file

@ -102,13 +102,13 @@
<div class="form-group">
<label for="time_date_{{ issue.id }}" class="col-sm-2 control-label">Date*</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="time_date_{{ issue.id }}" placeholder="Date">
<input type="text" class="form-control" value="{{ update.date }}" id="time_date_{{ issue.id }}" placeholder="Date">
</div>
</div>
<div class="form-group">
<label for="time_time_{{ issue.id }}" class="col-sm-2 control-label">Time*</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="time_time_{{ issue.id }}" placeholder="Time">
<input type="text" class="form-control" value="{{ update.time }}" id="time_time_{{ issue.id }}" placeholder="Time">
</div>
</div>
<div class="form-group">
@ -127,6 +127,8 @@
</select>
</div>
</div>
<hr />
</div>
{{/each}}
</div>