Commit e77cbbd4550204578bc78f43804b7e03d468bc74
1 parent
392298ff
Exists in
master
and in
8 other branches
Fix 'avalie esta proposta'
Showing
2 changed files
with
17 additions
and
4 deletions
Show diff stats
src/app/components/proposal-list/proposal-list.directive.js
| ... | ... | @@ -9,11 +9,12 @@ |
| 9 | 9 | function proposalList() { |
| 10 | 10 | |
| 11 | 11 | /** @ngInject */ |
| 12 | - function ProposalListController(ArticleService, $scope, $element, $timeout, $log) { | |
| 12 | + function ProposalListController(ArticleService, $state, $scope, $element, $timeout, $log) { | |
| 13 | 13 | $log.debug('ProposalListController'); |
| 14 | 14 | |
| 15 | 15 | var vm = this; |
| 16 | 16 | vm.ArticleService = ArticleService; |
| 17 | + vm.$state = $state; | |
| 17 | 18 | vm.$scope = $scope; |
| 18 | 19 | vm.$element = $element; |
| 19 | 20 | vm.$timeout = $timeout; |
| ... | ... | @@ -49,7 +50,7 @@ |
| 49 | 50 | vm.pages = (vm.proposalsLength / vm.per_page) +1; |
| 50 | 51 | }; |
| 51 | 52 | |
| 52 | - vm.arraypages = new Array(vm.pages); | |
| 53 | + vm.arraypages = new Array(Math.ceil(vm.pages)); | |
| 53 | 54 | |
| 54 | 55 | }; |
| 55 | 56 | |
| ... | ... | @@ -87,6 +88,18 @@ |
| 87 | 88 | vm.currentPageIndex = pageIndex; |
| 88 | 89 | }; |
| 89 | 90 | |
| 91 | + ProposalListController.prototype.showContent = function (proposal) { | |
| 92 | + var vm = this; | |
| 93 | + | |
| 94 | + vm.$state.go('programa-conteudo', { | |
| 95 | + slug: proposal.parent.slug, | |
| 96 | + proposal_id: proposal.id | |
| 97 | + }, { | |
| 98 | + location: true | |
| 99 | + }); | |
| 100 | + | |
| 101 | + } | |
| 102 | + | |
| 90 | 103 | function attachPopover(){ |
| 91 | 104 | var vm = this; |
| 92 | 105 | ... | ... |
src/app/components/proposal-list/proposal-list.html
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <tbody> |
| 17 | 17 | <tr ng-repeat="proposal in vm.proposalsPerPage"> |
| 18 | 18 | <td class="color-theme-fg"> |
| 19 | - <span class="position">{{::($index+1)}}º</span> | |
| 19 | + <span class="position">{{::proposal.ranking_position}}º</span> | |
| 20 | 20 | </td> |
| 21 | 21 | <td> |
| 22 | 22 | <div class="row"> |
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | </div> |
| 27 | 27 | <div class="row row-actions"> |
| 28 | 28 | <div class="col-md-9"> |
| 29 | - <button type="button" class="btn btn-link btn-rate color-theme-common-fg"> | |
| 29 | + <button type="button" class="btn btn-link btn-rate color-theme-common-fg" ng-click="vm.showContent(proposal)"> | |
| 30 | 30 | Avalie esta proposta |
| 31 | 31 | <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> |
| 32 | 32 | </button> | ... | ... |