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,11 +9,12 @@ | ||
9 | function proposalList() { | 9 | function proposalList() { |
10 | 10 | ||
11 | /** @ngInject */ | 11 | /** @ngInject */ |
12 | - function ProposalListController(ArticleService, $scope, $element, $timeout, $log) { | 12 | + function ProposalListController(ArticleService, $state, $scope, $element, $timeout, $log) { |
13 | $log.debug('ProposalListController'); | 13 | $log.debug('ProposalListController'); |
14 | 14 | ||
15 | var vm = this; | 15 | var vm = this; |
16 | vm.ArticleService = ArticleService; | 16 | vm.ArticleService = ArticleService; |
17 | + vm.$state = $state; | ||
17 | vm.$scope = $scope; | 18 | vm.$scope = $scope; |
18 | vm.$element = $element; | 19 | vm.$element = $element; |
19 | vm.$timeout = $timeout; | 20 | vm.$timeout = $timeout; |
@@ -49,7 +50,7 @@ | @@ -49,7 +50,7 @@ | ||
49 | vm.pages = (vm.proposalsLength / vm.per_page) +1; | 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,6 +88,18 @@ | ||
87 | vm.currentPageIndex = pageIndex; | 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 | function attachPopover(){ | 103 | function attachPopover(){ |
91 | var vm = this; | 104 | var vm = this; |
92 | 105 |
src/app/components/proposal-list/proposal-list.html
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | <tbody> | 16 | <tbody> |
17 | <tr ng-repeat="proposal in vm.proposalsPerPage"> | 17 | <tr ng-repeat="proposal in vm.proposalsPerPage"> |
18 | <td class="color-theme-fg"> | 18 | <td class="color-theme-fg"> |
19 | - <span class="position">{{::($index+1)}}º</span> | 19 | + <span class="position">{{::proposal.ranking_position}}º</span> |
20 | </td> | 20 | </td> |
21 | <td> | 21 | <td> |
22 | <div class="row"> | 22 | <div class="row"> |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | </div> | 26 | </div> |
27 | <div class="row row-actions"> | 27 | <div class="row row-actions"> |
28 | <div class="col-md-9"> | 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 | Avalie esta proposta | 30 | Avalie esta proposta |
31 | <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> | 31 | <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> |
32 | </button> | 32 | </button> |