Commit 5738291d04d868c697d5460af0fe71203967785b

Authored by Leonardo Merlin
2 parents 1236933e 89eb86c0

Merge branch 'refact-proposal-image'

src/app/components/article-service/article.service.js
... ... @@ -329,6 +329,5 @@
329 329  
330 330 data.articles = results;
331 331 }
332   -
333 332 }
334 333 })();
... ...
src/app/components/category-list/category-list.html
... ... @@ -18,6 +18,9 @@
18 18 <span class="category-list--label">{{::category.name}}</span>
19 19 <span class="category-list--icon--right glyphicon glyphicon-chevron-right hidden-xs" ng-hide="vm.selectedCategory.slug === category.slug"></span>
20 20 <span class="category-list--icon--right glyphicon glyphicon-remove hidden-xs" ng-show="vm.selectedCategory.slug === category.slug"></span>
  21 + <div ng-if="category.archived" class="category-list--icon-archived">
  22 + <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
  23 + </div>
21 24 </button>
22 25 </div>
23 26 </nav>
... ...
src/app/components/category-list/category-list.scss
... ... @@ -77,6 +77,24 @@
77 77 }
78 78 }
79 79  
  80 + &--icon-archived {
  81 + position: absolute;
  82 + width: 15px;
  83 + height: 15px;
  84 + font-size: 12px;
  85 + bottom: 8px;
  86 + left: 41px;
  87 +
  88 + .glyphicon {
  89 + position: relative;
  90 + top: -2px;
  91 + color: #fff;
  92 + background-color: #3FC869;
  93 + padding: 3px;
  94 + border-radius: 100%;
  95 + }
  96 + }
  97 +
80 98 .category-list--icon {
81 99 position: absolute;
82 100 top: 6px;
... ...
src/app/components/dialoga-service/dialoga.service.js
... ... @@ -321,6 +321,40 @@
321 321 }
322 322  
323 323 _pipeCalcColors(data);
  324 + _pipeCheckArchived(data);
  325 + }
  326 +
  327 +
  328 + function _pipeCheckArchived(data){
  329 +
  330 + var programs = data.article.children; // Programas
  331 + var themes = data.article.categories; // Temas
  332 +
  333 + // para cada Tema
  334 + for (var i = themes.length - 1; i >= 0; i--) {
  335 + var theme = themes[i];
  336 +
  337 + // para cada programa
  338 + for (var j = programs.length - 1; j >= 0; j--) {
  339 + var program = programs[j];
  340 +
  341 + // Verifica se o programa 'j' perntece ao tema 'i'
  342 + if(program.categories && program.categories.length > 0){
  343 + if(angular.equals(program.categories[0].slug, theme.slug)){
  344 +
  345 + // Verifica se o programa está 'congelado' (archived)
  346 + if(program.archived){
  347 + theme.archived = true;
  348 + break;
  349 + }
  350 + }
  351 + }
  352 + }
  353 +
  354 + if(!theme.archived){
  355 + theme.archived = false;
  356 + }
  357 + }
324 358 }
325 359  
326 360 function _pipeSetPrograms (data) {
... ...
src/app/pages/programas/programa.controller.js
... ... @@ -120,6 +120,18 @@
120 120 // TODO: load and show proposal response
121 121 }
122 122 }
  123 +
  124 + // HACK: get image from body 'proposal'
  125 + // remove tags html
  126 + for (var j = vm.proposalsTopRated.length - 1; j >= 0; j--) {
  127 + var proposalTopRated = vm.proposalsTopRated[j];
  128 + if (proposalTopRated && proposalTopRated.body && proposalTopRated.body.length > 0) {
  129 + proposalTopRated.body = String(proposalTopRated.body).replace(/<[^>]+>/gm, '');
  130 + }else{
  131 + proposalTopRated.body = vm.banner.src;
  132 + }
  133 + }
  134 +
123 135 }, function(error) {
124 136 vm.$log.error(error);
125 137 vm.loadingTopProposals = false;
... ...
src/app/pages/programas/programa.html
... ... @@ -234,7 +234,7 @@
234 234 <div class="container">
235 235 <div class="row">
236 236 <div class="col-sm-4 col-md-3">
237   - <div class="img-mask--container" ng-style="{'background-image':'url( {{::pagePrograma.banner.src}} )'}">
  237 + <div class="img-mask--container" ng-style="{'background-image':'url( {{::proposal.body}} )'}">
238 238 <div class="img-mask--background">
239 239 <div class="icon icon-programa-respondido">
240 240 <div class="icon-circle">
... ...
src/app/pages/respostas/respostas.controller.js
... ... @@ -64,7 +64,17 @@
64 64 // 1. Load themes
65 65 vm.loadingThemes = true;
66 66 vm.DialogaService.getThemes(function(themes) {
67   - vm.themes = themes;
  67 + var archivedThemes = [];
  68 +
  69 + for (var i = themes.length - 1; i >= 0; i--) {
  70 + var theme = themes[i];
  71 +
  72 + if(theme.archived){
  73 + archivedThemes.push(theme);
  74 + }
  75 + }
  76 +
  77 + vm.themes = archivedThemes;
68 78 vm.loadingThemes = false;
69 79 vm.loading = false;
70 80  
... ...