Commit 4fdd69a0f3e1d8ca2efff93ba648a4430e277508
Exists in
master
and in
5 other branches
Merge branch 'feature-respostas'
Showing
9 changed files
with
246 additions
and
90 deletions
Show diff stats
src/app/components/article-service/article.service.js
| @@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
| 23 | getProposals: getProposals, | 23 | getProposals: getProposals, |
| 24 | getProposalById: getProposalById, | 24 | getProposalById: getProposalById, |
| 25 | getProposalsByTopicId: getProposalsByTopicId, | 25 | getProposalsByTopicId: getProposalsByTopicId, |
| 26 | + getResponseByProposalId: getResponseByProposalId, | ||
| 26 | createProposal: createProposal, | 27 | createProposal: createProposal, |
| 27 | voteProposal: voteProposal, | 28 | voteProposal: voteProposal, |
| 28 | getEvents: getEvents, | 29 | getEvents: getEvents, |
| @@ -139,6 +140,13 @@ | @@ -139,6 +140,13 @@ | ||
| 139 | getProposalById(topicId + '/children', params, cbSuccess, cbError); | 140 | getProposalById(topicId + '/children', params, cbSuccess, cbError); |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 143 | + function getResponseByProposalId (proposalId) { | ||
| 144 | + var url = service.apiArticles + proposalId; | ||
| 145 | + // var paramsExtended = {}; | ||
| 146 | + | ||
| 147 | + return UtilService.get(url); | ||
| 148 | + } | ||
| 149 | + | ||
| 142 | function createProposal (proposal, targetId, categoryId, cbSuccess, cbError){ | 150 | function createProposal (proposal, targetId, categoryId, cbSuccess, cbError){ |
| 143 | 151 | ||
| 144 | if(!$rootScope.currentUser){ | 152 | if(!$rootScope.currentUser){ |
src/app/components/dialoga-service/dialoga.service.js
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | extendedService.getProgramsByThemeId = getProgramsByThemeId; | 22 | extendedService.getProgramsByThemeId = getProgramsByThemeId; |
| 23 | extendedService.getProgramsRandom = getProgramsRandom; | 23 | extendedService.getProgramsRandom = getProgramsRandom; |
| 24 | extendedService.getEvents = getEvents; // override | 24 | extendedService.getEvents = getEvents; // override |
| 25 | + extendedService.getResponseByProposalId = getResponseByProposalId; | ||
| 25 | extendedService.getQuestions = getQuestions; | 26 | extendedService.getQuestions = getQuestions; |
| 26 | extendedService.searchPrograms = searchPrograms; | 27 | extendedService.searchPrograms = searchPrograms; |
| 27 | extendedService.searchProposals = searchProposals; | 28 | extendedService.searchProposals = searchProposals; |
| @@ -212,6 +213,12 @@ | @@ -212,6 +213,12 @@ | ||
| 212 | return ArticleService.getEvents(API.communityId, paramsExtended); | 213 | return ArticleService.getEvents(API.communityId, paramsExtended); |
| 213 | } | 214 | } |
| 214 | 215 | ||
| 216 | + function getResponseByProposalId(/*proposalId*/){ | ||
| 217 | + | ||
| 218 | + return ArticleService.getResponseByProposalId(API.articleId.terms); | ||
| 219 | + // return ArticleService.getResponseByProposalId(proposalId); | ||
| 220 | + } | ||
| 221 | + | ||
| 215 | // TODO: implement | 222 | // TODO: implement |
| 216 | function getQuestions (cbSuccess/*, cbError*/) { | 223 | function getQuestions (cbSuccess/*, cbError*/) { |
| 217 | if( !!CACHE.questions ){ | 224 | if( !!CACHE.questions ){ |
src/app/index.run.js
| @@ -73,43 +73,44 @@ | @@ -73,43 +73,44 @@ | ||
| 73 | 73 | ||
| 74 | // 2. focus on input search at home. | 74 | // 2. focus on input search at home. |
| 75 | promise.then(function(){ | 75 | promise.then(function(){ |
| 76 | - | ||
| 77 | - findElAsync('input[type="search"]:visible', function ($el) { | ||
| 78 | - // scroll | ||
| 79 | - angular.element('html,body').animate({scrollTop: $el.offset().top}, 'fast'); | ||
| 80 | - // focus | ||
| 81 | - $el.focus(); | ||
| 82 | - }); | 76 | + $rootScope.findElAsyncAndFocus('input[type="search"]:visible'); |
| 83 | }); | 77 | }); |
| 84 | } | 78 | } |
| 79 | + }; | ||
| 85 | 80 | ||
| 86 | - // use jQuery and $interval to find element async. | ||
| 87 | - function findElAsync(query, cb, delay, max_exec) { | ||
| 88 | - delay = delay || 200; | ||
| 89 | - max_exec = max_exec || 20; | ||
| 90 | - var count_exec = 0; | ||
| 91 | - | ||
| 92 | - var stop = null; | ||
| 93 | - stop = $interval(function() { | ||
| 94 | - var $el = angular.element(query); | ||
| 95 | - | ||
| 96 | - if ($el && $el.length > 0) { | ||
| 97 | - cb($el); | ||
| 98 | - }else { | ||
| 99 | - $log.debug('[findElAsync] element not found.'); | ||
| 100 | - } | 81 | + $rootScope.findElAsyncAndFocus = function (query, delay, max_exec) { |
| 82 | + return $rootScope.findElAsync(query, function($el){ | ||
| 83 | + // scroll | ||
| 84 | + angular.element('html,body').animate({scrollTop: $el.offset().top}, 'fast'); | ||
| 85 | + // focus | ||
| 86 | + $el.focus(); | ||
| 87 | + }, delay, max_exec); | ||
| 88 | + }; | ||
| 101 | 89 | ||
| 102 | - count_exec++; | 90 | + $rootScope.findElAsync = function (query, cb, delay, max_exec) { |
| 91 | + // use jQuery and $interval to find element async. | ||
| 92 | + delay = delay || 200; | ||
| 93 | + max_exec = max_exec || 20; | ||
| 94 | + var count_exec = 0; | ||
| 95 | + | ||
| 96 | + var stop = null; | ||
| 97 | + stop = $interval(function() { | ||
| 98 | + var $el = angular.element(query); | ||
| 99 | + | ||
| 100 | + if ($el && $el.length > 0) { | ||
| 101 | + cb($el); | ||
| 102 | + }else { | ||
| 103 | + $log.debug('[findElAsync] element not found.'); | ||
| 104 | + } | ||
| 103 | 105 | ||
| 104 | - if (count_exec >= max_exec){ | ||
| 105 | - $interval.cancel(stop); | ||
| 106 | - stop = undefined; | ||
| 107 | - } | 106 | + count_exec++; |
| 108 | 107 | ||
| 109 | - }, delay); | ||
| 110 | - } | 108 | + if (count_exec >= max_exec){ |
| 109 | + $interval.cancel(stop); | ||
| 110 | + stop = undefined; | ||
| 111 | + } | ||
| 111 | 112 | ||
| 112 | - $log.debug('TODO: focusOnSearch'); | 113 | + }, delay); |
| 113 | }; | 114 | }; |
| 114 | 115 | ||
| 115 | $rootScope.scrollTo = function(target, $event) { | 116 | $rootScope.scrollTo = function(target, $event) { |
src/app/index.scss
| @@ -280,6 +280,7 @@ body { | @@ -280,6 +280,7 @@ body { | ||
| 280 | .color-theme-bg { background-color: $color;} | 280 | .color-theme-bg { background-color: $color;} |
| 281 | .color-theme-bg-complementar-1 { background-color: map-get($categories-complementary-1, $category);} | 281 | .color-theme-bg-complementar-1 { background-color: map-get($categories-complementary-1, $category);} |
| 282 | .color-theme-bg-complementar-2 { background-color: map-get($categories-complementary-2, $category);} | 282 | .color-theme-bg-complementar-2 { background-color: map-get($categories-complementary-2, $category);} |
| 283 | + .img-mask--background { background-color: fade-out($color, 0.5); } | ||
| 283 | 284 | ||
| 284 | .contraste & .color-theme-fg { color: #fff; } | 285 | .contraste & .color-theme-fg { color: #fff; } |
| 285 | .contraste & .color-theme-bg { background-color: #000;} | 286 | .contraste & .color-theme-bg { background-color: #000;} |
src/app/pages/programas/programa.controller.js
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | .controller('ProgramaPageController', ProgramaPageController); | 6 | .controller('ProgramaPageController', ProgramaPageController); |
| 7 | 7 | ||
| 8 | /** @ngInject */ | 8 | /** @ngInject */ |
| 9 | - function ProgramaPageController(DialogaService, PATH, VOTE_OPTIONS, PROPOSAL_STATUS, $state, $location, $scope, $rootScope, $element, $timeout, $sce, $log) { | 9 | + function ProgramaPageController(DialogaService, PATH, VOTE_OPTIONS, PROPOSAL_STATUS, $state, $location, $scope, $rootScope, $element, $sce, $log) { |
| 10 | var vm = this; | 10 | var vm = this; |
| 11 | 11 | ||
| 12 | vm.DialogaService = DialogaService; | 12 | vm.DialogaService = DialogaService; |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | vm.$scope = $scope; | 18 | vm.$scope = $scope; |
| 19 | vm.$rootScope = $rootScope; | 19 | vm.$rootScope = $rootScope; |
| 20 | vm.$element = $element; | 20 | vm.$element = $element; |
| 21 | - vm.$timeout = $timeout; | ||
| 22 | vm.$sce = $sce; | 21 | vm.$sce = $sce; |
| 23 | vm.$log = $log; | 22 | vm.$log = $log; |
| 24 | 23 | ||
| @@ -56,9 +55,10 @@ | @@ -56,9 +55,10 @@ | ||
| 56 | var slug = vm.$state.params.slug; | 55 | var slug = vm.$state.params.slug; |
| 57 | 56 | ||
| 58 | if (!slug) { | 57 | if (!slug) { |
| 59 | - vm.$log.error('slug not defined.'); | 58 | + vm.$log.warn('slug not defined.'); |
| 60 | vm.$log.info('Rollback to home page.'); | 59 | vm.$log.info('Rollback to home page.'); |
| 61 | - vm.$state.go('inicio', {}, {location: true}); | 60 | + vm.$state.go('inicio', {}, {location: 'replace'}); |
| 61 | + return; | ||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | vm.DialogaService.getProgramBySlug(slug, function(article) { | 64 | vm.DialogaService.getProgramBySlug(slug, function(article) { |
| @@ -78,11 +78,10 @@ | @@ -78,11 +78,10 @@ | ||
| 78 | }; | 78 | }; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | - if(vm.article.body && !vm.article.bodyTrusted){ | 81 | + if (vm.article.body && !vm.article.bodyTrusted) { |
| 82 | vm.article.bodyTrusted = vm.$sce.trustAsHtml(vm.article.body); | 82 | vm.article.bodyTrusted = vm.$sce.trustAsHtml(vm.article.body); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | - | ||
| 86 | vm.loadingTopProposals = true; | 85 | vm.loadingTopProposals = true; |
| 87 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { | 86 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { |
| 88 | 'limit': 5 | 87 | 'limit': 5 |
| @@ -93,18 +92,31 @@ | @@ -93,18 +92,31 @@ | ||
| 93 | vm.proposalsTopFive = vm.proposals.slice(0, 5); | 92 | vm.proposalsTopFive = vm.proposals.slice(0, 5); |
| 94 | vm.proposalsTopRated = vm.proposals.slice(0, 3); | 93 | vm.proposalsTopRated = vm.proposals.slice(0, 3); |
| 95 | vm.loadingTopProposals = false; | 94 | vm.loadingTopProposals = false; |
| 95 | + | ||
| 96 | + if (vm.article.archived) { | ||
| 97 | + | ||
| 98 | + // show 'respostas e compromissos', | ||
| 99 | + // ONLY IF the proposal is below or equal 3th position. | ||
| 100 | + if (vm.search.proposal_id) { | ||
| 101 | + // TODO: | ||
| 102 | + vm.$log.error('Not implemented yet.'); | ||
| 103 | + } | ||
| 104 | + } | ||
| 96 | }, function(error) { | 105 | }, function(error) { |
| 97 | vm.$log.error(error); | 106 | vm.$log.error(error); |
| 98 | vm.loadingTopProposals = false; | 107 | vm.loadingTopProposals = false; |
| 99 | }); | 108 | }); |
| 100 | 109 | ||
| 101 | - | ||
| 102 | - vm.loadingProposalBox = true; | ||
| 103 | - if (vm.search.proposal_id) { | ||
| 104 | - vm.loadProposalById(vm.search.proposal_id); | ||
| 105 | - }else { | ||
| 106 | - // random proposal | ||
| 107 | - vm.loadRandomProposal(); | 110 | + // load content of 'proposal-box' |
| 111 | + if (!vm.article.archived) { | ||
| 112 | + | ||
| 113 | + if (vm.search.proposal_id) { | ||
| 114 | + // load the proposal and set focus on proposal-box | ||
| 115 | + vm.loadProposalById(vm.search.proposal_id); | ||
| 116 | + }else { | ||
| 117 | + // load a random proposal at proposal-box | ||
| 118 | + vm.loadRandomProposal(); | ||
| 119 | + } | ||
| 108 | } | 120 | } |
| 109 | 121 | ||
| 110 | vm.loading = false; | 122 | vm.loading = false; |
| @@ -137,7 +149,7 @@ | @@ -137,7 +149,7 @@ | ||
| 137 | 149 | ||
| 138 | vm.error = error; | 150 | vm.error = error; |
| 139 | 151 | ||
| 140 | - if (vm.error.code === 400){ | 152 | + if (vm.error.code === 400) { |
| 141 | // Bad Request | 153 | // Bad Request |
| 142 | vm.error.message = ''; | 154 | vm.error.message = ''; |
| 143 | vm.error.message += 'Não foi possível enviar a proposta.<br>'; | 155 | vm.error.message += 'Não foi possível enviar a proposta.<br>'; |
| @@ -154,6 +166,7 @@ | @@ -154,6 +166,7 @@ | ||
| 154 | ProgramaPageController.prototype.loadProposalById = function(proposal_id) { | 166 | ProgramaPageController.prototype.loadProposalById = function(proposal_id) { |
| 155 | var vm = this; | 167 | var vm = this; |
| 156 | 168 | ||
| 169 | + vm.loadingProposalBox = true; | ||
| 157 | vm.DialogaService.getProposalById(proposal_id, { | 170 | vm.DialogaService.getProposalById(proposal_id, { |
| 158 | 'limit': '1' | 171 | 'limit': '1' |
| 159 | }, vm._handleSuccessOnGetProposal.bind(vm), vm._handleErrorOnGetProposal.bind(vm)); | 172 | }, vm._handleSuccessOnGetProposal.bind(vm), vm._handleErrorOnGetProposal.bind(vm)); |
| @@ -162,6 +175,7 @@ | @@ -162,6 +175,7 @@ | ||
| 162 | ProgramaPageController.prototype.loadRandomProposal = function() { | 175 | ProgramaPageController.prototype.loadRandomProposal = function() { |
| 163 | var vm = this; | 176 | var vm = this; |
| 164 | 177 | ||
| 178 | + vm.loadingProposalBox = true; | ||
| 165 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { | 179 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { |
| 166 | 'order': 'random()', | 180 | 'order': 'random()', |
| 167 | 'limit': '1', | 181 | 'limit': '1', |
| @@ -181,12 +195,7 @@ | @@ -181,12 +195,7 @@ | ||
| 181 | 195 | ||
| 182 | // scroll to focused proposal | 196 | // scroll to focused proposal |
| 183 | if (vm.search.proposal_id) { | 197 | if (vm.search.proposal_id) { |
| 184 | - vm.$timeout(function() { | ||
| 185 | - var target = angular.element('.focused-proposal'); | ||
| 186 | - if (target && target.length > 0) { | ||
| 187 | - angular.element('html,body').animate({scrollTop: target.offset().top}, 'fast'); | ||
| 188 | - } | ||
| 189 | - }, 300); | 198 | + vm.$rootScope.findElAsyncAndFocus('.focused-proposal'); |
| 190 | } | 199 | } |
| 191 | }; | 200 | }; |
| 192 | 201 | ||
| @@ -204,7 +213,7 @@ | @@ -204,7 +213,7 @@ | ||
| 204 | ProgramaPageController.prototype.vote = function(proposal_id, value) { | 213 | ProgramaPageController.prototype.vote = function(proposal_id, value) { |
| 205 | var vm = this; | 214 | var vm = this; |
| 206 | 215 | ||
| 207 | - if(vm.article.archived === true){ | 216 | + if (vm.article.archived) { |
| 208 | vm.$log.info('Article archived. Abort.'); | 217 | vm.$log.info('Article archived. Abort.'); |
| 209 | return; | 218 | return; |
| 210 | } | 219 | } |
| @@ -226,7 +235,7 @@ | @@ -226,7 +235,7 @@ | ||
| 226 | 235 | ||
| 227 | response.error = true; | 236 | response.error = true; |
| 228 | vm.$scope.$broadcast('proposal-box:vote-response', response); | 237 | vm.$scope.$broadcast('proposal-box:vote-response', response); |
| 229 | - }).finally(function(response){ | 238 | + }).finally(function(response) { |
| 230 | vm.$log.debug('voteProposal finally', response); | 239 | vm.$log.debug('voteProposal finally', response); |
| 231 | 240 | ||
| 232 | }); | 241 | }); |
| @@ -245,7 +254,7 @@ | @@ -245,7 +254,7 @@ | ||
| 245 | ProgramaPageController.prototype.showProposalForm = function() { | 254 | ProgramaPageController.prototype.showProposalForm = function() { |
| 246 | var vm = this; | 255 | var vm = this; |
| 247 | 256 | ||
| 248 | - if(vm.article.archived === true){ | 257 | + if (vm.article.archived) { |
| 249 | vm.$log.info('Article archived. Abort.'); | 258 | vm.$log.info('Article archived. Abort.'); |
| 250 | return; | 259 | return; |
| 251 | } | 260 | } |
| @@ -277,18 +286,64 @@ | @@ -277,18 +286,64 @@ | ||
| 277 | }; | 286 | }; |
| 278 | 287 | ||
| 279 | ProgramaPageController.prototype.toggleContentVisibility = function() { | 288 | ProgramaPageController.prototype.toggleContentVisibility = function() { |
| 289 | + var vm = this; | ||
| 280 | var $sectionContent = angular.element('.section-content'); | 290 | var $sectionContent = angular.element('.section-content'); |
| 281 | 291 | ||
| 282 | - if(!$sectionContent || $sectionContent.length === 0){ | 292 | + if (!$sectionContent || $sectionContent.length === 0) { |
| 283 | vm.$log.warn('".section-content" not found.'); | 293 | vm.$log.warn('".section-content" not found.'); |
| 284 | return; | 294 | return; |
| 285 | } | 295 | } |
| 286 | 296 | ||
| 287 | - if($sectionContent.is(':visible')){ | 297 | + if ($sectionContent.is(':visible')) { |
| 288 | $sectionContent.slideUp(); | 298 | $sectionContent.slideUp(); |
| 289 | - }else{ | 299 | + }else { |
| 290 | $sectionContent.slideDown(); | 300 | $sectionContent.slideDown(); |
| 291 | angular.element('html,body').animate({scrollTop: $sectionContent.offset().top}, 'fast'); | 301 | angular.element('html,body').animate({scrollTop: $sectionContent.offset().top}, 'fast'); |
| 292 | } | 302 | } |
| 293 | }; | 303 | }; |
| 304 | + | ||
| 305 | + ProgramaPageController.prototype.toggleResponseVisibility = function(proposal) { | ||
| 306 | + var vm = this; | ||
| 307 | + | ||
| 308 | + if(!proposal){ | ||
| 309 | + vm.$log.error('Error - proposal is:', proposal); | ||
| 310 | + return; | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + if(proposal.response){ | ||
| 314 | + // show response | ||
| 315 | + toggle(); | ||
| 316 | + }else{ | ||
| 317 | + | ||
| 318 | + // load response | ||
| 319 | + proposal.response = { | ||
| 320 | + loading: true, | ||
| 321 | + error: false, | ||
| 322 | + content: null | ||
| 323 | + }; | ||
| 324 | + | ||
| 325 | + vm.DialogaService.getResponseByProposalId(proposal.id) | ||
| 326 | + .then(function(data){ | ||
| 327 | + proposal.response.content = data.article.body; | ||
| 328 | + toggle(); | ||
| 329 | + }).catch(function(){ | ||
| 330 | + proposal.response.error = false; | ||
| 331 | + }).finally(function(){ | ||
| 332 | + proposal.response.loading = false; | ||
| 333 | + }); | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + function toggle () { | ||
| 337 | + var $el = angular.element('.gov-response-' + proposal.id); | ||
| 338 | + | ||
| 339 | + if ($el.is(':visible')) { | ||
| 340 | + $el.slideUp(); | ||
| 341 | + }else { | ||
| 342 | + $el.slideDown(100, function(){ | ||
| 343 | + angular.element('html,body').animate({scrollTop: $el.offset().top}, 'fast'); | ||
| 344 | + }); | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + }; | ||
| 348 | + | ||
| 294 | })(); | 349 | })(); |
src/app/pages/programas/programa.html
| @@ -28,7 +28,15 @@ | @@ -28,7 +28,15 @@ | ||
| 28 | <!-- Preview > coluna da esquerda --> | 28 | <!-- Preview > coluna da esquerda --> |
| 29 | <div class="col-md-8"> | 29 | <div class="col-md-8"> |
| 30 | <div class="program-preview--box contraste-box"> | 30 | <div class="program-preview--box contraste-box"> |
| 31 | - <div class="program-preview--banner" ng-style="{'background-image':'url( {{::pagePrograma.banner.src}} )'}"></div> | 31 | + <div class="program-preview--banner" ng-style="{'background-image':'url( {{::pagePrograma.banner.src}} )'}"> |
| 32 | + <div ng-if="pagePrograma.article.archived" class="img-mask--background"> | ||
| 33 | + <div class="icon icon-programa-respondido"> | ||
| 34 | + <div class="icon-circle"> | ||
| 35 | + <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 32 | <div class="program-preview--box--content-wrapper"> | 40 | <div class="program-preview--box--content-wrapper"> |
| 33 | <div class="program-preview--icon icon-wrapper-rounded color-theme-bg" ng-class="pagePrograma.category.slug"> | 41 | <div class="program-preview--icon icon-wrapper-rounded color-theme-bg" ng-class="pagePrograma.category.slug"> |
| 34 | <span class="icon" ng-class="'icon-tema-' + pagePrograma.category.slug"></span> | 42 | <span class="icon" ng-class="'icon-tema-' + pagePrograma.category.slug"></span> |
| @@ -60,7 +68,7 @@ | @@ -60,7 +68,7 @@ | ||
| 60 | </div> | 68 | </div> |
| 61 | <!-- Preview > coluna da direita --> | 69 | <!-- Preview > coluna da direita --> |
| 62 | <div class="col-md-4"> | 70 | <div class="col-md-4"> |
| 63 | - <div class="row"> | 71 | + <div class="row" ng-if="!pagePrograma.article.archived"> |
| 64 | <!-- Top Proposals --> | 72 | <!-- Top Proposals --> |
| 65 | <div> | 73 | <div> |
| 66 | <!-- Loading Top Proposals --> | 74 | <!-- Loading Top Proposals --> |
| @@ -76,7 +84,7 @@ | @@ -76,7 +84,7 @@ | ||
| 76 | </div> | 84 | </div> |
| 77 | </div> | 85 | </div> |
| 78 | <!-- Proposal Box --> | 86 | <!-- Proposal Box --> |
| 79 | - <div ng-if="!pagePrograma.article.archived"> | 87 | + <div> |
| 80 | <div class="col-xs-12" ng-if="!pagePrograma.loadingProposalBox && pagePrograma.randomProposal" ng-class="{'focused-proposal': !!pagePrograma.search.proposal_id}"> | 88 | <div class="col-xs-12" ng-if="!pagePrograma.loadingProposalBox && pagePrograma.randomProposal" ng-class="{'focused-proposal': !!pagePrograma.search.proposal_id}"> |
| 81 | <h3 class="color-theme-fg">Apoie outras propostas</h3> | 89 | <h3 class="color-theme-fg">Apoie outras propostas</h3> |
| 82 | <proposal-box proposal="pagePrograma.randomProposal" topic="pagePrograma.article" category="pagePrograma.category" show-vote="true" focus="{{pagePrograma.search.proposal_id}}" do-vote="pagePrograma.vote(proposal_id, value)" archived="pagePrograma.article.archived"></proposal-box> | 90 | <proposal-box proposal="pagePrograma.randomProposal" topic="pagePrograma.article" category="pagePrograma.category" show-vote="true" focus="{{pagePrograma.search.proposal_id}}" do-vote="pagePrograma.vote(proposal_id, value)" archived="pagePrograma.article.archived"></proposal-box> |
| @@ -101,6 +109,13 @@ | @@ -101,6 +109,13 @@ | ||
| 101 | </div> | 109 | </div> |
| 102 | </div> | 110 | </div> |
| 103 | </div> | 111 | </div> |
| 112 | + <div class="row" ng-if="pagePrograma.article.archived"> | ||
| 113 | + <!-- Archived buttons nav --> | ||
| 114 | + <div class="col-sm-12"> | ||
| 115 | + <div class="teste" ng-repeat="proposal in pagePrograma.proposalsTopRated"> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + </div> | ||
| 104 | </div> | 119 | </div> |
| 105 | </article> | 120 | </article> |
| 106 | </div> | 121 | </div> |
| @@ -181,10 +196,8 @@ | @@ -181,10 +196,8 @@ | ||
| 181 | <div class="row"> | 196 | <div class="row"> |
| 182 | <div class="col-sm-12"> | 197 | <div class="col-sm-12"> |
| 183 | <h2> | 198 | <h2> |
| 184 | - <div class="program-banner--icon-container" aria-hidden="true"> | ||
| 185 | - <div class="program-banner--icon icon-wrapper-rounded color-bg-white" ng-class="pagePrograma.category.slug"> | ||
| 186 | - <span class="icon" ng-class="'icon-discussion'"></span> | ||
| 187 | - </div> | 199 | + <div class="program-banner--icon" aria-hidden="true"> |
| 200 | + <div class="icon icon-respostas"></div> | ||
| 188 | </div> | 201 | </div> |
| 189 | <span class="archived-banner--title1">As propostas para este programa já foram</span> | 202 | <span class="archived-banner--title1">As propostas para este programa já foram</span> |
| 190 | <br/> | 203 | <br/> |
| @@ -207,20 +220,50 @@ | @@ -207,20 +220,50 @@ | ||
| 207 | </div> | 220 | </div> |
| 208 | </div> | 221 | </div> |
| 209 | <div ng-if="pagePrograma.proposalsTopRated"> | 222 | <div ng-if="pagePrograma.proposalsTopRated"> |
| 210 | - <div class="sub-section" ng-repeat="proposal in pagePrograma.proposalsTopRated"> | ||
| 211 | - <div class="container"> | ||
| 212 | - <div class="row"> | ||
| 213 | - <div class="col-sm-12"> | ||
| 214 | - <h3 class="color-theme-fg">{{($index+1)}}a proposta mais votada:</h3> | ||
| 215 | - <p>{{::proposal.abstract}}</p> | ||
| 216 | - | ||
| 217 | - <div class="button--themed"> | ||
| 218 | - <button class="btn btn-block"> | ||
| 219 | - Veja a resposta e o compromisso do governo | ||
| 220 | - <div class="button-left-icon"> | ||
| 221 | - <span class="glyphicon glyphicon-chevron-down pull-right color-theme-common-fg" aria-hidden="true"></span> | 223 | + <div ng-repeat="proposal in pagePrograma.proposalsTopRated"> |
| 224 | + <div class="sub-section"> | ||
| 225 | + <div class="container"> | ||
| 226 | + <div class="row"> | ||
| 227 | + <div class="col-sm-4 col-md-3"> | ||
| 228 | + <div class="img-mask--container" ng-style="{'background-image':'url( {{::pagePrograma.banner.src}} )'}"> | ||
| 229 | + <div class="img-mask--background"> | ||
| 230 | + <div class="icon icon-programa-respondido"> | ||
| 231 | + <div class="icon-circle"> | ||
| 232 | + <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> | ||
| 233 | + </div> | ||
| 234 | + </div> | ||
| 222 | </div> | 235 | </div> |
| 223 | - </button> | 236 | + </div> |
| 237 | + </div> | ||
| 238 | + <div class="col-sm-8 col-md-9"> | ||
| 239 | + <br> | ||
| 240 | + <h3 class="color-theme-fg">{{($index+1)}}a proposta mais votada:</h3> | ||
| 241 | + <p>{{::proposal.abstract}}</p> | ||
| 242 | + <div class="button--themed"> | ||
| 243 | + <button class="btn btn-block" ng-click="pagePrograma.toggleResponseVisibility(proposal)"> | ||
| 244 | + Veja a resposta e o compromisso do governo | ||
| 245 | + <div class="button-left-icon"> | ||
| 246 | + <span class="glyphicon glyphicon-chevron-down pull-right color-theme-common-fg" aria-hidden="true"></span> | ||
| 247 | + </div> | ||
| 248 | + </button> | ||
| 249 | + </div> | ||
| 250 | + <br> | ||
| 251 | + </div> | ||
| 252 | + </div> | ||
| 253 | + </div> | ||
| 254 | + </div> | ||
| 255 | + <div ng-if="proposal.response" class="gov-response gov-response-{{::proposal.id}}" style="display:none;"> | ||
| 256 | + <div class="container"> | ||
| 257 | + <div class="row"> | ||
| 258 | + <div class="col-sm-12"> | ||
| 259 | + <div ng-if="proposal.response.loading" class="alert alert-info" role="alert">Carregando a resposta e compromisso do governo.</div> | ||
| 260 | + <div ng-if="proposal.response.error" class="alert alert-warning" role="alert">Erro ao carregar a resposta e compromisso. Tente novamente ou <a ui-sref="duvidas">entre em contato</a>.</div> | ||
| 261 | + <div ng-if="proposal.response.content"> | ||
| 262 | + <h3 class="color-theme-fg">Compromissos:</h3> | ||
| 263 | + <div class="gov-response--content"> | ||
| 264 | + <div ng-bind-html="proposal.response.content"></div> | ||
| 265 | + </div> | ||
| 266 | + </div> | ||
| 224 | </div> | 267 | </div> |
| 225 | </div> | 268 | </div> |
| 226 | </div> | 269 | </div> |
| @@ -256,6 +299,15 @@ | @@ -256,6 +299,15 @@ | ||
| 256 | </div> | 299 | </div> |
| 257 | </section> | 300 | </section> |
| 258 | <section class="section-content" ng-style="{ display: pagePrograma.article.archived ? 'none': 'block' }"> | 301 | <section class="section-content" ng-style="{ display: pagePrograma.article.archived ? 'none': 'block' }"> |
| 302 | + <div ng-if="pagePrograma.article.archived"> | ||
| 303 | + <div class="container"> | ||
| 304 | + <div class="row"> | ||
| 305 | + <div class="col-sm-12 color-theme-fg"> | ||
| 306 | + <h3 style="font-weight: bold;">Sobre o programa:</h3> | ||
| 307 | + </div> | ||
| 308 | + </div> | ||
| 309 | + </div> | ||
| 310 | + </div> | ||
| 259 | <article class="program-content" ng-if="pagePrograma.article" ng-class="pagePrograma.article.slug"> | 311 | <article class="program-content" ng-if="pagePrograma.article" ng-class="pagePrograma.article.slug"> |
| 260 | <div ng-bind-html="pagePrograma.article.bodyTrusted"></div> | 312 | <div ng-bind-html="pagePrograma.article.bodyTrusted"></div> |
| 261 | </article> | 313 | </article> |
src/app/pages/programas/programas.scss
| @@ -182,6 +182,47 @@ | @@ -182,6 +182,47 @@ | ||
| 182 | .proposal-extended-section-header { | 182 | .proposal-extended-section-header { |
| 183 | position: relative; | 183 | position: relative; |
| 184 | } | 184 | } |
| 185 | + | ||
| 186 | + .img-mask--container { | ||
| 187 | + position: relative; | ||
| 188 | + background-position: center; | ||
| 189 | + background-size: cover; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + .img-mask--background { | ||
| 193 | + width: 100%; | ||
| 194 | + height: 100%; | ||
| 195 | + text-align: center; | ||
| 196 | + | ||
| 197 | + .icon-circle{ | ||
| 198 | + position: absolute; | ||
| 199 | + left: 50%; | ||
| 200 | + margin-left: -15px; | ||
| 201 | + bottom: -10px; | ||
| 202 | + width: 31px; | ||
| 203 | + height: 31px; | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + .glyphicon { | ||
| 207 | + position: relative; | ||
| 208 | + top: -2px; | ||
| 209 | + color: #fff; | ||
| 210 | + background-color: #3FC869; | ||
| 211 | + padding: 6px 5px 5px 6px; | ||
| 212 | + border-radius: 100%; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + .icon-programa-respondido { | ||
| 216 | + transform: scale(0.8); | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + .program-preview--banner .icon-programa-respondido { | ||
| 221 | + position: relative; | ||
| 222 | + top: 50%; | ||
| 223 | + margin-top: -100px; | ||
| 224 | + transform: scale(1); | ||
| 225 | + } | ||
| 185 | 226 | ||
| 186 | #section-archived-banner { | 227 | #section-archived-banner { |
| 187 | position: relative; | 228 | position: relative; |
| @@ -189,6 +230,7 @@ | @@ -189,6 +230,7 @@ | ||
| 189 | color: #fff; | 230 | color: #fff; |
| 190 | 231 | ||
| 191 | margin-top: 30px; | 232 | margin-top: 30px; |
| 233 | + margin-bottom: 20px; | ||
| 192 | 234 | ||
| 193 | h2 { | 235 | h2 { |
| 194 | font-size: 28px; | 236 | font-size: 28px; |
| @@ -208,19 +250,6 @@ | @@ -208,19 +250,6 @@ | ||
| 208 | .program-banner--icon { | 250 | .program-banner--icon { |
| 209 | float: left; | 251 | float: left; |
| 210 | margin-right: 20px; | 252 | margin-right: 20px; |
| 211 | - width: 85px; | ||
| 212 | - height: 85px; | ||
| 213 | - overflow: hidden; | ||
| 214 | - | ||
| 215 | - .icon-discussion { | ||
| 216 | - position: relative; | ||
| 217 | - top: -3px; | ||
| 218 | - left: -3px; | ||
| 219 | - display: block; | ||
| 220 | - width: 85px; | ||
| 221 | - height: 85px; | ||
| 222 | - background: red; | ||
| 223 | - } | ||
| 224 | } | 253 | } |
| 225 | 254 | ||
| 226 | .archived-banner--title2 { | 255 | .archived-banner--title2 { |
| @@ -234,7 +263,6 @@ | @@ -234,7 +263,6 @@ | ||
| 234 | font-weight: bold; | 263 | font-weight: bold; |
| 235 | } | 264 | } |
| 236 | .sub-section{ | 265 | .sub-section{ |
| 237 | - padding: 20px 0; | ||
| 238 | &:nth-child(odd) { | 266 | &:nth-child(odd) { |
| 239 | background-color: #f1f1f1; | 267 | background-color: #f1f1f1; |
| 240 | } | 268 | } |
| @@ -244,6 +272,10 @@ | @@ -244,6 +272,10 @@ | ||
| 244 | } | 272 | } |
| 245 | } | 273 | } |
| 246 | 274 | ||
| 275 | + .gov-response { | ||
| 276 | + background-color: #e1e1e1; | ||
| 277 | + } | ||
| 278 | + | ||
| 247 | .button--themed { | 279 | .button--themed { |
| 248 | position: relative; | 280 | position: relative; |
| 249 | max-width: 500px; | 281 | max-width: 500px; |
4.29 KB
2.02 KB