Commit 2ba818c290979ab025512f190bb92ae73652fb49

Authored by Victor Costa
2 parents b909842c 7b462e99

Merge branch 'master' into staging

src/app/components/app-paginator/app-paginator.scss
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 font-weight: bold; 8 font-weight: bold;
9 font-size: 20px; 9 font-size: 20px;
10 padding: 0px 8px; 10 padding: 0px 8px;
11 - width: 28px; 11 + min-width: 28px;
12 height: 28px; 12 height: 28px;
13 text-decoration: underline; 13 text-decoration: underline;
14 color: $defaultblue; 14 color: $defaultblue;
src/app/components/article-service/article.service.js
@@ -32,7 +32,8 @@ @@ -32,7 +32,8 @@
32 subscribeToEvent: subscribeToEvent, 32 subscribeToEvent: subscribeToEvent,
33 searchTopics: searchTopics, 33 searchTopics: searchTopics,
34 searchProposals: searchProposals, 34 searchProposals: searchProposals,
35 - sendContactForm: sendContactForm 35 + sendContactForm: sendContactForm,
  36 + getRankedProposalsByTopicId: getRankedProposalsByTopicId
36 }; 37 };
37 38
38 return service; 39 return service;
@@ -138,6 +139,37 @@ @@ -138,6 +139,37 @@
138 139
139 } 140 }
140 141
  142 + function getRankedProposalsByTopicId (proposalId, params, cbSuccess, cbError) {
  143 + var url = service.apiProposals + proposalId + '/ranking';
  144 + var paramsExtended = angular.extend({
  145 + page: 1,
  146 + per_page: 10,
  147 + type: 'ProposalsDiscussionPlugin::Proposal',
  148 + 'fields[]': [
  149 + 'id',
  150 + 'abstract',
  151 + 'hits',
  152 + 'ranking_position',
  153 + 'votes_against',
  154 + 'votes_count',
  155 + 'votes_for',
  156 + 'parent',
  157 + 'categories',
  158 + 'slug',
  159 + 'url', // parent.image.url
  160 + 'image',
  161 + 'title',
  162 + 'archived',
  163 + ]
  164 + }, params);
  165 +
  166 + UtilService.get(url, {params: paramsExtended}).then(function(data){
  167 + cbSuccess(data);
  168 + }).catch(function(error){
  169 + cbError(error);
  170 + });
  171 + }
  172 +
141 function getProposalByIdRanked (proposalId, params, cbSuccess, cbError) { 173 function getProposalByIdRanked (proposalId, params, cbSuccess, cbError) {
142 var url = service.apiProposals + proposalId + '/ranking?per_page=5&page=1'; 174 var url = service.apiProposals + proposalId + '/ranking?per_page=5&page=1';
143 var paramsExtended = angular.extend({ 175 var paramsExtended = angular.extend({
@@ -380,4 +412,4 @@ function _pipeRemoveOldEvents(data){ @@ -380,4 +412,4 @@ function _pipeRemoveOldEvents(data){
380 data.articles = results; 412 data.articles = results;
381 } 413 }
382 } 414 }
383 -})();  
384 \ No newline at end of file 415 \ No newline at end of file
  416 +})();
src/app/components/dialoga-service/dialoga.service.js
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
27 extendedService.getQuestions = getQuestions; 27 extendedService.getQuestions = getQuestions;
28 extendedService.searchPrograms = searchPrograms; 28 extendedService.searchPrograms = searchPrograms;
29 extendedService.searchProposals = searchProposals; 29 extendedService.searchProposals = searchProposals;
  30 + extendedService.getRankedProposalsByTopicId = getRankedProposalsByTopicId;
30 extendedService.sendContactForm = sendContactForm; 31 extendedService.sendContactForm = sendContactForm;
31 extendedService.filterProposalsByCategorySlug = filterProposalsByCategorySlug; 32 extendedService.filterProposalsByCategorySlug = filterProposalsByCategorySlug;
32 extendedService.filterProposalsByProgramId = filterProposalsByProgramId; 33 extendedService.filterProposalsByProgramId = filterProposalsByProgramId;
@@ -247,6 +248,10 @@ @@ -247,6 +248,10 @@
247 ArticleService.searchProposals(params, cbSuccess, cbError); 248 ArticleService.searchProposals(params, cbSuccess, cbError);
248 } 249 }
249 250
  251 + function getRankedProposalsByTopicId (params, cbSuccess, cbError) {
  252 + ArticleService.getRankedProposalsByTopicId(params, cbSuccess, cbError);
  253 + }
  254 +
250 function sendContactForm (data) { 255 function sendContactForm (data) {
251 return ArticleService.sendContactForm(API.communityId, data); 256 return ArticleService.sendContactForm(API.communityId, data);
252 } 257 }
@@ -490,4 +495,4 @@ @@ -490,4 +495,4 @@
490 return abstract.replace(style, ''); 495 return abstract.replace(style, '');
491 } 496 }
492 } 497 }
493 -})();  
494 \ No newline at end of file 498 \ No newline at end of file
  499 +})();
src/app/pages/ranking/ranking.controller.js
@@ -226,9 +226,9 @@ @@ -226,9 +226,9 @@
226 if (query) {params.query = query; } 226 if (query) {params.query = query; }
227 227
228 vm.loadingProposals = true; 228 vm.loadingProposals = true;
229 - vm.DialogaService.searchProposals(params, function(data) { 229 + vm.DialogaService.getRankedProposalsByTopicId(selectedProgram.id, params, function(data) {
230 vm.total_proposals = parseInt(data._obj.headers('total')); 230 vm.total_proposals = parseInt(data._obj.headers('total'));
231 - vm.filtredProposals = data.articles; 231 + vm.filtredProposals = data.proposals;
232 vm.loadingProposals = false; 232 vm.loadingProposals = false;
233 }, function(error) { 233 }, function(error) {
234 vm.error = error; 234 vm.error = error;