Show countdown in red if negative (projector and control panel).

Show 00:00 instead of --:--
This commit is contained in:
Emanuel Schuetze 2016-01-21 21:43:02 +01:00
parent b291473c61
commit 646bf52ea7
3 changed files with 21 additions and 20 deletions

View File

@ -458,6 +458,10 @@ img {
padding-right: 10px; padding-right: 10px;
} }
.col2 .countdown_timer.negative {
color: #CC0000;
}
.col2 .notNull { .col2 .notNull {
color: red; color: red;
font-weight: bold; font-weight: bold;

View File

@ -333,25 +333,22 @@ angular.module('OpenSlidesApp.core', [
function () { function () {
return function (totalseconds) { return function (totalseconds) {
var time; var time;
var total = Math.abs(totalseconds); // floor returns the largest integer of the absolut value of totalseconds
if (parseInt(totalseconds)) { var total = Math.floor(Math.abs(totalseconds));
var hh = Math.floor(total / 3600); var hh = Math.floor(total / 3600);
var mm = Math.floor(total % 3600 / 60); var mm = Math.floor(total % 3600 / 60);
var ss = Math.floor(total % 60); var ss = Math.floor(total % 60);
var zero = "0"; var zero = "0";
// Add leading "0" for double digit values // Add leading "0" for double digit values
hh = (zero+hh).slice(-2); hh = (zero+hh).slice(-2);
mm = (zero+mm).slice(-2); mm = (zero+mm).slice(-2);
ss = (zero+ss).slice(-2); ss = (zero+ss).slice(-2);
if (hh == "00") if (hh == "00")
time = mm + ':' + ss; time = mm + ':' + ss;
else else
time = hh + ":" + mm + ":" + ss; time = hh + ":" + mm + ":" + ss;
if (totalseconds < 0) if (totalseconds < 0)
time = "-"+time; time = "-"+time;
} else {
time = "--:--";
}
return time; return time;
}; };
} }

View File

@ -1,6 +1,6 @@
<div ng-controller="SlideCountdownCtrl"> <div ng-controller="SlideCountdownCtrl">
<div ng-if="visible"> <div ng-if="visible">
<div class="countdown well" style="margin-top: calc({{index}}*100px);"> <div class="countdown well" style="margin-top: calc({{index}}*100px);" ng-class="{ 'negative': seconds < 0 }">
{{ seconds | osSecondsToTime}} {{ seconds | osSecondsToTime}}
<div class="description">{{ description }}</div> <div class="description">{{ description }}</div>
</div> </div>