Commit 460eb69d56796e134f016ab86c3b39af2b233932

Authored by Leonardo Merlin
1 parent b91f2ae9

sync

src/app/components/article-service/article.service.js
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 var url = service.apiArticles + topicId + '/children'; 121 var url = service.apiArticles + topicId + '/children';
122 122
123 var paramsExtended = angular.extend({ 123 var paramsExtended = angular.extend({
124 - 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count'], 124 + 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'],
125 'limit':'20', 125 'limit':'20',
126 'page':'1', 126 'page':'1',
127 'content_type':'ProposalsDiscussionPlugin::Proposal' 127 'content_type':'ProposalsDiscussionPlugin::Proposal'
src/app/components/category-list/category-list.directive.js
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 function categoryList() { 9 function categoryList() {
10 10
11 /** @ngInject */ 11 /** @ngInject */
12 - function CategoryListController($rootScope, $location, $log) { 12 + function CategoryListController($rootScope, $element, $log) {
13 $log.debug('CategoryListController'); 13 $log.debug('CategoryListController');
14 14
15 // alias 15 // alias
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 17
18 // dependencies 18 // dependencies
19 vm.$rootScope = $rootScope; 19 vm.$rootScope = $rootScope;
20 - vm.$location = $location; 20 + vm.$element = $element;
21 vm.$log = $log; 21 vm.$log = $log;
22 22
23 // initialization 23 // initialization
@@ -25,7 +25,11 @@ @@ -25,7 +25,11 @@
25 } 25 }
26 26
27 CategoryListController.prototype.init = function() { 27 CategoryListController.prototype.init = function() {
28 - // var vm = this; 28 + var vm = this;
  29 +
  30 + if(!vm.isCollapsed){
  31 + vm.isCollapsed = false;
  32 + }
29 }; 33 };
30 34
31 CategoryListController.prototype.selectCategory = function(category, $event) { 35 CategoryListController.prototype.selectCategory = function(category, $event) {
@@ -45,6 +49,17 @@ @@ -45,6 +49,17 @@
45 vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory); 49 vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory);
46 }; 50 };
47 51
  52 +
  53 + CategoryListController.prototype.toogleList = function() {
  54 + var vm = this;
  55 +
  56 + if(!vm._listGroup){
  57 + vm._listGroup = vm.$element.find('.list-group');
  58 + }
  59 +
  60 + vm._listGroup.slideToggle();
  61 + };
  62 +
48 var directive = { 63 var directive = {
49 restrict: 'E', 64 restrict: 'E',
50 templateUrl: 'app/components/category-list/category-list.html', 65 templateUrl: 'app/components/category-list/category-list.html',
@@ -53,7 +68,7 @@ @@ -53,7 +68,7 @@
53 selectedCategory: '@' 68 selectedCategory: '@'
54 }, 69 },
55 controller: CategoryListController, 70 controller: CategoryListController,
56 - controllerAs: 'categoryListCtrl', 71 + controllerAs: 'vm',
57 bindToController: true 72 bindToController: true
58 }; 73 };
59 74
src/app/components/category-list/category-list.html
1 <div class="category-list"> 1 <div class="category-list">
2 <nav class="navigation"> 2 <nav class="navigation">
3 - <h3 class="category-list--title"><b>Programas</b> por Tema</h3>  
4 - <div class="list-group category-list" ng-class="categoryListCtrl.selectedCategory.slug"> 3 + <h3 class="category-list--title" ng-click="vm.toogleList()">
  4 + <span class="hidden-xs"><b>Programas</b> por Tema</span>
  5 + <span class="visible-xs"><b>Filtrar</b> por Tema <span class="glyphicon glyphicon-filter pull-right"></span></span>
  6 + </h3>
  7 +
  8 + <!-- <div class="list-group ng-hide" ng-show="!vm.isCollapsed" ng-class="vm.selectedCategory.slug"> -->
  9 + <div class="list-group" ng-class="vm.selectedCategory.slug">
5 <button type="button" class="list-group-item category-list--item" 10 <button type="button" class="list-group-item category-list--item"
6 - ng-repeat="category in categoryListCtrl.categories"  
7 - ng-class="{active: categoryListCtrl.selectedCategory.slug === category.slug}"  
8 - ng-click="categoryListCtrl.selectCategory(category, $event)"> 11 + ng-repeat="category in vm.categories"
  12 + ng-class="{active: vm.selectedCategory.slug === category.slug}"
  13 + ng-click="vm.selectCategory(category, $event)">
9 14
10 <span class="category-list--icon-circle" aria-hidden="true" ng-class="category.slug"></span> 15 <span class="category-list--icon-circle" aria-hidden="true" ng-class="category.slug"></span>
11 <span class="category-list--icon icon" aria-hidden="true" ng-class="'icon-tema-' + category.slug"></span> 16 <span class="category-list--icon icon" aria-hidden="true" ng-class="'icon-tema-' + category.slug"></span>
12 <span class="category-list--label">{{::category.name}}</span> 17 <span class="category-list--label">{{::category.name}}</span>
13 - <span class="category-list--icon--right glyphicon glyphicon-chevron-right"></span> 18 + <span class="category-list--icon--right glyphicon glyphicon-chevron-right hidden-xs"></span>
14 </button> 19 </button>
15 </div> 20 </div>
16 </nav> 21 </nav>
src/app/components/category-list/category-list.scss
1 .category-list { 1 .category-list {
2 - .category-list--title { 2 + &--title {
3 color: #ffffff; 3 color: #ffffff;
4 font-size: 16px; 4 font-size: 16px;
5 margin: 0; 5 margin: 0;
@@ -8,10 +8,7 @@ @@ -8,10 +8,7 @@
8 border-top-left-radius: 5px; 8 border-top-left-radius: 5px;
9 border-top-right-radius: 5px; 9 border-top-right-radius: 5px;
10 overflow: hidden; 10 overflow: hidden;
11 - }  
12 -  
13 -  
14 - .category-list--group { 11 + cursor: pointer;
15 } 12 }
16 13
17 .category-list--item { 14 .category-list--item {
@@ -23,6 +20,8 @@ @@ -23,6 +20,8 @@
23 overflow: hidden; 20 overflow: hidden;
24 } 21 }
25 22
  23 +
  24 +
26 .category-list--label { 25 .category-list--label {
27 margin-left: 70px; 26 margin-left: 70px;
28 margin-right: 30px; 27 margin-right: 30px;
@@ -93,19 +92,25 @@ @@ -93,19 +92,25 @@
93 transform: scale(1.4); 92 transform: scale(1.4);
94 } 93 }
95 94
  95 + .list-group {
  96 +
  97 + -webkit-transition: -webkit-transform .3s ease-in-out;
  98 + -moz-transition: -moz-transform .3s ease-in-out;
  99 + -o-transition: -o-transform .3s ease-in-out;
  100 + transition: transform .3s ease-in-out;
  101 +
  102 + opacity: 1;
  103 +
  104 + &.ng-hide {
  105 + opacity: 0;
  106 + // height: 0;
  107 + // line-height: 0;
  108 + }
  109 + }
  110 +
96 .list-group-item.active, 111 .list-group-item.active,
97 .list-group-item.active:hover, 112 .list-group-item.active:hover,
98 .list-group-item.active:focus { 113 .list-group-item.active:focus {
99 background-color: #f5f5f5; 114 background-color: #f5f5f5;
100 } 115 }
101 -  
102 - // @each $category, $color in $categories {  
103 - // &.#{$category} {  
104 - // .list-group-item.active,  
105 - // .list-group-item.active:hover,  
106 - // .list-group-item.active:focus {  
107 - // background-color: $color;  
108 - // }  
109 - // }  
110 - // }  
111 } 116 }
src/app/components/event-list/event-list.scss
@@ -55,7 +55,12 @@ @@ -55,7 +55,12 @@
55 text-align: center; 55 text-align: center;
56 line-height: 20px; 56 line-height: 20px;
57 cursor: pointer; 57 cursor: pointer;
58 - transition: .3s linear all; 58 +
  59 + -webkit-transition: -webkit-transform 0.3s linear all;
  60 + -moz-transition: -moz-transform 0.3s linear all;
  61 + -o-transition: -o-transform 0.3s linear all;
  62 + transition: transform 0.3s linear all;
  63 +
59 overflow: hidden; 64 overflow: hidden;
60 z-index: 100; 65 z-index: 100;
61 66
src/app/components/proposal-carousel/proposal-carousel.scss
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 background-color: #f1f1f1; 2 background-color: #f1f1f1;
3 border-radius: 5px; 3 border-radius: 5px;
4 overflow: hidden; 4 overflow: hidden;
  5 + margin-bottom: 30px;
5 6
6 &-top { 7 &-top {
7 position: relative; 8 position: relative;
@@ -57,21 +58,20 @@ @@ -57,21 +58,20 @@
57 font-weight: bold; 58 font-weight: bold;
58 line-height: 116px; 59 line-height: 116px;
59 z-index: 1; 60 z-index: 1;
60 -  
61 } 61 }
62 } 62 }
63 63
64 &-bottom { 64 &-bottom {
65 position: relative; 65 position: relative;
66 color: #fff; 66 color: #fff;
67 - padding: 10px; 67 + padding: 15px 30px;
68 font-weight: bold; 68 font-weight: bold;
69 cursor: pointer; 69 cursor: pointer;
70 z-index: 10; 70 z-index: 10;
71 71
72 &-icon { 72 &-icon {
73 position: absolute; 73 position: absolute;
74 - top: 10px; 74 + top: 15px;
75 right: 15px; 75 right: 15px;
76 76
77 .glyphicon { 77 .glyphicon {
src/app/components/proposal-related/proposal-related.directive.js
@@ -9,14 +9,10 @@ @@ -9,14 +9,10 @@
9 function proposalRelated() { 9 function proposalRelated() {
10 10
11 /** @ngInject */ 11 /** @ngInject */
12 - function ProposalRelatedController(ArticleService, $scope, $element, $timeout, $log) { 12 + function ProposalRelatedController($log) {
13 $log.debug('ProposalRelatedController'); 13 $log.debug('ProposalRelatedController');
14 14
15 var vm = this; 15 var vm = this;
16 - vm.ArticleService = ArticleService;  
17 - vm.$scope = $scope;  
18 - vm.$element = $element;  
19 - vm.$timeout = $timeout;  
20 vm.$log = $log; 16 vm.$log = $log;
21 17
22 vm.init(); 18 vm.init();
@@ -24,69 +20,16 @@ @@ -24,69 +20,16 @@
24 20
25 ProposalRelatedController.prototype.init = function () { 21 ProposalRelatedController.prototype.init = function () {
26 // initial values 22 // initial values
27 - var vm = this;  
28 -  
29 - vm.activeIndex = 1;  
30 - vm.loading = false;  
31 -  
32 - if(angular.isDefined(vm.limit) && angular.isString(vm.limit)){  
33 - vm.limit = parseInt(vm.limit);  
34 - }else{  
35 - vm.limit = 3;  
36 - }  
37 -  
38 - vm.loadData();  
39 - };  
40 -  
41 - ProposalRelatedController.prototype.loadData = function () {  
42 - // async values  
43 - var vm = this;  
44 -  
45 - vm.loading = true;  
46 -  
47 - // simulate delay  
48 - vm.$timeout(function(){  
49 - vm.loading = false;  
50 -  
51 - // Fake Data  
52 - // vm.proposals = vm.ArticleService.getProposals();  
53 - vm.proposals = [{  
54 - id: 4159,  
55 - abstract: 'Ut odio unde porro in. Aut fuga magni adipisci. Recusandae ipsum distinctio omnis ut illum.',  
56 - effective_support: 0.1572052401746725,  
57 - hits: 4159,  
58 - votes_against: 3779,  
59 - votes_for: 1780  
60 - },{  
61 - id: 935,  
62 - abstract: 'Magni sunt ut molestiae. A porro et quod saepe placeat amet nihil. Aut ut id voluptatem doloribus quia.',  
63 - effective_support: 0.1572052401746725,  
64 - hits: 8602,  
65 - votes_against: 7005,  
66 - votes_for: 8728  
67 - },{  
68 - id: 1008,  
69 - abstract: 'Cum quas assumenda nihil delectus eos. Minus fugit velit voluptatem nisi nam esse ut id.',  
70 - effective_support: 0.1572052401746725,  
71 - hits: 9181,  
72 - votes_against: 612,  
73 - votes_for: 1786  
74 - }];  
75 -  
76 - if(vm.display === 'list'){  
77 - // wait until DOM be created  
78 - vm.$timeout(function(){  
79 - // attachPopover.call(vm);  
80 - }, 20);  
81 - }  
82 - }, 2000); 23 + // var vm = this;
83 }; 24 };
84 25
85 var directive = { 26 var directive = {
86 restrict: 'E', 27 restrict: 'E',
87 templateUrl: 'app/components/proposal-related/proposal-related.html', 28 templateUrl: 'app/components/proposal-related/proposal-related.html',
88 scope: { 29 scope: {
89 - article: '=' 30 + proposal: '=',
  31 + topic: '=',
  32 + category: '='
90 }, 33 },
91 controller: ProposalRelatedController, 34 controller: ProposalRelatedController,
92 controllerAs: 'vm', 35 controllerAs: 'vm',
src/app/components/proposal-related/proposal-related.html
1 <div class="proposal-related" ng-class="{'focus':vm.isFocused}"> 1 <div class="proposal-related" ng-class="{'focus':vm.isFocused}">
2 <div class="proposal-related--top"> 2 <div class="proposal-related--top">
3 - <div class="proposal-related--theme color-theme-bg-darker">[Nome do Tema]</div>  
4 - <div class="proposal-related--program color-theme-bg">[Nome do Programa]</div> 3 + <div class="proposal-related--theme color-theme-bg-darker">{{::vm.category.name}}</div>
  4 + <div class="proposal-related--program color-theme-bg">{{::vm.topic.title}}</div>
5 </div> 5 </div>
6 <div class="proposal-related--middle"> 6 <div class="proposal-related--middle">
7 - <div class="proposal-related--content">[Conteúdo ad proposta enviada]</div> 7 + <div class="proposal-related--content">
  8 + <div class="proposal-related--content-inner" ng-bind-html="vm.proposal.abstract"></div>
  9 + </div>
8 <div class="proposal-related--actions"> 10 <div class="proposal-related--actions">
9 <div class="row"> 11 <div class="row">
10 <div class="col-sm-4"> 12 <div class="col-sm-4">
src/app/components/proposal-related/proposal-related.scss
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 background-color: #f1f1f1; 2 background-color: #f1f1f1;
3 border-radius: 5px; 3 border-radius: 5px;
4 overflow: hidden; 4 overflow: hidden;
5 - 5 +
6 &.focus { 6 &.focus {
7 border: 7px solid #000; 7 border: 7px solid #000;
8 border-radius: 12px; 8 border-radius: 12px;
@@ -18,8 +18,10 @@ @@ -18,8 +18,10 @@
18 overflow: hidden; 18 overflow: hidden;
19 } 19 }
20 20
21 - // &--middle {}  
22 - 21 + &--middle {
  22 + padding: 30px;
  23 + }
  24 +
23 &--bottom { 25 &--bottom {
24 border-bottom-left-radius: 5px; 26 border-bottom-left-radius: 5px;
25 border-bottom-right-radius: 5px; 27 border-bottom-right-radius: 5px;
@@ -34,6 +36,10 @@ @@ -34,6 +36,10 @@
34 padding: 20px 15px; 36 padding: 20px 15px;
35 } 37 }
36 38
  39 + &--content {
  40 + padding-bottom: 20px;
  41 + }
  42 +
37 .glyphicon { 43 .glyphicon {
38 color: #fff; 44 color: #fff;
39 } 45 }
@@ -44,4 +50,4 @@ @@ -44,4 +50,4 @@
44 -moz-box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.3); 50 -moz-box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.3);
45 box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.3); 51 box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.3);
46 } 52 }
47 -}  
48 \ No newline at end of file 53 \ No newline at end of file
  54 +}
src/app/pages/programas/programa-content.controller.js
@@ -54,22 +54,28 @@ @@ -54,22 +54,28 @@
54 } 54 }
55 55
56 vm.DialogaService.getProposalsByTopicId(vm.article.id, {}, function(data){ 56 vm.DialogaService.getProposalsByTopicId(vm.article.id, {}, function(data){
57 - vm.proposals = data.children;  
58 - vm.proposalsTopRated = [  
59 - {abstract: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tristique consectetur neque, at tincidunt enim volutpat sit amet. Integer sed cursus metus, non luctus risus. Mauris elementum est quis vehicula ullamcorper.'},  
60 - {abstract: 'Mauris elementum est quis vehicula ullamcorper. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tristique consectetur neque, at tincidunt enim volutpat sit amet. Integer sed cursus metus, non luctus risus.'},  
61 - {abstract: 'Integer sed cursus metus, non luctus risus. Mauris elementum est quis vehicula ullamcorper. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tristique consectetur neque, at tincidunt enim volutpat sit amet.'},  
62 - ]; 57 + vm.proposals = data.articles;
  58 + vm.proposalsTopRated = vm.proposals.slice(0, 3);
63 }, function (error) { 59 }, function (error) {
64 vm.$log.error(error); 60 vm.$log.error(error);
65 }); 61 });
66 - 62 +
  63 + // get random proposal
  64 + vm.DialogaService.getProposalsByTopicId(vm.article.id, {
  65 + 'order': 'random()',
  66 + 'limit': '1'
  67 + }, function(data){
  68 + vm.randomProposal = data.articles[0];
  69 + }, function (error) {
  70 + vm.$log.error(error);
  71 + });
  72 +
67 vm.loading = false; 73 vm.loading = false;
68 }, function(error) { 74 }, function(error) {
69 vm.$log.error(error); 75 vm.$log.error(error);
70 vm.error = error; 76 vm.error = error;
71 vm.loading = false; 77 vm.loading = false;
72 - 78 +
73 // vm.$log.info('Rollback to home page.'); 79 // vm.$log.info('Rollback to home page.');
74 // vm.$state.go('inicio', {}, {location: true}); 80 // vm.$state.go('inicio', {}, {location: true});
75 }); 81 });
src/app/pages/programas/programa.html
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <div class="container"> 23 <div class="container">
24 <div class="row"> 24 <div class="row">
25 <article class="program-preview"> 25 <article class="program-preview">
26 - 26 +
27 <div class="col-md-12"> 27 <div class="col-md-12">
28 <h1 class="program-preview--title color-theme-fg">{{::pageProgramaContent.article.title}}</h1> 28 <h1 class="program-preview--title color-theme-fg">{{::pageProgramaContent.article.title}}</h1>
29 </div> 29 </div>
@@ -60,15 +60,22 @@ @@ -60,15 +60,22 @@
60 </div> 60 </div>
61 <div class="col-md-4"> 61 <div class="col-md-4">
62 <div class="row"> 62 <div class="row">
63 - <div class="col-xs-12"> 63 + <div class="col-xs-12" ng-if="pageProgramaContent.proposalsTopRated && pageProgramaContent.proposalsTopRated.lenght > 0">
64 <h3 class="color-theme-fg">Propostas mais votadas</h3> 64 <h3 class="color-theme-fg">Propostas mais votadas</h3>
65 - <div ng-if="pageProgramaContent.proposalsTopRated">  
66 - <proposal-carousel proposals="pageProgramaContent.proposalsTopRated"></proposal-carousel>  
67 - </div> 65 + <proposal-carousel proposals="pageProgramaContent.proposalsTopRated"></proposal-carousel>
68 </div> 66 </div>
69 - <div class="col-xs-12"> 67 + <div class="col-xs-12" ng-if="pageProgramaContent.randomProposal">
70 <h3 class="color-theme-fg">Propostas nesse programa</h3> 68 <h3 class="color-theme-fg">Propostas nesse programa</h3>
71 - <proposal-related article="pageProgramaContent.article"></proposal-related> 69 + <proposal-related proposal="pageProgramaContent.randomProposal" topic="pageProgramaContent.article" category="pageProgramaContent.category"></proposal-related>
  70 + </div>
  71 + <div class="col-xs-12" ng-if="!pageProgramaContent.randomProposal && !(pageProgramaContent.proposalsTopRated && pageProgramaContent.proposalsTopRated.lenght > 0)">
  72 + <h3>Programas sem propostas</h3>
  73 + <p>
  74 + Este programa ainda não possui nenhuma proposta.
  75 + <div class="button--themed">
  76 + <button type="button" class="btn btn-block" ng-click="pageProgramaContent.makeProposal()">Faça uma proposta</button>
  77 + </div>
  78 + </p>
72 </div> 79 </div>
73 </div> 80 </div>
74 </div> 81 </div>
@@ -87,7 +94,7 @@ @@ -87,7 +94,7 @@
87 </div> 94 </div>
88 </div> 95 </div>
89 </section> 96 </section>
90 - 97 +
91 <section class="section-content"> 98 <section class="section-content">
92 <article class="program-content" ng-if="pageProgramaContent.article"> 99 <article class="program-content" ng-if="pageProgramaContent.article">
93 <div ng-bind-html="pageProgramaContent.article.body"></div> 100 <div ng-bind-html="pageProgramaContent.article.body"></div>
src/assets/images/icons/sprite.png

106 KB | W: | H:

107 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin