Commit 499deb48e7bbd9fe252bb94e8e5cbbdfb3681f7c
1 parent
5d427492
Exists in
master
and in
8 other branches
Sync
Showing
5 changed files
with
30 additions
and
10 deletions
Show diff stats
src/app/components/article-service/article.service.js
... | ... | @@ -121,13 +121,14 @@ |
121 | 121 | var url = service.apiArticles + topicId + '/children'; |
122 | 122 | |
123 | 123 | var paramsExtended = angular.extend({ |
124 | - 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], | |
125 | - 'limit':'20', | |
126 | - 'page':'1', | |
124 | + // 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], | |
125 | + // 'limit':'20', | |
126 | + // 'page':'1', | |
127 | 127 | 'content_type':'ProposalsDiscussionPlugin::Proposal' |
128 | 128 | }, params); |
129 | 129 | |
130 | 130 | UtilService.get(url, {params: paramsExtended}).then(function(data){ |
131 | + _pipeInjectSlugIntoParentProgram(data); | |
131 | 132 | cbSuccess(data); |
132 | 133 | }).catch(function(error){ |
133 | 134 | cbError(error); |
... | ... | @@ -180,5 +181,15 @@ |
180 | 181 | cbError(error); |
181 | 182 | }); |
182 | 183 | } |
184 | + | |
185 | + function _pipeInjectSlugIntoParentProgram(data){ | |
186 | + var proposals = data.articles; | |
187 | + for (var i = proposals.length - 1; i >= 0; i--) { | |
188 | + var proposal = proposals[i]; | |
189 | + if(proposal.parent && !proposal.parent.slug){ | |
190 | + proposal.parent.slug = Slug.slugify(proposal.parent.title); | |
191 | + } | |
192 | + }; | |
193 | + } | |
183 | 194 | } |
184 | 195 | })(); | ... | ... |
src/app/components/proposal-box/proposal-box.directive.js
... | ... | @@ -27,11 +27,13 @@ |
27 | 27 | |
28 | 28 | }; |
29 | 29 | |
30 | - ProposalBoxController.prototype.showContent = function (program) { | |
30 | + ProposalBoxController.prototype.showContent2 = function (topic) { | |
31 | 31 | var vm = this; |
32 | 32 | |
33 | + console.log('topic', topic); | |
34 | + | |
33 | 35 | vm.$state.go('programa-conteudo', { |
34 | - slug: program.slug | |
36 | + slug: topic.slug | |
35 | 37 | }, { |
36 | 38 | location: true |
37 | 39 | }); | ... | ... |
src/app/components/proposal-box/proposal-box.html
1 | -<div class="proposal-box" ng-class="{'focus':vm.isFocused}"> | |
1 | +<div class="proposal-box" ng-class="[{'focus': vm.isFocused}, vm.category.slug]"> | |
2 | 2 | <div class="proposal-box--top"> |
3 | 3 | <div class="proposal-box--theme color-theme-bg-darker">{{::vm.category.name}}</div> |
4 | 4 | <div class="proposal-box--program color-theme-bg">{{::vm.topic.title}}</div> |
... | ... | @@ -7,10 +7,10 @@ |
7 | 7 | <div class="proposal-box--content"> |
8 | 8 | <div class="proposal-box--content-inner" ng-bind-html="vm.proposal.abstract"></div> |
9 | 9 | </div> |
10 | - <div ng-if="vm.vote==false" class="proposal-box--join"> | |
11 | - <button class="btn btn-link" ng-click="vm.showContent(vm.topic)">Participe</button> | |
10 | + <div ng-show="!vm.vote" class="proposal-box--join"> | |
11 | + <button class="btn btn-link" ng-click="vm.showContent2(vm.topic)">Participe</button> | |
12 | 12 | </div> |
13 | - <div ng-if="vm.vote==true"class="proposal-box--actions text-center"> | |
13 | + <div ng-show="vm.vote"class="proposal-box--actions text-center"> | |
14 | 14 | <div class="row"> |
15 | 15 | <div class="col-xs-4"> |
16 | 16 | <div class="action vote_for"> | ... | ... |
src/app/components/proposal-grid/proposal-grid.html
1 | 1 | <div class="proposal-grid row"> |
2 | 2 | <div ng-repeat="proposal in vm.proposals as results"> |
3 | - <proposal-box proposal="proposal" category="proposal.categories[0]" class="col-xs-12 col-sm-6"></proposal-box> | |
3 | + <proposal-box proposal="proposal" topic="proposal.parent" category="proposal.parent.categories[0]" class="col-xs-12 col-sm-6"></proposal-box> | |
4 | 4 | <div ng-if="$odd" class="clearfix"></div> |
5 | 5 | </div> |
6 | 6 | <div class="animate-repeat" ng-if="results.length == 0"> | ... | ... |
src/app/pages/programas/programa-content.controller.js
... | ... | @@ -39,6 +39,13 @@ |
39 | 39 | |
40 | 40 | // Get program by slug |
41 | 41 | var slug = vm.$state.params.slug; |
42 | + | |
43 | + if(!slug){ | |
44 | + vm.$log.error('slug not defined.'); | |
45 | + vm.$log.info('Rollback to home page.'); | |
46 | + vm.$state.go('inicio', {}, {location: true}); | |
47 | + } | |
48 | + | |
42 | 49 | vm.DialogaService.getProgramBySlug(slug, function(article) { |
43 | 50 | vm.article = article; |
44 | 51 | vm.category = vm.article.categories[0]; | ... | ... |