From bb262865772ecfc729110691c96a8b7eb6284010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ku=CC=88pper?= Date: Tue, 13 Feb 2024 12:23:09 -0500 Subject: [PATCH] add page to show statistics for Message to the Romans --- client/app/index.html | 1 + client/app/scripts/app.js | 5 ++ client/app/scripts/controllers/statistics.js | 38 +++++++++++++ client/app/views/pages/statistics.html | 56 ++++++++++++++++++++ common/app/scripts/services/_api.js | 7 +++ common/app/styles/_main.scss | 3 +- common/app/styles/partials/_table.scss | 26 +++++++++ 7 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 client/app/scripts/controllers/statistics.js create mode 100644 client/app/views/pages/statistics.html create mode 100644 common/app/styles/partials/_table.scss diff --git a/client/app/index.html b/client/app/index.html index 167d2d1f..9a48008e 100644 --- a/client/app/index.html +++ b/client/app/index.html @@ -160,6 +160,7 @@

We're sorry, it seems like your browser is out of date.

+ diff --git a/client/app/scripts/app.js b/client/app/scripts/app.js index f2d938e8..5b92a1c3 100644 --- a/client/app/scripts/app.js +++ b/client/app/scripts/app.js @@ -146,6 +146,11 @@ angular.module('bmmApp', [ controller: 'DownloadInfoCtrl', resolve: { '_initData': ['_init', function(_init) { return _init.promise(); }]} }) + .when('/romans-statistics', { + templateUrl: 'views/pages/statistics.html', + controller: 'StatisticsCtrl', + resolve: { '_initData': ['_init', function(_init) { return _init.promise(); }]} + }) .otherwise({ redirectTo: '/welcome' }); diff --git a/client/app/scripts/controllers/statistics.js b/client/app/scripts/controllers/statistics.js new file mode 100644 index 00000000..30191434 --- /dev/null +++ b/client/app/scripts/controllers/statistics.js @@ -0,0 +1,38 @@ +'use strict'; + +angular.module('bmmApp') + .controller('StatisticsCtrl', function ( + $scope, + $rootScope, + $routeParams, + $timeout, + $location, + $window, + _api, + _track, + _init + ) { + $scope.load = true; + $scope.data = null; + + $(window).off('scrollBottom'); + + var load = function() { + _api.churchStatisticsGet($routeParams.secret).done(function (data) { + console.log("data", data); + $scope.data = data; + console.log("data", data); + $scope.load = false; + }); + }; + load(); + + // This is a workaround to fix the scroll problem (#5317 in VSTS) + $scope.setMinHeight = function() { + $('body').find('div.frontend').css('min-height', '1000px'); + }; + $scope.removeMinHeight = function() { + $('body').find('div.frontend').css('min-height', 'initial'); + }; + + }); diff --git a/client/app/views/pages/statistics.html b/client/app/views/pages/statistics.html new file mode 100644 index 00000000..bbfc0284 --- /dev/null +++ b/client/app/views/pages/statistics.html @@ -0,0 +1,56 @@ + +
+

Message to the Romans

+

Statistikk for {{data.church_name}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
U1819 - 2526 - 3513 - 35
Har en personlig konto hos BMM{{data.has_bmm_account_percent_u18 | number : 1}}%{{data.has_bmm_account_percent19to25 | number : 1}}%{{data.has_bmm_account_percent26to35 | number : 1}}%{{data.has_bmm_account_percent_youth | number : 1}}%
Hørt på minst 1 episode{{data.percent_u18 | number : 1}}%{{data.percent19to25 | number : 1}}%{{data.percent26to35 | number : 1}}%{{data.percent_youth | number : 1}}%
Hørt på alle episoder fra siste uken{{data.last_week_percent_u18 | number : 1}}%{{data.last_week_percent19to25 | number : 1}}%{{data.last_week_percent26to35 | number : 1}}%{{data.last_week_percent_youth | number : 1}}%
Hørt på alle episoder fra og med 12. februar{{data.since_february12_percent_u18 | number : 1}}%{{data.since_february12_percent19to25 | number : 1}}%{{data.since_february12_percent26to35 | number : 1}}%{{data.since_february12_percent_youth | number : 1}}%
Hørt på alle episoder så langt{{data.on_track_percent_u18 | number : 1}}%{{data.on_track_percent19to25 | number : 1}}%{{data.on_track_percent26to35 | number : 1}}%{{data.on_track_percent_youth | number : 1}}%
+ +
+ +
+ +
diff --git a/common/app/scripts/services/_api.js b/common/app/scripts/services/_api.js index c8ae7913..e04ac0f0 100644 --- a/common/app/scripts/services/_api.js +++ b/common/app/scripts/services/_api.js @@ -1054,6 +1054,13 @@ angular.module('bmmLibApp') }) }; + factory.churchStatisticsGet = function() { + return factory.addToQueue({ + method: 'GET', + url: serverUrl + 'statistics/project/church/' + }) + }; + factory.trackListOverview = function(type, options) { return factory.addToQueue({ method: 'GET', diff --git a/common/app/styles/_main.scss b/common/app/styles/_main.scss index 8fa2a86c..bcdfce23 100644 --- a/common/app/styles/_main.scss +++ b/common/app/styles/_main.scss @@ -23,9 +23,10 @@ @import "partials/popup.scss"; @import "partials/options.scss"; @import "partials/size-detector.scss"; +@import "partials/table.scss"; //DIRECTIVES @import "directives/videoslider.scss"; @import "directives/albumslider.scss"; @import "directives/treeview.scss"; -@import "directives/playlist.scss"; \ No newline at end of file +@import "directives/playlist.scss"; diff --git a/common/app/styles/partials/_table.scss b/common/app/styles/partials/_table.scss new file mode 100644 index 00000000..9395989b --- /dev/null +++ b/common/app/styles/partials/_table.scss @@ -0,0 +1,26 @@ +.table-element{ +} + +.table-element th { + background-color: #ddd; + white-space: nowrap; +} + +.table-element tr td:first-child, +.table-element tr td:last-child +{ + background-color: #eee; +} + +.table-element tr td { + text-align: right; +} + +.table-element tr td:first-child { + text-align: left; +} + +.table-element th, +.table-element td { + padding: 4px 12px; +}