Commit 780703a9de29574b17a38c913202bbf9e1254d33
1 parent
9d6bb366
Exists in
master
and in
4 other branches
Add focus on top3 proposals
Showing
2 changed files
with
21 additions
and
3 deletions
Show diff stats
src/app/pages/programas/programa.controller.js
| @@ -98,8 +98,26 @@ | @@ -98,8 +98,26 @@ | ||
| 98 | // show 'respostas e compromissos', | 98 | // show 'respostas e compromissos', |
| 99 | // ONLY IF the proposal is below or equal 3th position. | 99 | // ONLY IF the proposal is below or equal 3th position. |
| 100 | if (vm.search.proposal_id) { | 100 | if (vm.search.proposal_id) { |
| 101 | - // TODO: | ||
| 102 | - vm.$log.error('Not implemented yet.'); | 101 | + var found = false; |
| 102 | + var proposal_id = parseInt(vm.search.proposal_id); | ||
| 103 | + for (var i = vm.proposalsTopRated.length - 1; i >= 0; i--) { | ||
| 104 | + var proposal = vm.proposalsTopRated[i]; | ||
| 105 | + | ||
| 106 | + if(proposal.id === proposal_id){ | ||
| 107 | + found = true; | ||
| 108 | + break; | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + if (!found){ | ||
| 113 | + vm.$log.debug('Proposal is not one of top 3.'); | ||
| 114 | + return; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + // set focus at proposal, ASYNC | ||
| 118 | + vm.$rootScope.findElAsyncAndFocus('.sub-section-' + proposal.id); | ||
| 119 | + | ||
| 120 | + // TODO: load and show proposal response | ||
| 103 | } | 121 | } |
| 104 | } | 122 | } |
| 105 | }, function(error) { | 123 | }, function(error) { |
src/app/pages/programas/programa.html
| @@ -230,7 +230,7 @@ | @@ -230,7 +230,7 @@ | ||
| 230 | </div> | 230 | </div> |
| 231 | <div ng-if="pagePrograma.proposalsTopRated"> | 231 | <div ng-if="pagePrograma.proposalsTopRated"> |
| 232 | <div ng-repeat="proposal in pagePrograma.proposalsTopRated"> | 232 | <div ng-repeat="proposal in pagePrograma.proposalsTopRated"> |
| 233 | - <div class="sub-section"> | 233 | + <div class="sub-section sub-section-{{::proposal.id}}"> |
| 234 | <div class="container"> | 234 | <div class="container"> |
| 235 | <div class="row"> | 235 | <div class="row"> |
| 236 | <div class="col-sm-4 col-md-3"> | 236 | <div class="col-sm-4 col-md-3"> |