From 6e4fae522b3fcf9bbc9024692d87f66117f50a95 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 24 Nov 2017 15:02:28 +0100 Subject: [PATCH] CountdownView --- openslides/core/static/css/app.css | 41 +++++++++++--- openslides/core/static/js/core/site.js | 55 ++++++++++++++++++- .../templates/core/countdown-detail.html | 16 ++++++ .../templates/core/projector-controls.html | 7 ++- 4 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 openslides/core/static/templates/core/countdown-detail.html diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 8d403a2e3..86db38047 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -928,6 +928,39 @@ img { margin-top: 10px; } +/* Countdown fullscreen mode */ +#countdownWrapper { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1000; + background-color: white; +} +#countdownWrapper > div { + text-align: center; + margin-top: 50px; +} +#countdown { + display: inline-block; + padding: 20px 50px; + border-radius: 8px; + font-size: 30vw; + line-height: 1; + font-weight: bold; +} +#countdown .description { + font-weight: normal; + font-size: 5vw; +} +#countdown.warning { + color: #ed940d; +} +#countdown.negative { + color: #CC0000; +} + /* countdown and message controls */ .col2 .countdown.panel, .col2 .message.panel { margin-bottom: 7px; @@ -973,7 +1006,7 @@ img { font-weight: bold; } -.col2 .countdown .editicon, .col2 .message .editicon { +.col2 .countdown .icons, .col2 .message .editicon { padding-right: 10px; } @@ -1510,12 +1543,6 @@ img { display: none; } -/* List of speakers view */ -.fullscreendiv-title { - border-bottom: 5px solid #d3d3d3; - margin-bottom: 40px; -} - .lastSpeakers { color: #9a9898; } diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index dea5e5766..7b0f19a54 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -392,7 +392,25 @@ angular.module('OpenSlidesApp.core.site', [ basePerm: 'core.can_manage_tags', }, }) - .state('core.tag.list', {}); + .state('core.tag.list', {}) + + // Countdown + .state('core.countdown', { + url: '/countdown', + abstract: true, + template: "", + data: { + title: gettext('Countdown'), + basePerm: 'core.can_manage_projector', + }, + }) + .state('core.countdown.detail', { + resolve: { + countdownId: ['$stateParams', function($stateParams) { + return $stateParams.id; + }], + } + }); $locationProvider.html5Mode(true); } @@ -1785,6 +1803,41 @@ angular.module('OpenSlidesApp.core.site', [ } ]) +.controller('CountdownDetailCtrl', [ + '$scope', + '$interval', + 'Countdown', + 'countdownId', + function ($scope, $interval, Countdown, countdownId) { + var interval; + var calculateCountdownTime = function (countdown) { + countdown.seconds = Math.floor( $scope.countdown.countdown_time - Date.now() / 1000 + $scope.serverOffset ); + }; + $scope.$watch(function () { + return Countdown.lastModified(countdownId); + }, function () { + $scope.countdown = Countdown.get(countdownId); + if (interval) { + $interval.cancel(interval); + } + if ($scope.countdown) { + if ($scope.countdown.running) { + calculateCountdownTime($scope.countdown); + interval = $interval(function () { calculateCountdownTime($scope.countdown); }, 1000); + } else { + $scope.countdown.seconds = $scope.countdown.countdown_time; + } + } + }); + $scope.$on('$destroy', function() { + // Cancel the interval if the controller is destroyed + if (interval) { + $interval.cancel(interval); + } + }); + } +]) + // counter of new (unread) chat messages .value('NewChatMessages', []) diff --git a/openslides/core/static/templates/core/countdown-detail.html b/openslides/core/static/templates/core/countdown-detail.html new file mode 100644 index 000000000..7f17563b8 --- /dev/null +++ b/openslides/core/static/templates/core/countdown-detail.html @@ -0,0 +1,16 @@ +
+
+
+
+
{{ countdown.seconds | osSecondsToTime}}
+
+
+
+ {{ countdown.description }} +
+
+
+
+
diff --git a/openslides/core/static/templates/core/projector-controls.html b/openslides/core/static/templates/core/projector-controls.html index 8172ae93d..98469de62 100644 --- a/openslides/core/static/templates/core/projector-controls.html +++ b/openslides/core/static/templates/core/projector-controls.html @@ -1,4 +1,3 @@ -
@@ -153,11 +152,15 @@ - + + +