diff --git a/assets/css/base.css b/assets/css/base.css index 7c20f71..1d01fc6 100644 --- a/assets/css/base.css +++ b/assets/css/base.css @@ -34,6 +34,12 @@ img { background-color: #337ab7; } +.clean-modal .modal-content { + background: none; + border: none; + box-shadow: none; +} + /* Header */ #wl-header { position: relative; @@ -190,6 +196,26 @@ img { opacity: 0.7; } +.presentation-modal .modal-dialog { + width: auto; + height: 85%; + margin: 45px 30px 45px 45px; +} + +.presentation-modal .modal-content { + height: 100%; +} +.presentation-modal .modal-body { + height: 100%; + padding: 0; +} + +#presentation-player { + width: 100%; + height: 100%; + +} + /* Contribution Overview Section */ #wl-overview { position: relative; @@ -258,7 +284,7 @@ img { } .wl-zigzag-border { - background: url(../img/zigzag-border.png) repeat-x; + background: url('../img/zigzag-border.png') repeat-x; height: 7px; width: 100%; position: absolute; @@ -365,7 +391,6 @@ img { /* Signs and Ranking Section */ #wl-signs-and-ranking { - position: relative; z-index: 1; background: #ffffff; height: 100vh; @@ -375,6 +400,7 @@ img { display: flex; flex-direction: row; flex-wrap: wrap; + background: white; } .wl-signs-and-ranking-wrapper { @@ -387,6 +413,7 @@ img { padding: 0 15px; } +/* Sign Section */ .wl-signs-container { display: flex; flex-wrap: wrap; @@ -398,6 +425,22 @@ img { padding: 3px; } +.sign-modal .sign-name { + font-size: 20px; + color: #ffffff; + font-weight: bold; +} + +.sign-modal .created-by { + font-size: 18px; +} + +.sign-video-container video { + height: 100%; + width: 100%; +} + +/* Ranking Section */ .wl-ranking-header-wrapper { padding-left: 0; padding-right: 0; diff --git a/assets/js/libs/angular-sanitize.min.js b/assets/js/libs/angular-sanitize.min.js new file mode 100644 index 0000000..7f195d6 --- /dev/null +++ b/assets/js/libs/angular-sanitize.min.js @@ -0,0 +1,15 @@ +/* + AngularJS v1.5.7 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(q,e){'use strict';function A(a){var c=[];v(c,e.noop).chars(a);return c.join("")}function h(a,c){var b={},d=a.split(","),l;for(l=0;l/g,">")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&F[a]&&(b=a);b||!0!==n[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==G[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==n[a]||!0===z[a]||(d(""),d(a),d(">"));a== +b&&(b=!1)},chars:function(a){b||d(x(a))}}}function r(a){if(a.nodeType===q.Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,k){function m(a){a&&p.push(A(a))}function q(a,b){var c,d=r(a);p.push("');m(b);p.push("")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=e.isFunction(k)?k:e.isObject(k)?function(){return k}:function(){return{}},s=f,p=[],t,n;f=s.match(c);)t=f[0],f[2]||f[4]||(t=(f[3]?"http://":"mailto:")+t),n=f.index,m(s.substr(0,n)),q(t,f[0].replace(b,"")),s=s.substring(n+f[0].length);m(s);return a(p.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map diff --git a/assets/js/main.controller.js b/assets/js/main.controller.js index 8168e3c..856fc5c 100644 --- a/assets/js/main.controller.js +++ b/assets/js/main.controller.js @@ -1,5 +1,9 @@ (function () { 'use strict'; - angular.module('wikilibras').controller('wikilibrasCtrl', ['$scope', function ($scope) {}]); + angular.module('wikilibras').controller('wikilibrasCtrl', ['$scope', '$window', '$document', function ($scope, $window) { + $scope.openUrl = function(url) { + $window.open(url, "_self"); + }; + }]); }()); \ No newline at end of file diff --git a/assets/js/main.module.js b/assets/js/main.module.js index faadee0..ec61c02 100644 --- a/assets/js/main.module.js +++ b/assets/js/main.module.js @@ -1,5 +1,5 @@ (function () { 'use strict'; - angular.module('wikilibras', ['wikilibras.progress', 'wikilibras.ranking', 'wikilibras.volunteers', 'duScroll', 'angularMoment']).value('duScrollOffset', 70); + angular.module('wikilibras', ['wikilibras.progress', 'wikilibras.ranking', 'wikilibras.volunteers', 'wikilibras.signs', 'wikilibras.presentation', 'duScroll', 'angularMoment', 'ngSanitize']).value('duScrollOffset', 70); }()); \ No newline at end of file diff --git a/assets/js/presentation/presentation-modal.html b/assets/js/presentation/presentation-modal.html new file mode 100644 index 0000000..4bfbadb --- /dev/null +++ b/assets/js/presentation/presentation-modal.html @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/assets/js/presentation/presentation.directive.js b/assets/js/presentation/presentation.directive.js new file mode 100644 index 0000000..34f2344 --- /dev/null +++ b/assets/js/presentation/presentation.directive.js @@ -0,0 +1,38 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.presentation').directive('presentationModal', ['$window', function($window) { + return { + restrict: 'E', + templateUrl: 'assets/js/presentation/presentation-modal.html', + link: function(scope, element, attr) { + var player = undefined; + + function loadVideo() { + var tag = document.createElement('script'); + tag.src = "https://www.youtube.com/iframe_api"; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + } + $window.onYouTubeIframeAPIReady = function() { + player = new YT.Player(document.getElementById('presentation-player'), { + videoId: 'lKA-QsdeHFo', + events: { + 'onReady': setupPlayer + } + }); + }; + function setupPlayer() { + $('.presentation-modal').off('hidden.bs.modal').on('hidden.bs.modal', function () { + player.stopVideo(); + }); + $('.wl-video-control').off('click').on('click', function() { + player.playVideo(); + $('.presentation-modal').modal('show'); + }); + }; + loadVideo(); + } + } + }]); +}()); \ No newline at end of file diff --git a/assets/js/presentation/presentation.module.js b/assets/js/presentation/presentation.module.js new file mode 100644 index 0000000..52426c9 --- /dev/null +++ b/assets/js/presentation/presentation.module.js @@ -0,0 +1,5 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.presentation', []); +}()); \ No newline at end of file diff --git a/assets/js/progress/progress.controller.js b/assets/js/progress/progress.controller.js index e355b0a..3737db7 100644 --- a/assets/js/progress/progress.controller.js +++ b/assets/js/progress/progress.controller.js @@ -2,7 +2,7 @@ 'use strict'; angular.module('wikilibras.progress').controller('progressCtrl', ['$scope', 'progressService', function ($scope, progressService) { - $scope.progress = {"wikilibras": initProgressData(), "corretor_sinais": initProgressData(), "validador_sinais": initProgressData()}; + $scope.progress = {"wikilibras": initProgressData(), "corretor_sinais": initProgressData(), "validador_sinais": initProgressData(), 'uploaded_signs': initProgressData()}; function initProgressData() { return {"n_tasks": 0, "n_task_runs": 0, "n_completed_tasks": 0, "last_activity": new Date(), "goal_n_tasks": 0, "goal_deadline": new Date()}; diff --git a/assets/js/progress/progress.service.js b/assets/js/progress/progress.service.js index 24688a3..b35bbfa 100644 --- a/assets/js/progress/progress.service.js +++ b/assets/js/progress/progress.service.js @@ -1,9 +1,10 @@ (function () { 'use strict'; - angular.module('wikilibras.progress').service("progressService", ['$http', function ($http) { + angular.module('wikilibras.progress').service("progressService", ['$http', '$q', function ($http, $q) { var PROJECT_CONF_URL = 'conf/app-conf.json'; var PROJECTS_PROGRESS_ENDPOINT = '/api/projects_progress'; + var UPLOADED_SIGNS = '/countVideo'; function accessGoalsData(goals, projectName, param) { var projectGoals = goals[projectName]; @@ -16,18 +17,31 @@ return { getProjectsProgressData: function() { return $http.get(PROJECT_CONF_URL).then(function(response) { - var baseApiUrl = response.data.pybossa_url; + var basePyBossaApiUrl = response.data.pybossa_url; + var baseDBApiUrl = response.data.db_api_url; var responseGoals = response.data.goals; - return $http.get(baseApiUrl + PROJECTS_PROGRESS_ENDPOINT).then(function(response) { - var responseProgress = response.data; - angular.forEach(responseProgress, function(progress) { - progress['goal_n_tasks'] = accessGoalsData(responseGoals, progress.short_name,'goal_n_tasks'); - progress['goal_deadline'] = moment(accessGoalsData(responseGoals, progress.short_name,'goal_deadline'), "DD/MM/YYYY"); - progress['last_activity'] = moment(progress['last_activity']); + return $q.all([ + $http.get(basePyBossaApiUrl + PROJECTS_PROGRESS_ENDPOINT), + $http.get(baseDBApiUrl + UPLOADED_SIGNS) + ]).then(function(response) { + var responseProgress = response[0].data; + var uploadSignsProgress = { + 'short_name': 'uploaded_signs', + 'n_completed_tasks': response[1].data[0] + }; + responseProgress.push(uploadSignsProgress); + + angular.forEach(responseProgress, function(progress) { + progress['goal_n_tasks'] = accessGoalsData(responseGoals, progress.short_name, 'goal_n_tasks'); + progress['goal_deadline'] = moment(accessGoalsData(responseGoals, progress.short_name, 'goal_deadline'), "DD/MM/YYYY"); + progress['last_activity'] = moment(progress['last_activity']); + }); + + console.log(responseProgress); + + return responseProgress; }); - return responseProgress; - }); }); } }; diff --git a/assets/js/ranking/ranking.controller.js b/assets/js/ranking/ranking.controller.js index 3900aec..8ad8eb9 100644 --- a/assets/js/ranking/ranking.controller.js +++ b/assets/js/ranking/ranking.controller.js @@ -11,7 +11,6 @@ rankingService.getRankingData().then(function(response) { $scope.rankingData = response; - console.log(response); }); }]); }()); \ No newline at end of file diff --git a/assets/js/signs/signs.controller.js b/assets/js/signs/signs.controller.js new file mode 100644 index 0000000..fe79c03 --- /dev/null +++ b/assets/js/signs/signs.controller.js @@ -0,0 +1,21 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.signs').controller('signsCtrl', ['$scope', 'signsService', function ($scope, signsService) { + $scope.signsData = []; + $scope.activeSignId = -1; + + signsService.getSignsData().then(function(response) { + $scope.signsData = response; + }); + + $scope.getSignData = function(id) { + return $scope.signsData[id]; + }; + + $scope.showSignModal = function(id) { + $scope.activeSignId = id; + $('.sign-modal').modal('show'); + }; + }]); +}()); \ No newline at end of file diff --git a/assets/js/signs/signs.module.js b/assets/js/signs/signs.module.js new file mode 100644 index 0000000..1568476 --- /dev/null +++ b/assets/js/signs/signs.module.js @@ -0,0 +1,5 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.signs', []); +}()); \ No newline at end of file diff --git a/assets/js/signs/signs.service.js b/assets/js/signs/signs.service.js new file mode 100644 index 0000000..1a661ac --- /dev/null +++ b/assets/js/signs/signs.service.js @@ -0,0 +1,39 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.signs').service("signsService", ['$http', '$sce', function ($http, $sce) { + var PROJECT_CONF_URL = 'conf/app-conf.json'; + var PROJECT_LAST_ANSWERS_ENDPOINT = '/api/project_last_answers'; + + function buildSignUrl(baseUrl, parameterJson) { + var signUrl = baseUrl + '/public/' + parameterJson.userId + '/' + parameterJson.sinal; + return [{'path': $sce.trustAsResourceUrl(signUrl + '.webm'), 'type': 'video/webm'}, {'path': $sce.trustAsResourceUrl(signUrl + '.mp4'), 'type': 'video/mp4'}]; + } + + return { + getSignsData: function() { + return $http.get(PROJECT_CONF_URL).then(function(response) { + var basePyBossaApiUrl = response.data.pybossa_url; + var baseWikiLibrasApiUrl = response.data.wikilibras_api_url; + + return $http.get(basePyBossaApiUrl + PROJECT_LAST_ANSWERS_ENDPOINT).then(function(response) { + var projects = response.data; + var signsData = []; + angular.forEach(projects, function(data) { + if (data.project_name !== 'wikilibras') return; + angular.forEach(data.last_answers, function(answer) { + var signData = {}; + signData.signName = answer.taskrun_info.parameter_json.sinal; + signData.userId = answer.taskrun_info.parameter_json.userId; + signData.sources = buildSignUrl(baseWikiLibrasApiUrl, answer.taskrun_info.parameter_json); + signsData.push(signData); + }); + }); + console.log(signsData); + return signsData; + }); + }); + } + }; + }]); +}()); \ No newline at end of file diff --git a/assets/js/signs/video-fix.directive.js b/assets/js/signs/video-fix.directive.js new file mode 100644 index 0000000..0217fd0 --- /dev/null +++ b/assets/js/signs/video-fix.directive.js @@ -0,0 +1,12 @@ +(function () { + 'use strict'; + + angular.module('wikilibras.signs').directive('html5vfix', function() { + return { + restrict: 'A', + link: function(scope, element, attr) { + attr.$set('src', attr.vsrc); + } + } + }); +}()); \ No newline at end of file diff --git a/assets/js/volunteers/volunteers.service.js b/assets/js/volunteers/volunteers.service.js index f291693..7beab45 100644 --- a/assets/js/volunteers/volunteers.service.js +++ b/assets/js/volunteers/volunteers.service.js @@ -3,16 +3,22 @@ angular.module('wikilibras.volunteers').service("volunteersService", ['$http', function ($http) { var PROJECT_CONF_URL = 'conf/app-conf.json'; - var VOLUNTEERS_ENDPOINT = '/api/user?limit=50'; + var VOLUNTEERS_ENDPOINT = '/api/user'; return { getVolunteersData: function() { return $http.get(PROJECT_CONF_URL).then(function(response) { var baseApiUrl = response.data.pybossa_url; return $http.get(baseApiUrl + VOLUNTEERS_ENDPOINT).then(function(response) { - var volunteersData = response.data; - angular.forEach(volunteersData, function(data) { + var volunteersData = {}; + volunteersData['users_data'] = response.data; + volunteersData['avatars_data'] = []; + + angular.forEach(volunteersData['users_data'], function(data) { data.info['avatar_url'] = data.info.container && data.info.avatar? baseApiUrl + '/uploads/' + data.info.container + '/' + data.info.avatar : ''; + if (data.info['avatar_url'] !== '') { + volunteersData['avatars_data'].push(data.info['avatar_url']); + } }); console.log(volunteersData); return volunteersData; diff --git a/assets/templates/header.html b/assets/templates/header.html index 7e8bbb8..c003dfc 100644 --- a/assets/templates/header.html +++ b/assets/templates/header.html @@ -34,14 +34,14 @@ - Ir para o conteúdo (alt+1) + Ir para o conteúdo (alt+1) Ir para o menu (alt+2) - + Participar - Entrar + Entrar @@ -59,11 +59,11 @@ - o projeto + o projeto o que já produzimos tutoriais quem faz o que - ranking + ranking diff --git a/assets/templates/sections.html b/assets/templates/sections.html index dfe990b..57fc750 100644 --- a/assets/templates/sections.html +++ b/assets/templates/sections.html @@ -6,6 +6,7 @@ + @@ -35,17 +36,17 @@ + aria-valuemax="100" style="width: {{ (progress.uploaded_signs.n_completed_tasks/progress.uploaded_signs.goal_n_tasks)*100 }}%"> - Feitos: 150 + Feitos: {{ progress.uploaded_signs.n_completed_tasks }} - Meta: 410 + Meta: {{ progress.uploaded_signs.goal_n_tasks }} - 10 dias restantes + {{ progress.uploaded_signs.goal_deadline | amDifference : dateTo : 'days' }} dias restantes @@ -57,7 +58,7 @@ + aria-valuemax="100" style="width: {{ (progress.wikilibras.n_completed_tasks/progress.wikilibras.goal_n_tasks)*100 }}%"> @@ -79,7 +80,7 @@ + aria-valuemax="100" style="width: {{ (progress.corretor_sinais.n_completed_tasks/progress.corretor_sinais.goal_n_tasks)*100 }}%"> @@ -101,7 +102,7 @@ + aria-valuemax="100" style="width: {{ (progress.validador_sinais.n_completed_tasks/progress.validador_sinais.goal_n_tasks)*100 }}%"> @@ -118,7 +119,6 @@ - @@ -136,7 +136,7 @@ - + enviar video @@ -154,7 +154,7 @@ - + criar sinal @@ -172,7 +172,7 @@ - + corrigir sinal @@ -194,12 +194,8 @@ colaborando - - - - + + @@ -209,7 +205,7 @@ - + sinais construídos @@ -219,8 +215,32 @@ Lorem Ipsum é simplesmente uma simulação de texto da indústria tipográfica e de impressos, e vem sendo utilizado desde o século XVI. - - + + + + Sem suporte a vídeos + + + + + + + + + + + + + Sem suporte a vídeos + + + + {{ getSignData(activeSignId).signName }} + criado por: {{ getSignData(activeSignId).userId }} + + + diff --git a/conf/app-conf.json b/conf/app-conf.json index 3ca0016..49e5fe2 100644 --- a/conf/app-conf.json +++ b/conf/app-conf.json @@ -1,6 +1,12 @@ { "pybossa_url": "http://localhost/pybossa", + "wikilibras_api_url": "http://localhost:5001", + "db_api_url": "http://150.165.204.35:200", "goals": { + "uploaded_signs": { + "goal_n_tasks": 10, + "goal_deadline": "27/09/2016" + }, "wikilibras": { "goal_n_tasks": 20, "goal_deadline": "30/09/2016" diff --git a/conf/app-conf.json.template b/conf/app-conf.json.template new file mode 100644 index 0000000..280d7e9 --- /dev/null +++ b/conf/app-conf.json.template @@ -0,0 +1,19 @@ +{ + "pybossa_url": "", + "wikilibras_api_url": "", + "db_api_url": "", + "goals": { + "wikilibras": { + "goal_n_tasks": 20, + "goal_deadline": "30/09/2016" + }, + "corretor_sinais": { + "goal_n_tasks": 30, + "goal_deadline": "29/09/2016" + }, + "validador_sinais": { + "goal_n_tasks": 40, + "goal_deadline": "28/09/2016" + } + } +} \ No newline at end of file diff --git a/index.html b/index.html index 4a526fe..053267e 100644 --- a/index.html +++ b/index.html @@ -25,9 +25,16 @@ + + + + + + + -- libgit2 0.21.2
Lorem Ipsum é simplesmente uma simulação de texto da indústria tipográfica e de impressos, e vem sendo utilizado desde o século XVI.
+ {{ getSignData(activeSignId).signName }} + criado por: {{ getSignData(activeSignId).userId }} +