diff --git a/src/app/components/article-service/article.service.js b/src/app/components/article-service/article.service.js index 0686e70..d6b6c11 100644 --- a/src/app/components/article-service/article.service.js +++ b/src/app/components/article-service/article.service.js @@ -121,13 +121,14 @@ var url = service.apiArticles + topicId + '/children'; var paramsExtended = angular.extend({ - 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], - 'limit':'20', - 'page':'1', + // 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], + // 'limit':'20', + // 'page':'1', 'content_type':'ProposalsDiscussionPlugin::Proposal' }, params); UtilService.get(url, {params: paramsExtended}).then(function(data){ + _pipeInjectSlugIntoParentProgram(data); cbSuccess(data); }).catch(function(error){ cbError(error); @@ -180,5 +181,15 @@ cbError(error); }); } + + function _pipeInjectSlugIntoParentProgram(data){ + var proposals = data.articles; + for (var i = proposals.length - 1; i >= 0; i--) { + var proposal = proposals[i]; + if(proposal.parent && !proposal.parent.slug){ + proposal.parent.slug = Slug.slugify(proposal.parent.title); + } + }; + } } })(); diff --git a/src/app/components/proposal-box/proposal-box.directive.js b/src/app/components/proposal-box/proposal-box.directive.js index 128e1cd..81a8b58 100644 --- a/src/app/components/proposal-box/proposal-box.directive.js +++ b/src/app/components/proposal-box/proposal-box.directive.js @@ -27,11 +27,13 @@ }; - ProposalBoxController.prototype.showContent = function (program) { + ProposalBoxController.prototype.showContent2 = function (topic) { var vm = this; + console.log('topic', topic); + vm.$state.go('programa-conteudo', { - slug: program.slug + slug: topic.slug }, { location: true }); diff --git a/src/app/components/proposal-box/proposal-box.html b/src/app/components/proposal-box/proposal-box.html index e466623..8f4cb96 100644 --- a/src/app/components/proposal-box/proposal-box.html +++ b/src/app/components/proposal-box/proposal-box.html @@ -1,4 +1,4 @@ -