Commit 3ca1d39601394341bb38ffd215e4a4b113e71bfb
1 parent
505d9b3a
Exists in
master
and in
6 other branches
Handle archived program (DiscussionTopic) - issue #59
Showing
12 changed files
with
115 additions
and
49 deletions
Show diff stats
src/app/components/app-paginator/app-paginator.directive.js
@@ -46,11 +46,11 @@ | @@ -46,11 +46,11 @@ | ||
46 | AppPaginatorController.prototype.attachListeners = function() { | 46 | AppPaginatorController.prototype.attachListeners = function() { |
47 | var vm = this; | 47 | var vm = this; |
48 | 48 | ||
49 | - vm.$scope.$watch('vm.perPage', function(newValue/*, oldValue*/) { | 49 | + vm.$scope.$watch('vm.perPage', function() { |
50 | vm.calcArrayPages(); | 50 | vm.calcArrayPages(); |
51 | }); | 51 | }); |
52 | 52 | ||
53 | - vm.$scope.$watch('vm.total', function(newValue/*, oldValue*/) { | 53 | + vm.$scope.$watch('vm.total', function() { |
54 | vm.calcArrayPages(); | 54 | vm.calcArrayPages(); |
55 | }); | 55 | }); |
56 | }; | 56 | }; |
src/app/components/article-service/article.service.js
src/app/components/dialoga-service/dialoga.service.js
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | }else{ | 39 | }else{ |
40 | // load main content | 40 | // load main content |
41 | ArticleService.getArticleById(API.articleId.home, { | 41 | ArticleService.getArticleById(API.articleId.home, { |
42 | - 'fields[]': ['id','abstract','body','categories','children','children_count','title','slug','image','url', 'amount_of_children', 'archived'], | 42 | + 'fields[]': ['id','abstract','body','categories','children','children_count','title','slug','image','url', 'archived'], |
43 | 'content_type':'ProposalsDiscussionPlugin::DiscussionTopic' | 43 | 'content_type':'ProposalsDiscussionPlugin::DiscussionTopic' |
44 | }, function (data){ | 44 | }, function (data){ |
45 | CACHE.home = data; | 45 | CACHE.home = data; |
src/app/components/proposal-box/proposal-box.directive.js
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | var vm = this; | 33 | var vm = this; |
34 | 34 | ||
35 | vm.showVote = vm.showVote || false; | 35 | vm.showVote = vm.showVote || false; |
36 | + vm.archived = vm.archived || false; | ||
36 | vm.focus = vm.focus || false; | 37 | vm.focus = vm.focus || false; |
37 | vm.STATE = null; | 38 | vm.STATE = null; |
38 | vm.errorOnSkip = false; | 39 | vm.errorOnSkip = false; |
@@ -169,6 +170,11 @@ | @@ -169,6 +170,11 @@ | ||
169 | ProposalBoxController.prototype.vote = function(value) { | 170 | ProposalBoxController.prototype.vote = function(value) { |
170 | var vm = this; | 171 | var vm = this; |
171 | 172 | ||
173 | + if(vm.archived === true){ | ||
174 | + vm.$log.info('Article archived. Abort.'); | ||
175 | + return; | ||
176 | + } | ||
177 | + | ||
172 | vm._oldVoteValue = value; | 178 | vm._oldVoteValue = value; |
173 | if (vm.canVote()) { | 179 | if (vm.canVote()) { |
174 | if (vm.doVote) { | 180 | if (vm.doVote) { |
@@ -190,6 +196,11 @@ | @@ -190,6 +196,11 @@ | ||
190 | ProposalBoxController.prototype.skip = function() { | 196 | ProposalBoxController.prototype.skip = function() { |
191 | var vm = this; | 197 | var vm = this; |
192 | 198 | ||
199 | + if(vm.archived === true){ | ||
200 | + vm.$log.info('Article archived. Abort.'); | ||
201 | + return; | ||
202 | + } | ||
203 | + | ||
193 | vm.errorOnSkip = false; | 204 | vm.errorOnSkip = false; |
194 | vm.STATE = vm.VOTE_STATUS.LOADING; | 205 | vm.STATE = vm.VOTE_STATUS.LOADING; |
195 | vm.doVote({ | 206 | vm.doVote({ |
@@ -226,15 +237,16 @@ | @@ -226,15 +237,16 @@ | ||
226 | restrict: 'E', | 237 | restrict: 'E', |
227 | templateUrl: 'app/components/proposal-box/proposal-box.html', | 238 | templateUrl: 'app/components/proposal-box/proposal-box.html', |
228 | scope: { | 239 | scope: { |
229 | - proposal: '=', | ||
230 | - topic: '=', | ||
231 | - category: '=', | ||
232 | - showVote: '=', | ||
233 | - focus: '@', | ||
234 | - doVote: '&' | ||
235 | // @ -> Text binding / one-way binding | 240 | // @ -> Text binding / one-way binding |
236 | // = -> Direct model binding / two-way binding | 241 | // = -> Direct model binding / two-way binding |
237 | // & -> Behaviour binding / Method binding | 242 | // & -> Behaviour binding / Method binding |
243 | + archived: '=', | ||
244 | + category: '=', | ||
245 | + doVote: '&', | ||
246 | + focus: '@', | ||
247 | + proposal: '=', | ||
248 | + showVote: '=', | ||
249 | + topic: '=', | ||
238 | }, | 250 | }, |
239 | controller: ProposalBoxController, | 251 | controller: ProposalBoxController, |
240 | controllerAs: 'vm', | 252 | controllerAs: 'vm', |
src/app/components/proposal-box/proposal-box.html
@@ -145,9 +145,16 @@ | @@ -145,9 +145,16 @@ | ||
145 | <div class="proposal-box--content-inner">{{vm.proposal.abstract}}</div> | 145 | <div class="proposal-box--content-inner">{{vm.proposal.abstract}}</div> |
146 | </div> | 146 | </div> |
147 | <div ng-hide="vm.showVote" class="proposal-box--join"> | 147 | <div ng-hide="vm.showVote" class="proposal-box--join"> |
148 | - <button class="btn btn-link color-theme-common-fg" ng-click="vm.showContent(vm.topic.slug)"> | ||
149 | - Participe | ||
150 | - </button> | 148 | + <button |
149 | + class="btn btn-link color-theme-common-fg" | ||
150 | + ng-if="vm.archived === false" | ||
151 | + ng-click="vm.showContent(vm.topic.slug)" | ||
152 | + >Participe</button> | ||
153 | + <button | ||
154 | + class="btn btn-link color-theme-common-fg" | ||
155 | + ng-if="vm.archived === true" | ||
156 | + ng-click="vm.showContent(vm.topic.slug)" | ||
157 | + >Ir para o programa</button> | ||
151 | </div> | 158 | </div> |
152 | <div ng-show="vm.showVote" class="proposal-box--actions text-center"> | 159 | <div ng-show="vm.showVote" class="proposal-box--actions text-center"> |
153 | <div class="row"> | 160 | <div class="row"> |
src/app/components/proposal-carousel/proposal-carousel.directive.js
@@ -31,6 +31,7 @@ | @@ -31,6 +31,7 @@ | ||
31 | } | 31 | } |
32 | 32 | ||
33 | vm.activeIndex = 0; | 33 | vm.activeIndex = 0; |
34 | + vm.archived = vm.archived || false; | ||
34 | vm.loading = false; | 35 | vm.loading = false; |
35 | vm.proposalsLength = vm.proposals.length; | 36 | vm.proposalsLength = vm.proposals.length; |
36 | }; | 37 | }; |
@@ -80,6 +81,7 @@ | @@ -80,6 +81,7 @@ | ||
80 | restrict: 'E', | 81 | restrict: 'E', |
81 | templateUrl: 'app/components/proposal-carousel/proposal-carousel.html', | 82 | templateUrl: 'app/components/proposal-carousel/proposal-carousel.html', |
82 | scope: { | 83 | scope: { |
84 | + archived: '=', | ||
83 | proposals: '=' | 85 | proposals: '=' |
84 | }, | 86 | }, |
85 | controller: ProposalCarouselController, | 87 | controller: ProposalCarouselController, |
src/app/components/proposal-carousel/proposal-carousel.html
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | <div class="inner">{{::proposal.abstract}}</div> | 20 | <div class="inner">{{::proposal.abstract}}</div> |
21 | </div> | 21 | </div> |
22 | </div> | 22 | </div> |
23 | - <div class="join" ng-show="vm.activeIndex === $index"> | 23 | + <div class="join" ng-if="vm.archived === false" ng-show="vm.activeIndex === $index"> |
24 | <button type="button" class="btn btn-link btn-rate color-theme-common-fg" ng-click="vm.showContent(proposal)"> | 24 | <button type="button" class="btn btn-link btn-rate color-theme-common-fg" ng-click="vm.showContent(proposal)"> |
25 | Participe | 25 | Participe |
26 | <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> | 26 | <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> |
src/app/components/proposal-grid/proposal-grid.html
1 | <div class="proposal-grid row"> | 1 | <div class="proposal-grid row"> |
2 | <div ng-repeat="proposal in vm.proposals as results"> | 2 | <div ng-repeat="proposal in vm.proposals as results"> |
3 | - <proposal-box proposal="proposal" topic="proposal.parent" category="proposal.parent.categories[0]" show-vote="false" class="col-xs-12 col-sm-6"></proposal-box> | 3 | + <proposal-box |
4 | + archived="proposal.parent.archived" | ||
5 | + proposal="proposal" | ||
6 | + topic="proposal.parent" | ||
7 | + category="proposal.parent.categories[0]" | ||
8 | + show-vote="false" | ||
9 | + class="col-xs-12 col-sm-6" | ||
10 | + ></proposal-box> | ||
4 | <div ng-if="$odd" class="clearfix"></div> | 11 | <div ng-if="$odd" class="clearfix"></div> |
5 | </div> | 12 | </div> |
6 | <div class="animate-repeat" ng-if="results.length == 0"> | 13 | <div class="animate-repeat" ng-if="results.length == 0"> |
src/app/components/proposal-list/proposal-list.html
@@ -23,9 +23,20 @@ | @@ -23,9 +23,20 @@ | ||
23 | </div> | 23 | </div> |
24 | <div class="row row-actions"> | 24 | <div class="row row-actions"> |
25 | <div class="col-sm-8"> | 25 | <div class="col-sm-8"> |
26 | - <button type="button" class="btn btn-link btn-rate color-theme-common-fg" ng-click="vm.showContent(proposal)"> | ||
27 | - Participe | ||
28 | - </button> | 26 | + <div ng-if="proposal.parent.archived === false"> |
27 | + <button | ||
28 | + type="button" | ||
29 | + class="btn btn-link btn-rate color-theme-common-fg" | ||
30 | + ng-click="vm.showContent(proposal)" | ||
31 | + >Participe</button> | ||
32 | + </div> | ||
33 | + <div ng-if="proposal.parent.archived === true"> | ||
34 | + <button | ||
35 | + type="button" | ||
36 | + class="btn btn-link btn-rate color-theme-common-fg" | ||
37 | + ng-click="vm.showContent(proposal)" | ||
38 | + >Ir para o programa</button> | ||
39 | + </div> | ||
29 | </div> | 40 | </div> |
30 | <div class="col-sm-4"> | 41 | <div class="col-sm-4"> |
31 | <proposal-stats class="text-right" views="{{::proposal.hits}}" up="{{::proposal.votes_for}}" down="{{::proposal.votes_against}}"></proposal-stats> | 42 | <proposal-stats class="text-right" views="{{::proposal.hits}}" up="{{::proposal.votes_for}}" down="{{::proposal.votes_against}}"></proposal-stats> |
src/app/pages/programas/programa.controller.js
@@ -39,6 +39,7 @@ | @@ -39,6 +39,7 @@ | ||
39 | vm.loadingTopProposals = null; | 39 | vm.loadingTopProposals = null; |
40 | vm.loadingProposalBox = null; | 40 | vm.loadingProposalBox = null; |
41 | vm.sendProposalRedirectURI = null; | 41 | vm.sendProposalRedirectURI = null; |
42 | + vm.showDetailAboutArchived = false; | ||
42 | // vm.voteProposalRedirectURI = null; | 43 | // vm.voteProposalRedirectURI = null; |
43 | vm.search = vm.$location.search(); | 44 | vm.search = vm.$location.search(); |
44 | 45 | ||
@@ -86,7 +87,8 @@ | @@ -86,7 +87,8 @@ | ||
86 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { | 87 | vm.DialogaService.getProposalsByTopicId(vm.article.id, { |
87 | 'limit': 5 | 88 | 'limit': 5 |
88 | }, function(data) { | 89 | }, function(data) { |
89 | - vm.total_proposals = parseInt(vm.article.amount_of_children); | 90 | + vm.total_proposals = parseInt(vm.article.children_count); |
91 | + // vm.total_proposals = parseInt(vm.article.amount_of_children); // DEPRECATED?! | ||
90 | vm.proposals = data.articles; | 92 | vm.proposals = data.articles; |
91 | vm.proposalsTopFive = vm.proposals.slice(0, 5); | 93 | vm.proposalsTopFive = vm.proposals.slice(0, 5); |
92 | vm.proposalsTopRated = vm.proposals.slice(0, 3); | 94 | vm.proposalsTopRated = vm.proposals.slice(0, 3); |
@@ -202,6 +204,11 @@ | @@ -202,6 +204,11 @@ | ||
202 | ProgramaPageController.prototype.vote = function(proposal_id, value) { | 204 | ProgramaPageController.prototype.vote = function(proposal_id, value) { |
203 | var vm = this; | 205 | var vm = this; |
204 | 206 | ||
207 | + if(vm.article.archived === true){ | ||
208 | + vm.$log.info('Article archived. Abort.'); | ||
209 | + return; | ||
210 | + } | ||
211 | + | ||
205 | if (value === vm.VOTE_OPTIONS.SKIP) { | 212 | if (value === vm.VOTE_OPTIONS.SKIP) { |
206 | vm.voteSkip(); | 213 | vm.voteSkip(); |
207 | return; | 214 | return; |
@@ -237,6 +244,12 @@ | @@ -237,6 +244,12 @@ | ||
237 | 244 | ||
238 | ProgramaPageController.prototype.showProposalForm = function() { | 245 | ProgramaPageController.prototype.showProposalForm = function() { |
239 | var vm = this; | 246 | var vm = this; |
247 | + | ||
248 | + if(vm.article.archived === true){ | ||
249 | + vm.$log.info('Article archived. Abort.'); | ||
250 | + return; | ||
251 | + } | ||
252 | + | ||
240 | vm.findAndShow('#section-proposal-form'); | 253 | vm.findAndShow('#section-proposal-form'); |
241 | }; | 254 | }; |
242 | 255 |
src/app/pages/programas/programa.html
@@ -57,9 +57,19 @@ | @@ -57,9 +57,19 @@ | ||
57 | <div class="program-preview--make-proposal"> | 57 | <div class="program-preview--make-proposal"> |
58 | <div class="row"> | 58 | <div class="row"> |
59 | <div class="col-sm-6"> | 59 | <div class="col-sm-6"> |
60 | - <div class="button--themed"> | 60 | + <div class="button--themed" ng-if="!pagePrograma.article.archived"> |
61 | <button type="button" class="btn btn-block" ng-click="pagePrograma.showProposalForm()">Faça uma proposta</button> | 61 | <button type="button" class="btn btn-block" ng-click="pagePrograma.showProposalForm()">Faça uma proposta</button> |
62 | </div> | 62 | </div> |
63 | + <div ng-if="pagePrograma.article.archived"> | ||
64 | + <button type="button" | ||
65 | + class="btn btn-block disabled" | ||
66 | + title="Este programa já foi analisado. Não está mais habilitado a receber novas propostas." | ||
67 | + ng-click="pagePrograma.showDetailAboutArchived = true" | ||
68 | + >Faça uma proposta</button> | ||
69 | + </div> | ||
70 | + </div> | ||
71 | + <div class="col-sm-6" ng-show="pagePrograma.showDetailAboutArchived === true"> | ||
72 | + <p>(●) Este programa está arquivado.<br>Não pode receber novas propostas.</p> | ||
63 | </div> | 73 | </div> |
64 | </div> | 74 | </div> |
65 | </div> | 75 | </div> |
@@ -82,12 +92,15 @@ | @@ -82,12 +92,15 @@ | ||
82 | <!-- Top Proposals > Carousel --> | 92 | <!-- Top Proposals > Carousel --> |
83 | <div class="col-xs-12" ng-if="!pagePrograma.loadingTopProposals && pagePrograma.proposalsTopRated && pagePrograma.proposalsTopRated.length > 0"> | 93 | <div class="col-xs-12" ng-if="!pagePrograma.loadingTopProposals && pagePrograma.proposalsTopRated && pagePrograma.proposalsTopRated.length > 0"> |
84 | <h3 class="color-theme-fg">Propostas mais votadas</h3> | 94 | <h3 class="color-theme-fg">Propostas mais votadas</h3> |
85 | - <proposal-carousel proposals="pagePrograma.proposalsTopRated"></proposal-carousel> | 95 | + <proposal-carousel |
96 | + proposals="pagePrograma.proposalsTopRated" | ||
97 | + archived="pagePrograma.article.archived" | ||
98 | + ></proposal-carousel> | ||
86 | </div> | 99 | </div> |
87 | </div> | 100 | </div> |
88 | 101 | ||
89 | <!-- Proposal Box --> | 102 | <!-- Proposal Box --> |
90 | - <div> | 103 | + <div ng-if="!pagePrograma.article.archived"> |
91 | <div class="col-xs-12" ng-if="!pagePrograma.loadingProposalBox && pagePrograma.randomProposal" ng-class="{'focused-proposal': !!pagePrograma.search.proposal_id}"> | 104 | <div class="col-xs-12" ng-if="!pagePrograma.loadingProposalBox && pagePrograma.randomProposal" ng-class="{'focused-proposal': !!pagePrograma.search.proposal_id}"> |
92 | <h3 class="color-theme-fg">Apoie outras propostas</h3> | 105 | <h3 class="color-theme-fg">Apoie outras propostas</h3> |
93 | <proposal-box | 106 | <proposal-box |
@@ -97,6 +110,7 @@ | @@ -97,6 +110,7 @@ | ||
97 | show-vote="true" | 110 | show-vote="true" |
98 | focus="{{pagePrograma.search.proposal_id}}" | 111 | focus="{{pagePrograma.search.proposal_id}}" |
99 | do-vote="pagePrograma.vote(proposal_id, value)" | 112 | do-vote="pagePrograma.vote(proposal_id, value)" |
113 | + archived="pagePrograma.article.archived" | ||
100 | ></proposal-box> | 114 | ></proposal-box> |
101 | </div> | 115 | </div> |
102 | 116 | ||
@@ -136,7 +150,7 @@ | @@ -136,7 +150,7 @@ | ||
136 | </button> | 150 | </button> |
137 | </div> | 151 | </div> |
138 | <div class="proposal-extended-section-content"> | 152 | <div class="proposal-extended-section-content"> |
139 | - <proposal-list proposals="pagePrograma.proposalsTopFive"></proposal-list> | 153 | + <proposal-list proposals="pagePrograma.proposalsTopFive" archived="pagePrograma.article.archived"></proposal-list> |
140 | <div class="row text-center"> | 154 | <div class="row text-center"> |
141 | <div class="col-xs-12"> | 155 | <div class="col-xs-12"> |
142 | <a ui-sref="ranking({tema: pagePrograma.category.slug, programa: pagePrograma.article.slug})" class="btn btn-link"> | 156 | <a ui-sref="ranking({tema: pagePrograma.category.slug, programa: pagePrograma.article.slug})" class="btn btn-link"> |
src/app/pages/ranking/ranking.controller.js
@@ -37,6 +37,18 @@ | @@ -37,6 +37,18 @@ | ||
37 | vm.query = null; | 37 | vm.query = null; |
38 | vm.search = vm.$location.search(); | 38 | vm.search = vm.$location.search(); |
39 | 39 | ||
40 | + if (vm.search.tema) { | ||
41 | + vm._filtredByThemeSlug = vm.search.tema; | ||
42 | + } | ||
43 | + | ||
44 | + if (vm.search.programa) { | ||
45 | + vm._filtredByProgramSlug = vm.search.programa; | ||
46 | + } | ||
47 | + | ||
48 | + if (vm.search.tema || vm.search.programa) { | ||
49 | + vm.loadingFilter = true; | ||
50 | + } | ||
51 | + | ||
40 | vm.loading = null; | 52 | vm.loading = null; |
41 | vm.error = null; | 53 | vm.error = null; |
42 | }; | 54 | }; |
@@ -62,11 +74,11 @@ | @@ -62,11 +74,11 @@ | ||
62 | 74 | ||
63 | // 2. Select a Random Theme (T) | 75 | // 2. Select a Random Theme (T) |
64 | var selectedTheme = null; | 76 | var selectedTheme = null; |
65 | - if(vm.search.tema){ | 77 | + if(vm.search.tema || vm._filtredByThemeSlug){ |
66 | 78 | ||
67 | // vanilla filter | 79 | // vanilla filter |
68 | var results = vm.themes.filter(function(t){ | 80 | var results = vm.themes.filter(function(t){ |
69 | - return t.slug === vm.search.tema; | 81 | + return (t.slug === vm.search.tema || (t.slug === vm._filtredByThemeSlug)); |
70 | }); | 82 | }); |
71 | 83 | ||
72 | if(results && results.length > 0){ | 84 | if(results && results.length > 0){ |
@@ -85,6 +97,7 @@ | @@ -85,6 +97,7 @@ | ||
85 | vm.loadPrograms(themeId, function(){ | 97 | vm.loadPrograms(themeId, function(){ |
86 | // vm.loadProposals(); | 98 | // vm.loadProposals(); |
87 | vm.loading = false; | 99 | vm.loading = false; |
100 | + vm.loadingFilter = false; | ||
88 | }); | 101 | }); |
89 | }, function (error) { | 102 | }, function (error) { |
90 | vm.error = error; | 103 | vm.error = error; |
@@ -103,11 +116,11 @@ | @@ -103,11 +116,11 @@ | ||
103 | 116 | ||
104 | // 4. Select a random program of T | 117 | // 4. Select a random program of T |
105 | var selectedProgram = null; | 118 | var selectedProgram = null; |
106 | - if(vm.search.programa){ | 119 | + if(vm.search.programa || vm._filtredByProgramSlug){ |
107 | 120 | ||
108 | // vanilla filter | 121 | // vanilla filter |
109 | var results = vm.filtredPrograms.filter(function(p){ | 122 | var results = vm.filtredPrograms.filter(function(p){ |
110 | - return p.slug === vm.search.programa; | 123 | + return (p.slug === vm.search.programa || (p.slug === vm._filtredByProgramSlug)); |
111 | }); | 124 | }); |
112 | 125 | ||
113 | if(results && results.length > 0){ | 126 | if(results && results.length > 0){ |
@@ -131,26 +144,6 @@ | @@ -131,26 +144,6 @@ | ||
131 | }); | 144 | }); |
132 | }; | 145 | }; |
133 | 146 | ||
134 | - // RankingPageController.prototype.loadProposals = function () { | ||
135 | - // var vm = this; | ||
136 | - | ||
137 | - // // load Proposals | ||
138 | - // vm.loadingProposals = true; | ||
139 | - // vm.DialogaService.getProposals({ | ||
140 | - // page: vm.page, | ||
141 | - // per_page: vm.per_page | ||
142 | - // }, function(data){ | ||
143 | - // vm.filtredProposals = data.articles; | ||
144 | - // vm.loadingProposals = false; | ||
145 | - | ||
146 | - // vm.attachListeners(); | ||
147 | - // }, function (error) { | ||
148 | - // vm.error = error; | ||
149 | - // vm.$log.error(error); | ||
150 | - // vm.loadingProposals = false; | ||
151 | - // }); | ||
152 | - // }; | ||
153 | - | ||
154 | RankingPageController.prototype.attachListeners = function() { | 147 | RankingPageController.prototype.attachListeners = function() { |
155 | var vm = this; | 148 | var vm = this; |
156 | 149 | ||
@@ -162,7 +155,7 @@ | @@ -162,7 +155,7 @@ | ||
162 | vm.search.tema = newValue ? newValue.slug : null; | 155 | vm.search.tema = newValue ? newValue.slug : null; |
163 | vm.$location.search('tema', vm.search.tema); | 156 | vm.$location.search('tema', vm.search.tema); |
164 | 157 | ||
165 | - if(vm.selectedTheme && vm.selectedTheme.id){ | 158 | + if(!vm.loadingFilter && vm.selectedTheme && vm.selectedTheme.id){ |
166 | vm.loadPrograms(vm.selectedTheme.id, function(){ | 159 | vm.loadPrograms(vm.selectedTheme.id, function(){ |
167 | vm.filterProposals(); | 160 | vm.filterProposals(); |
168 | }); | 161 | }); |
@@ -176,13 +169,19 @@ | @@ -176,13 +169,19 @@ | ||
176 | vm.$scope.$watch('pageRanking.selectedProgram', function(newValue/*, oldValue*/) { | 169 | vm.$scope.$watch('pageRanking.selectedProgram', function(newValue/*, oldValue*/) { |
177 | vm.search.programa = newValue ? newValue.slug : null; | 170 | vm.search.programa = newValue ? newValue.slug : null; |
178 | vm.$location.search('programa', vm.search.programa); | 171 | vm.$location.search('programa', vm.search.programa); |
179 | - vm.filterProposals(); | 172 | + |
173 | + if (!vm.loadingFilter) { | ||
174 | + vm.filterProposals(); | ||
175 | + } | ||
180 | }); | 176 | }); |
181 | 177 | ||
182 | vm.$scope.$watch('pageRanking.query', function(newValue/*, oldValue*/) { | 178 | vm.$scope.$watch('pageRanking.query', function(newValue/*, oldValue*/) { |
183 | vm.search.filtro = newValue ? newValue : null; | 179 | vm.search.filtro = newValue ? newValue : null; |
184 | vm.$location.search('filtro', vm.search.filtro); | 180 | vm.$location.search('filtro', vm.search.filtro); |
185 | - vm.filterProposals(); | 181 | + |
182 | + if (!vm.loadingFilter) { | ||
183 | + vm.filterProposals(); | ||
184 | + } | ||
186 | }); | 185 | }); |
187 | }; | 186 | }; |
188 | 187 |