diff --git a/src/app/components/article-bar/article-bar.directive.js b/src/app/components/article-bar/article-bar.directive.js new file mode 100644 index 0000000..6991284 --- /dev/null +++ b/src/app/components/article-bar/article-bar.directive.js @@ -0,0 +1,68 @@ +(function() { + 'use strict'; + + angular + .module('dialoga') + .directive('articleBar', articleBar); + + /** @ngInject */ + function articleBar() { + var directive = { + restrict: 'E', + templateUrl: 'app/components/article-bar/article-bar.html', + scope: { + category: '=', + categories: '=' + }, + controller: ArticleBarController, + controllerAs: 'vm', + bindToController: true + }; + + return directive; + + /** @ngInject */ + function ArticleBarController($scope, $rootScope, $state, $log) { + $log.debug('ArticleBarController'); + + var vm = this; + + vm.$scope = $scope; + vm.$rootScope = $rootScope; + vm.$state = $state; + vm.theme = 'blue'; + + // if(!vm.category) { + // throw 'article bar without category'; + // } + + // if(!vm.categories) { + // throw 'article bar without categories list'; + // } + + vm.currentCategory = vm.category; + + vm.$scope.$watch('vm.currentCategory', function(newValue, oldValue){ + if(newValue !== oldValue){ + vm.$state.go('inicio', { + tema: newValue.slug + }, { + location: true + }); + } + }); + + vm.goBack = function (){ + var vm = this; + var prevState = vm.$rootScope.$previousState; + if(prevState && prevState.state.name){ + vm.$state.go(prevState.state.name, prevState.params); + } else { + vm.$state.go('inicio'); + } + }; + } + + } + +})(); diff --git a/src/app/components/article-bar/article-bar.html b/src/app/components/article-bar/article-bar.html new file mode 100644 index 0000000..e62b637 --- /dev/null +++ b/src/app/components/article-bar/article-bar.html @@ -0,0 +1,23 @@ +
+ +
+ diff --git a/src/app/components/article-bar/article-bar.scss b/src/app/components/article-bar/article-bar.scss new file mode 100644 index 0000000..2809ae9 --- /dev/null +++ b/src/app/components/article-bar/article-bar.scss @@ -0,0 +1,52 @@ +.article-bar { + position: relative; + background-color: #0042b1; + + .btn { + color: #fff; + font-weight: bold; + } + + &--item { + margin: 8px 0; + + @media (max-width: $screen-xs) { + margin: 8px; + } + + } + + &--category-button { + position: relative; + width: 125px; + text-align: right; + margin-left: 10px; + font-size: 24px; + line-height: 20px; + font-family: 'Open Sans'; + + .icon { + display: inline-block; + margin: -40px -35px -40px -50px; + transform: scale(.37); + } + } + + .navbar { + margin-bottom: 0; + } + + .navbar-right { + margin-right: 15px; + } + + @each $category, $color in $categories { + &.#{$category} { + background-color: $color; + } + } + + .contraste & { + background-color: #262626; + } +} diff --git a/src/app/components/article-box/article-box.directive.js b/src/app/components/article-box/article-box.directive.js new file mode 100644 index 0000000..39ef25c --- /dev/null +++ b/src/app/components/article-box/article-box.directive.js @@ -0,0 +1,84 @@ +(function() { + 'use strict'; + + angular + .module('dialoga') + .directive('articleBox', articleBox); + + /** @ngInject */ + function articleBox($rootScope) { + + /** @ngInject */ + function ArticleBoxController(ArticleService, $scope, $state, Slug, $log) { + $log.debug('ArticleBoxController'); + + var vm = this; + vm.ArticleService = ArticleService; + vm.$scope = $scope; + vm.$state = $state; + vm.Slug = Slug; + vm.$log = $log; + + vm.init(); + } + + ArticleBoxController.prototype.init = function () { + var vm = this; + + if(!vm.article.slug){ + vm.article.slug = vm.Slug.slugify(vm.article.title); + } + + if(!vm.category){ + vm.category = vm.article.categories[0]; + } + + if(!vm.banner){ + vm.banner = { + src: $rootScope.basePath + vm.article.image.url, + alt: 'Imagem de destaque do conteúdo' + }; + } + + // if(vm.article.color && !vm.article.bgColor){ + // // 15% more darker + // vm.article.colorDarker = window.ColorLuminance(vm.article.color, 0.15); + // } + }; + + ArticleBoxController.prototype.showContent = function () { + var vm = this; + + vm.$state.go('programa-conheca', { + slug: vm.article.slug + }, { + location: true + }); + }; + + ArticleBoxController.prototype.showPreview = function () { + var vm = this; + + vm.$state.go('programa', { + slug: vm.article.slug + }, { + location: true + }); + }; + + var directive = { + restrict: 'E', + templateUrl: 'app/components/article-box/article-box.html', + scope: { + article: '=' + }, + controller: ArticleBoxController, + controllerAs: 'vm', + bindToController: true + }; + + + return directive; + } + +})(); diff --git a/src/app/components/article-box/article-box.html b/src/app/components/article-box/article-box.html new file mode 100644 index 0000000..ef13453 --- /dev/null +++ b/src/app/components/article-box/article-box.html @@ -0,0 +1,18 @@ +
+
+

{{vm.category.name}}

+
+ +
+
+
+

{{::vm.article.title}}

+
+
+
+ +
+
+
diff --git a/src/app/components/article-box/article-box.scss b/src/app/components/article-box/article-box.scss new file mode 100644 index 0000000..4f93d93 --- /dev/null +++ b/src/app/components/article-box/article-box.scss @@ -0,0 +1,146 @@ +$article-box-space: 20px; + +.article-box { + cursor: pointer; + background-color: #fff; + margin-top: $article-box-space; + margin-bottom: $article-box-space; + border-radius: 3px; + overflow: hidden; + + .contraste & { + color: #fff; + background-color: #262626; + } + + &--category { + font-size: 14px; + font-weight: bold; + text-transform: uppercase; + line-height: 22px; + display: block; + height: 30px; + margin: 0; + padding: 5px $article-box-space; + color: #ffffff; + + @each $category, $color in $categories { + .#{$category} & { + background-color: $color; + } + } + + .contraste & { + background-color: #262626; + } + } + + &--title { + + padding: 0 $article-box-space; + + h1 { + font-size: 18px; + font-weight: bold; + margin: 0 0 $article-box-space 0; + display: table-cell; + vertical-align: middle; + + // Altura das linhas do abstract + $hLine: 20px; + // default + height: $hLine * 2; + + @media (max-width: $screen-xs) { + // height: $hLine * 3; + height: auto; + } + + @media (min-width: $screen-xs + 1) { + // height: $hLine * 2; + height: auto; + } + + @media (min-width: $screen-sm + 1) { + height: $hLine * 2; + } + + @media (min-width: $screen-md + 1) { + height: $hLine * 2; + } + } + } + + &--abstract { + padding: 0 $article-box-space; + display: table-cell; + vertical-align: middle; + + // Altura das linhas do abstract + $pLine: 20px; + // 1 linha: 19px -> 20 + // 2 linhas: 38px -> 40 + // 3 linhas: 57px -> 60 + // 4 linhas: 76px -> 80 + + height: $pLine * 2; // default + + @media (max-width: $screen-xs) { + // height: $pLine * 4; + height: auto; + } + + @media (min-width: $screen-xs + 1) { + // height: $pLine * 3; + height: auto; + } + + @media (min-width: $screen-sm + 1) { + height: $pLine * 4; + } + + @media (min-width: $screen-md + 1) { + height: $pLine * 3; + } + + p { margin: 0; } + } + + &--image-wrapper { + position: relative; + // width: 100%; + // width: 370px; + // height: 170px; + + overflow: hidden; + // text-align: center; + min-height: 170px; + } + + &--image { + min-height: 170px; + background-position: center; + background-size: cover; + background-repeat: no-repeat; + + -webkit-transition: all $time ease-in-out; + -moz-transition: all $time ease-in-out; + -o-transition: all $time ease-in-out; + transition: all $time ease-in-out; + } + + &:hover { + background-color: #d9d9d9; + + .article-box--image { + -webkit-transform: scale($scale); /* prefixo para browsers webkit */ + -moz-transform: scale($scale); /* prefixo para browsers gecko */ + -o-transform: scale($scale); /* prefixo para opera */ + transform: scale($scale); + } + + .contraste & { + background-color: #262626; + } + } +} diff --git a/src/app/components/article-content/article-content.directive.js b/src/app/components/article-content/article-content.directive.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/app/components/article-content/article-content.directive.js diff --git a/src/app/components/article-content/article-content.scss b/src/app/components/article-content/article-content.scss new file mode 100644 index 0000000..6568688 --- /dev/null +++ b/src/app/components/article-content/article-content.scss @@ -0,0 +1,15 @@ +.article-content { + h2 { + font-size: 38px; + font-weight: 500; + margin-bottom: 40px; + padding-bottom: 20px; + + small { + display: block; + font-size: 16px; + padding-top: 5px; + text-transform: none; + } + } +} diff --git a/src/app/components/article-grid/article-grid.directive.js b/src/app/components/article-grid/article-grid.directive.js new file mode 100644 index 0000000..985a15b --- /dev/null +++ b/src/app/components/article-grid/article-grid.directive.js @@ -0,0 +1,322 @@ +(function() { + 'use strict'; + + angular + .module('dialoga') + .directive('articleGrid', articleGrid); + + /** @ngInject */ + function articleGrid() { + + /** @ngInject */ + function ArticleGridController($scope, $rootScope, $element, ArticleService, $location, $filter, $log) { + $log.debug('ArticleGridController'); + + // alias + var vm = this; + + // dependencies + vm.$scope = $scope; + vm.$rootScope = $rootScope; + vm.$element = $element; + vm.ArticleService = ArticleService; + vm.$location = $location; + vm.$filter = $filter; + vm.$log = $log; + vm.defaultLimit = 6; + + // initialization + vm.init(); + } + + ArticleGridController.prototype.init = function() { + var vm = this; + + vm.ArticleService.getPrograms(function(programs){ + vm.articles = programs; + }); + + vm.ArticleService.getCategories(function(categories){ + vm.categories = categories; + }); + + vm.orderCriteries = [ + { label: 'Título', name: 'titulo' }, + { label: 'Tema', name: 'tema' }, + { label: 'Aleatório', name: 'aleatorio' } + ]; + + vm.filtredArticleList = vm.getFiltredArticles(); + vm.search = vm.$location.search(); + + // Add initial values for the filter + vm.query = (vm.search && vm.search.filtro) ? vm.search.filtro : null; + vm.limitTo = (vm.search && vm.search.limite) ? parseInt(vm.search.limite, 10) : vm.defaultLimit; + vm.orderCriteria = (vm.search && vm.search.ordem) ? { name: vm.search.ordem } : null; + vm.reverse = (vm.search && vm.search.reverso) ? true : false; + + // vm.selectedCategory = (vm.search && vm.search.tema) ? vm.getCategoryBySlug(vm.search.tema) : null; + if (vm.search && vm.search.tema) { + var slug = vm.search.tema; + vm.ArticleService.getCategoryBySlug(slug, function(category){ + vm.selectedCategory = category; + }, function(error){ + vm.$log.error('Error when try to "getCategoryBySlug"', error); + }); + } + + if (!angular.equals({}, vm.search)) { + var $el = vm.$element; + angular.element('body').animate({scrollTop: $el.offset().top}, 'slow'); + } + + // update window location params + vm.$scope.$on('change-selectedCategory', function(event, selectedCategory){ + vm.selectedCategory = selectedCategory; + }); + + vm.$scope.$watch('vm.query', function(newValue/*, oldValue*/) { + vm.search.filtro = newValue ? newValue : null; + vm.$location.search('filtro', vm.search.filtro); + if(vm.search.filtro){ + vm.limitTo = vm.articles.length; + }else{ + vm.limitTo = vm.defaultLimit; + } + vm.filtredArticleList = vm.getFiltredArticles(); + }); + + vm.$scope.$watch('vm.limitTo', function(newValue/*, oldValue*/) { + vm.search.limite = (newValue && newValue !== vm.defaultLimit) ? newValue : null; + vm.$location.search('limite', vm.search.limite); + vm.filtredArticleList = vm.getFiltredArticles(); + }); + + vm.$scope.$watch('vm.selectedCategory', function(newValue/*, oldValue*/) { + vm.search.tema = newValue ? newValue.slug : null; + vm.$location.search('tema', vm.search.tema); + if(vm.search.tema){ + vm.limitTo = vm.articles.length; + }else{ + vm.limitTo = vm.defaultLimit; + } + vm.filtredArticleList = vm.getFiltredArticles(); + }); + + vm.$scope.$watch('vm.orderCriteria', function(newValue/*, oldValue*/) { + vm.search.ordem = (newValue && newValue.name) ? newValue.name : null; + vm.$location.search('ordem', vm.search.ordem); + vm.filtredArticleList = vm.getFiltredArticles(); + }); + + vm.$scope.$watch('vm.reverse', function(newValue/*, oldValue*/) { + vm.search.reverso = newValue ? newValue : null; + vm.$location.search('reverso', vm.search.reverso); + vm.filtredArticleList = vm.getFiltredArticles(); + }); + + }; + + ArticleGridController.prototype.resetFilterValues = function() { + var vm = this; + + vm.query = null; + vm.limitTo = vm.defaultLimit; + vm.selectedCategory = null; + vm.orderCriteria = null; + }; + + ArticleGridController.prototype.getIconClasses = function(category) { + var vm = this; + + vm.$log.debug('[TODO] getIconClasses of category:', category); + return 'glyphicon glyphicon-exclamation-sign'; + }; + + ArticleGridController.prototype.getCategoryBySlug = function(categorySlug) { + var vm = this; + var result = null; + + angular.forEach(vm.categories, function(value/*, key*/) { + if (value.slug === categorySlug) { + result = value; + } + }); + + return result; + }; + + ArticleGridController.prototype.showAll = function($event) { + var vm = this; + + $event.stopPropagation(); + + vm.resetFilterValues(); + vm.limitTo = vm.articles.length; + }; + + ArticleGridController.prototype.getFiltredArticles = function() { + var vm = this; + + if(!vm.articles){ + vm.$log.warn('No articles loaded yet. Abort.'); + return null; + } + + var input = vm.articles; + var output = input; + var query = vm.query; + var selectedCategory = vm.selectedCategory; + var orderCriteria = vm.orderCriteria ? vm.orderCriteria : { name : 'aleatorio'}; + var filter = vm.$filter('filter'); + var orderBy = vm.$filter('orderBy'); + var limitTo = vm.$filter('limitTo'); + var limit = vm.limitTo ? vm.limitTo : 4; + + if (selectedCategory) { + output = _filterByCategory(output, selectedCategory); + } + + if (query) { + output = filter(output, query, false); + } + + switch (orderCriteria.name) { + case 'titulo': + output = orderBy(output, 'title', vm.reverse); + break; + case 'tema': + output = orderBy(output, 'categories[0].name', vm.reverse); + break; + case 'more_participants': + vm.$log.info('Criteria not handled yet: ', orderCriteria); + break; + case 'aleatorio': + // shuffling + // if (!vm._isShuffled){ + output = vm.filterShuffle(output); + // vm._isShuffled = true; + // } + + if (vm.reverse) { + output = output.slice().reverse(); + } + + break; + default: + vm.$log.warn('Criteria not matched: ', orderCriteria); + break; + } + + output = limitTo(output, limit); + + return output; + }; + + ArticleGridController.prototype.filterShuffle = function(input) { + var result = []; + var resultByCategory = {}; + + // divide by categories + for (var i = 0; i < input.length; i++) { + var program = input[i]; + var categorySlug = program.categories[0].slug; + + if (!resultByCategory[categorySlug]) { + resultByCategory[categorySlug] = []; + } + + resultByCategory[categorySlug].push(program); + } + + // shuffle each array + var prop = null; + var categoryWithPrograms = null; + for (prop in resultByCategory) { + if (resultByCategory.hasOwnProperty(prop)) { + categoryWithPrograms = resultByCategory[prop]; + resultByCategory[prop] = shuffle(categoryWithPrograms); + } + } + + // Concat all into result array + // > while has program at Lists on resultByCategory + var hasProgram = true; + while (hasProgram) { + + var foundProgram = false; + // each categoryList with array of program + prop = null; + categoryWithPrograms = null; + for (prop in resultByCategory) { + + if (resultByCategory.hasOwnProperty(prop)) { + categoryWithPrograms = resultByCategory[prop]; + + if (categoryWithPrograms.length > 0) { + var pivotProgram = categoryWithPrograms.pop(); + result.push(pivotProgram); + foundProgram = true; + } + } + } + + if (!foundProgram) { + hasProgram = false; + } + } + + return result; + }; + + var directive = { + restrict: 'E', + templateUrl: 'app/components/article-grid/article-grid.html', + controller: ArticleGridController, + controllerAs: 'vm', + bindToController: true + }; + + return directive; + } + + function _filterByCategory (input, category) { + input = input || []; + + if (!category) { + // no filter + return input; + } + + var out = []; + for (var i = 0; i < input.length; i++) { + var program = input[i]; + if (program.categories[0].slug === category.slug) { + out.push(program); + } + } + + return out; + } + + // -> Fisher–Yates shuffle algorithm + function shuffle (array) { + var currentIndex = array.length, temporaryValue, randomIndex ; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; + } + +})(); diff --git a/src/app/components/article-grid/article-grid.html b/src/app/components/article-grid/article-grid.html new file mode 100644 index 0000000..e12c382 --- /dev/null +++ b/src/app/components/article-grid/article-grid.html @@ -0,0 +1,50 @@ +
+
+

Conheça os programas ({{vm.filtredArticleList.length}}/{{vm.articles.length}})

+ +
+
+
+ +
+ +
+ +
+
+
+ Nenhum programa encontrado. +
+
+
diff --git a/src/app/components/article-grid/article-grid.scss b/src/app/components/article-grid/article-grid.scss new file mode 100644 index 0000000..4c1d981 --- /dev/null +++ b/src/app/components/article-grid/article-grid.scss @@ -0,0 +1,20 @@ +.article-grid { + .header { + position: relative; + height: 40px; + margin-bottom: 10px; + + button { + position: absolute; + right: 0; + top: 2px; + } + } + + .form-inline { + input, + select { + width: 100%; + } + } +} diff --git a/src/app/components/article-preview/article-preview.directive.js b/src/app/components/article-preview/article-preview.directive.js new file mode 100644 index 0000000..9b19adf --- /dev/null +++ b/src/app/components/article-preview/article-preview.directive.js @@ -0,0 +1,74 @@ +(function() { + 'use strict'; + + angular + .module('dialoga') + .directive('articlePreview', articlePreview); + + /** @ngInject */ + function articlePreview($rootScope) { + + /** @ngInject */ + function ArticlePreviewController(ArticleService, $scope, $state, Slug, $log) { + $log.debug('ArticlePreviewController'); + + var vm = this; + vm.ArticleService = ArticleService; + vm.$scope = $scope; + vm.$state = $state; + vm.Slug = Slug; + vm.$log = $log; + + vm.init(); + } + + ArticlePreviewController.prototype.init = function () { + var vm = this; + + if(!vm.article.slug){ + vm.article.slug = vm.Slug.slugify(vm.article.title); + } + + if(!vm.category){ + vm.category = vm.article.categories[0]; + } + + if(!vm.banner){ + vm.banner = { + src: $rootScope.basePath + vm.article.image.url, + alt: 'Imagem de destaque do programa' + }; + } + + // if(vm.article.color && !vm.article.bgColor){ + // // 15% more darker + // vm.article.colorDarker = window.ColorLuminance(vm.article.color, 0.15); + // } + }; + + ArticlePreviewController.prototype.showContent = function () { + var vm = this; + + vm.$state.go('conheca-o-programa', { + slug: vm.article.slug + }, { + location: true + }); + }; + + var directive = { + restrict: 'E', + templateUrl: 'app/components/article-preview/article-preview.html', + scope: { + article: '=' + }, + controller: ArticlePreviewController, + controllerAs: 'vm', + bindToController: true + }; + + + return directive; + } + +})(); diff --git a/src/app/components/article-preview/article-preview.html b/src/app/components/article-preview/article-preview.html new file mode 100644 index 0000000..2b51baf --- /dev/null +++ b/src/app/components/article-preview/article-preview.html @@ -0,0 +1,101 @@ +
+
+ {{vm.banner.alt}} +
+

{{::vm.article.title}}

+

+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+

Faça uma proposta

+

Qual a sua sugestão para melhorar este programa?

+
+
+
+ +
+
+
+
+
+
+
+
+
+

Apoie outras propostas

+

+ Lorem qual a sua sugestão para melhorar este programa + Lorem qual a sua sugestão para melhorar este programa + Lorem qual a sua sugestão para melhorar este programa + Lorem qual a sua sugestão para melhorar este programa + Lorem qual a sua sugestão para melhorar este programa + Lorem qual a sua sugestão para melhorar este programa? +

+
+
+
+ + + + + +
+
+
+
+
+
+ +
+
+
+
+
+
+ Compartilhe esta proposta + +
+
+
+
+
+
+
+
+
+
+
+
+
+

Bate-papo virtual com ministr@s

+
+
+
+
+
+
diff --git a/src/app/components/article-preview/article-preview.scss b/src/app/components/article-preview/article-preview.scss new file mode 100644 index 0000000..530b3b0 --- /dev/null +++ b/src/app/components/article-preview/article-preview.scss @@ -0,0 +1,91 @@ +.article-preview { + .article-banner { + position: relative; + } + + .article-banner--image { + width: 100%; + } + + .article-banner--strip { + color: #fff; + position: absolute; + bottom: 15%; + right: 0; + width: 50%; + text-align: center; + + @each $category, $color in $categories { + .#{$category} & { + background-color: $color; + } + } + + @media (max-width: $screen-sm){ + position: relative; + width: 100%; + } + } + + .article-banner--title { + font-size: 32px; + text-transform: uppercase; + margin-top: 0; + padding-top: 20px; + } + .article-banner--title, + .article-banner--abstract { + font-weight: bold; + } + .article-banner--abstract { + padding-bottom: 10px; + } + + .show-content-row { + .button--themed { + .btn { + font-size: 38px; + + @media (max-width: $screen-sm){ + font-size: 20px; + } + } + } + } + + .talk-proposal { + margin-top: -20px; + } + + .proposal-box { + + // padding: 10px 20px; + + .proposal-box--title { + font-size: 38px; + font-weight: 400; + text-align: center; + + margin-bottom: 20px; + } + + .proposal-box--text { + font-size: 24px; + font-weight: 700; + line-height: 1.2; + margin-bottom: 20px; + } + + @each $category, $color in $categories { + .#{$category} & { + border-color: $color; + + .proposal-box--title { + color: $color; + } + } + } + } + + +} diff --git a/src/app/components/articleBar/articleBar.directive.js b/src/app/components/articleBar/articleBar.directive.js deleted file mode 100644 index 1cccf94..0000000 --- a/src/app/components/articleBar/articleBar.directive.js +++ /dev/null @@ -1,68 +0,0 @@ -(function() { - 'use strict'; - - angular - .module('dialoga') - .directive('articleBar', articleBar); - - /** @ngInject */ - function articleBar() { - var directive = { - restrict: 'E', - templateUrl: 'app/components/articleBar/articleBar.html', - scope: { - category: '=', - categories: '=' - }, - controller: ArticleBarController, - controllerAs: 'vm', - bindToController: true - }; - - return directive; - - /** @ngInject */ - function ArticleBarController($scope, $rootScope, $state, $log) { - $log.debug('ArticleBarController'); - - var vm = this; - - vm.$scope = $scope; - vm.$rootScope = $rootScope; - vm.$state = $state; - vm.theme = 'blue'; - - // if(!vm.category) { - // throw 'article bar without category'; - // } - - // if(!vm.categories) { - // throw 'article bar without categories list'; - // } - - vm.currentCategory = vm.category; - - vm.$scope.$watch('vm.currentCategory', function(newValue, oldValue){ - if(newValue !== oldValue){ - vm.$state.go('inicio', { - tema: newValue.slug - }, { - location: true - }); - } - }); - - vm.goBack = function (){ - var vm = this; - var prevState = vm.$rootScope.$previousState; - if(prevState && prevState.state.name){ - vm.$state.go(prevState.state.name, prevState.params); - } else { - vm.$state.go('inicio'); - } - }; - } - - } - -})(); diff --git a/src/app/components/articleBar/articleBar.html b/src/app/components/articleBar/articleBar.html deleted file mode 100644 index e62b637..0000000 --- a/src/app/components/articleBar/articleBar.html +++ /dev/null @@ -1,23 +0,0 @@ -
- -
- diff --git a/src/app/components/articleBar/articleBar.scss b/src/app/components/articleBar/articleBar.scss deleted file mode 100644 index 99ddc70..0000000 --- a/src/app/components/articleBar/articleBar.scss +++ /dev/null @@ -1,53 +0,0 @@ -.article-bar { - position: relative; - background-color: #0042b1; - - .btn { - color: #fff; - font-weight: bold; - } - - &--item { - margin: 8px 0; - - @media (max-width: $screen-xs) { - margin: 8px; - } - - } - - &--category-button { - position: relative; - width: 125px; - text-align: right; - margin-left: 10px; - font-size: 24px; - line-height: 20px; - font-family: 'Open Sans'; - - .icon { - position: absolute; - top: -34px; - left: -34px; - transform: scale(.37); - } - } - - .navbar { - margin-bottom: 0; - } - - .navbar-right { - margin-right: 15px; - } - - @each $category, $color in $categories { - &.#{$category} { - background-color: $color; - } - } - - .contraste & { - background-color: #262626; - } -} diff --git a/src/app/components/auth/auth.service.js b/src/app/components/auth/auth.service.js index 65e0cf8..44eda26 100644 --- a/src/app/components/auth/auth.service.js +++ b/src/app/components/auth/auth.service.js @@ -8,7 +8,7 @@ .factory('AuthInterceptor', AuthInterceptor); /** @ngInject */ - function AuthService($http, $rootScope, Session, AUTH_EVENTS, api, $log) { + function AuthService($http, $rootScope, Session, AUTH_EVENTS, API, $log) { var service = { login: login, @@ -21,7 +21,7 @@ return service; function login (credentials) { - var url = api.host + '/api/v1/login'; + var url = API.host + '/api/v1/login'; var encodedData = 'login=' + credentials.username + '&password=' + credentials.password; return $http diff --git a/src/app/components/category-list/category-list.directive.js b/src/app/components/category-list/category-list.directive.js new file mode 100644 index 0000000..38ffd42 --- /dev/null +++ b/src/app/components/category-list/category-list.directive.js @@ -0,0 +1,77 @@ +(function() { + 'use strict'; + + angular + .module('dialoga') + .directive('categoryList', categoryList); + + /** @ngInject */ + function categoryList() { + + /** @ngInject */ + function CategoryListController($rootScope, ArticleService, $location, $log) { + $log.debug('CategoryListController'); + + // alias + var vm = this; + + // dependencies + vm.$rootScope = $rootScope; + vm.ArticleService = ArticleService; + vm.$location = $location; + vm.$log = $log; + vm.defaultLimit = 6; + + // initialization + vm.init(); + } + + CategoryListController.prototype.init = function() { + var vm = this; + + vm.selectedCategory = null; + vm.ArticleService.getCategories(function(categories){ + vm.categories = categories; + + }); + + vm.search = vm.$location.search(); + if (vm.search && vm.search.tema) { + var slug = vm.search.tema; + vm.ArticleService.getCategoryBySlug(slug, function(category){ + vm.selectedCategory = category; + }, function(error){ + vm.$log.error('Error when try to "getCategoryBySlug"', error); + }); + } + }; + + CategoryListController.prototype.selectCategory = function(category, $event) { + var vm = this; + + // prevent glitch + $event.stopPropagation(); + + if (category !== vm.selectedCategory) { + // selected new filter + vm.selectedCategory = category; + } else { + vm.selectedCategory = null; + } + + // send event to all controllers + vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory); + }; + + var directive = { + restrict: 'E', + templateUrl: 'app/components/category-list/category-list.html', + controller: CategoryListController, + controllerAs: 'categoryListCtrl', + bindToController: true + }; + + return directive; + } + +})(); diff --git a/src/app/components/category-list/category-list.html b/src/app/components/category-list/category-list.html new file mode 100644 index 0000000..3952e69 --- /dev/null +++ b/src/app/components/category-list/category-list.html @@ -0,0 +1,17 @@ +
+ +
diff --git a/src/app/components/category-list/category-list.scss b/src/app/components/category-list/category-list.scss new file mode 100644 index 0000000..dcb03a0 --- /dev/null +++ b/src/app/components/category-list/category-list.scss @@ -0,0 +1,111 @@ +.category-list { + .category-list--title { + color: #ffffff; + font-size: 16px; + margin: 0; + padding: 20px; + background-color: #484848; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + overflow: hidden; + } + + + .category-list--group { + } + + .category-list--item { + position: relative; + text-transform: uppercase; + font-weight: bold; + padding: 0; + height: 68px; + overflow: hidden; + } + + .category-list--label { + margin-left: 70px; + margin-right: 30px; + display: inline-block; + z-index: 99999; + } + + &--icon-circle { + width: 48px; + height: 48px; + position: absolute; + top: 10px; + left: 10px; + // border: 1px solid #fff; + border-radius: 48px; + + -webkit-transition: -webkit-transform 0.2s ease-in-out; + -moz-transition: -moz-transform 0.2s ease-in-out; + -o-transition: -o-transform 0.2s ease-in-out; + transition: transform 0.2s ease-in-out; + + // -webkit-transition: all 0.2s ease-in-out; + // -moz-transition: all 0.2s ease-in-out; + // -o-transition: all 0.2s ease-in-out; + // transition: all 0.2s ease-in-out; + + z-index: 0; + + .active & { + z-index: -1; + + @media (max-width: $screen-xs) { + transform: scale(20); + } + + @media (min-width: $screen-xs + 1) { + transform: scale(40); + } + + @media (min-width: $screen-sm + 1) { + transform: scale(20); + } + + // @media (min-width: $screen-md + 1) { + // transform: scale(20); + // } + } + + @each $category, $color in $categories { + &.#{$category} { + background-color: $color; + } + } + } + + .category-list--icon { + position: absolute; + top: -16px; + left: -14px; + transform: scale(0.35); + } + + .category-list--icon--right { + position: absolute; + right: 9px; + top: 50%; + margin-top: -9px; + transform: scale(1.4); + } + + .list-group-item.active, + .list-group-item.active:hover, + .list-group-item.active:focus { + background-color: #f5f5f5; + } + + // @each $category, $color in $categories { + // &.#{$category} { + // .list-group-item.active, + // .list-group-item.active:hover, + // .list-group-item.active:focus { + // background-color: $color; + // } + // } + // } +} diff --git a/src/app/components/programa/programa.directive.js b/src/app/components/programa/programa.directive.js deleted file mode 100644 index 3dea1c9..0000000 --- a/src/app/components/programa/programa.directive.js +++ /dev/null @@ -1,99 +0,0 @@ -(function() { - 'use strict'; - - angular - .module('dialoga') - .directive('programaBox', programaBox); - - /** @ngInject */ - function programaBox($rootScope) { - - /** @ngInject */ - function ProgramaController(ArticleService, $scope, $state, Slug, $log) { - $log.debug('ProgramaController'); - - var vm = this; - vm.ArticleService = ArticleService; - vm.$scope = $scope; - vm.$state = $state; - vm.Slug = Slug; - vm.$log = $log; - - vm.init(); - } - - ProgramaController.prototype.init = function () { - var vm = this; - - if(!vm.program.slug){ - vm.program.slug = vm.Slug.slugify(vm.program.title); - } - - if(!vm.category){ - vm.category = vm.program.categories[0]; - } - - if(!vm.banner){ - vm.banner = { - src: $rootScope.basePath + vm.program.image.url, - alt: 'Imagem de destaque do programa' - }; - } - - vm.displayType = vm.display; - - // if(vm.program.color && !vm.program.bgColor){ - // // 15% more darker - // vm.program.colorDarker = window.ColorLuminance(vm.program.color, 0.15); - // } - }; - - ProgramaController.prototype.isDisplay = function (display) { - return this.display === display; - }; - - ProgramaController.prototype.isDisplayBox = function () { - return this.isDisplay('box'); - }; - - ProgramaController.prototype.isDisplayPreview = function () { - return this.isDisplay('preview'); - }; - - ProgramaController.prototype.showContent = function () { - var vm = this; - - vm.$state.go('programa-conheca', { - slug: vm.program.slug - }, { - location: true - }); - }; - - ProgramaController.prototype.showPreview = function () { - var vm = this; - - vm.$state.go('programa', { - slug: vm.program.slug - }, { - location: true - }); - }; - - var directive = { - restrict: 'E', - templateUrl: 'app/components/programa/programa.html', - scope: { - program: '=', - display: '=' - }, - controller: ProgramaController, - controllerAs: 'vm', - bindToController: true - }; - - - return directive; - } - -})(); diff --git a/src/app/components/programa/programa.html b/src/app/components/programa/programa.html deleted file mode 100644 index 24cb060..0000000 --- a/src/app/components/programa/programa.html +++ /dev/null @@ -1,122 +0,0 @@ -
-
-
-

{{vm.category.name}}

-
- -
-
-
-

{{::vm.program.title}}

-
-
-
- -
-
-
- -
-
- {{vm.banner.alt}} -
-

{{::vm.program.title}}

-

-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
-

Faça uma proposta

-

Qual a sua sugestão para melhorar este programa?

-
-
-
- -
-
-
-
-
-
-
-
-
-

Apoie outras propostas

-

- Lorem qual a sua sugestão para melhorar este programa - Lorem qual a sua sugestão para melhorar este programa - Lorem qual a sua sugestão para melhorar este programa - Lorem qual a sua sugestão para melhorar este programa - Lorem qual a sua sugestão para melhorar este programa - Lorem qual a sua sugestão para melhorar este programa? -

-
-
-
- - - - - -
-
-
-
-
-
- -
-
-
-
-
-
- Compartilhe esta proposta - -
-
-
-
-
-
-
-
-
-
-
-
-
-

Bate-papo virtual com ministr@s

-
-
-
-
-
-
-
diff --git a/src/app/components/programa/programa.scss b/src/app/components/programa/programa.scss deleted file mode 100644 index 17ef90e..0000000 --- a/src/app/components/programa/programa.scss +++ /dev/null @@ -1,409 +0,0 @@ -// Variables -$program-box-space: 20px; -$scale: 1.1; -$time: .2s; -$darken: 15%; - -// Commons -.button--themed { - padding: $program-box-space; - .btn { - color: #fff; - font-weight: bold; - padding: 15px 0; - border-left: 0; - border-right: 0; - border-top: 0; - border-radius: 6px; - - -webkit-transition: all $time ease-in-out; - -moz-transition: all $time ease-in-out; - -o-transition: all $time ease-in-out; - transition: all $time ease-in-out; - - @each $category, $color in $categories { - .#{$category} & { - background-color: $color; - border-bottom: 3px solid darken($color, $darken); - } - } - - &:hover, - &:focus { - @each $category, $color in $categories { - .#{$category} & { - background-color: darken($color, $darken); - } - } - } - - .contraste & { - color: #262626; - background-color: #fff; - } - } - - .btn-circle { - width: 64px; - height: 64px; - border-radius: 100%; - } - - // &.vote-buttons { - // padding-bottom: 40px; - // } - - .btn.vote-buttons-up { - float: right; - margin-right: 10px; - background-color: #32dbb5; - border-bottom: 3px solid #1da485; - - &:hover, - &:focus { - background-color: #1da485; - } - } - - .btn.vote-buttons-down { - float: left; - margin-left: 10px; - background-color: #db4127; - border-bottom: 3px solid #9c2d1a; - - &:hover, - &:focus { - background-color: #9c2d1a; - } - - - // @media (max-width: $screen-sm) { - // margin-left: - // } - } - - .vote-buttons-up, - .vote-buttons-down { - font-size: 30px; - margin-bottom: 20px; - } -} - - -.program-box { - cursor: pointer; - background-color: #fff; - margin-top: $program-box-space; - margin-bottom: $program-box-space; - border-radius: 3px; - overflow: hidden; - - .contraste & { - color: #fff; - background-color: #262626; - } - - &--category { - font-size: 14px; - font-weight: bold; - text-transform: uppercase; - line-height: 22px; - display: block; - height: 30px; - margin: 0; - padding: 5px $program-box-space; - color: #ffffff; - - @each $category, $color in $categories { - .#{$category} & { - background-color: $color; - } - } - - .contraste & { - background-color: #262626; - } - } - - &--title { - - padding: 0 $program-box-space; - - h1 { - font-size: 18px; - font-weight: bold; - margin: 0 0 $program-box-space 0; - display: table-cell; - vertical-align: middle; - - // Altura das linhas do abstract - $hLine: 20px; - // default - height: $hLine * 2; - - @media (max-width: $screen-xs) { - // height: $hLine * 3; - height: auto; - } - - @media (min-width: $screen-xs + 1) { - // height: $hLine * 2; - height: auto; - } - - @media (min-width: $screen-sm + 1) { - height: $hLine * 2; - } - - @media (min-width: $screen-md + 1) { - height: $hLine * 2; - } - } - } - - &--abstract { - padding: 0 $program-box-space; - display: table-cell; - vertical-align: middle; - - // Altura das linhas do abstract - $pLine: 20px; - // 1 linha: 19px -> 20 - // 2 linhas: 38px -> 40 - // 3 linhas: 57px -> 60 - // 4 linhas: 76px -> 80 - - height: $pLine * 2; // default - - @media (max-width: $screen-xs) { - // height: $pLine * 4; - height: auto; - } - - @media (min-width: $screen-xs + 1) { - // height: $pLine * 3; - height: auto; - } - - @media (min-width: $screen-sm + 1) { - height: $pLine * 4; - } - - @media (min-width: $screen-md + 1) { - height: $pLine * 3; - } - - p { margin: 0; } - } - - &--image-wrapper { - position: relative; - // width: 100%; - // width: 370px; - // height: 170px; - - overflow: hidden; - // text-align: center; - min-height: 170px; - } - - &--image { - min-height: 170px; - background-position: center; - background-size: cover; - background-repeat: no-repeat; - - -webkit-transition: all $time ease-in-out; - -moz-transition: all $time ease-in-out; - -o-transition: all $time ease-in-out; - transition: all $time ease-in-out; - } - - &:hover { - background-color: #d9d9d9; - - .program-box--image { - -webkit-transform: scale($scale); /* prefixo para browsers webkit */ - -moz-transform: scale($scale); /* prefixo para browsers gecko */ - -o-transform: scale($scale); /* prefixo para opera */ - transform: scale($scale); - } - - .contraste & { - background-color: #262626; - } - } -} - -.program-preview { - .program-banner { - position: relative; - } - - .program-banner--image { - width: 100%; - } - - .program-banner--strip { - color: #fff; - position: absolute; - bottom: 15%; - right: 0; - width: 50%; - text-align: center; - - @each $category, $color in $categories { - .#{$category} & { - background-color: $color; - } - } - - @media (max-width: $screen-sm){ - position: relative; - width: 100%; - } - } - - .program-banner--title { - font-size: 32px; - text-transform: uppercase; - margin-top: 0; - padding-top: 20px; - } - .program-banner--title, - .program-banner--abstract { - font-weight: bold; - } - .program-banner--abstract { - padding-bottom: 10px; - } -} - -.show-content-row { - .button--themed { - .btn { - font-size: 38px; - - @media (max-width: $screen-sm){ - font-size: 20px; - } - } - } -} - -.row-height { - display: table; - table-layout: fixed; - height: 100%; - width: 100%; - border-spacing: 20px; - - @media (max-width: $screen-sm) { - display: block; - } - - // @media (min-width: $screen-sm + 1) { - // height: $hLine * 2; - // } - - // @media (min-width: $screen-md + 1) { - // height: $hLine * 2; - // } -} - -.col-height { - display: table-cell; - float: none; - height: 100%; - vertical-align: top; - - border: 1px solid #000; - border-radius: 3px; - - @each $category, $color in $categories { - .#{$category} & { - border-color: $color; - } - } - - @media (max-width: $screen-sm){ - display: block; - border: none; - } -} - -.inside { - margin-top: 20px; - margin-bottom: 20px; -} - -.inside-full-height { - height: 100%; - margin-top: 0; - margin-bottom: 0; - - - @media (max-width: $screen-sm) { - border: 1px solid; - border-radius: 3px; - padding: 20px; - margin: 10px 0; - - @each $category, $color in $categories { - .#{$category} & { - border-color: $color; - } - } - } -} - - -.talk-proposal { - margin-top: -20px; -} - -.proposal-box { - - // padding: 10px 20px; - - .proposal-box--title { - font-size: 38px; - font-weight: 400; - text-align: center; - - margin-bottom: 20px; - } - - .proposal-box--text { - font-size: 24px; - font-weight: 700; - line-height: 1.2; - margin-bottom: 20px; - } - - @each $category, $color in $categories { - .#{$category} & { - border-color: $color; - - .proposal-box--title { - color: $color; - } - } - } -} - -.program-content { - h2 { - font-size: 38px; - font-weight: 500; - margin-bottom: 40px; - padding-bottom: 20px; - - small { - display: block; - font-size: 16px; - padding-top: 5px; - text-transform: none; - } - } -} diff --git a/src/app/components/programas/programas.html b/src/app/components/programas/programas.html deleted file mode 100644 index 2513bc9..0000000 --- a/src/app/components/programas/programas.html +++ /dev/null @@ -1,74 +0,0 @@ -
-
-
- -
-
- -
-
-
-

Conheça os programas ({{vm.filtredProgramList.length}}/{{::vm.programs.length}})

- -
-
-
- -
- -
- -
-
-
- Nenhum programa encontrado. -
-
-
-
-
diff --git a/src/app/components/programas/programas.scss b/src/app/components/programas/programas.scss deleted file mode 100644 index 3d6e28a..0000000 --- a/src/app/components/programas/programas.scss +++ /dev/null @@ -1,132 +0,0 @@ -.program-list { - .header { - position: relative; - height: 40px; - margin-bottom: 10px; - - button { - position: absolute; - right: 0; - top: 2px; - } - } - - .form-inline { - input, - select { - width: 100%; - } - } -} - -.category-list { - .category-list--title { - color: #ffffff; - font-size: 16px; - margin: 0; - padding: 20px; - background-color: #484848; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - overflow: hidden; - } - - - .category-list--group { - } - - .category-list--item { - position: relative; - text-transform: uppercase; - font-weight: bold; - padding: 0; - height: 68px; - overflow: hidden; - } - - .category-list--label { - margin-left: 70px; - margin-right: 30px; - display: inline-block; - z-index: 99999; - } - - &--icon-circle { - width: 48px; - height: 48px; - position: absolute; - top: 10px; - left: 10px; - // border: 1px solid #fff; - border-radius: 48px; - - -webkit-transition: -webkit-transform 0.2s ease-in-out; - -moz-transition: -moz-transform 0.2s ease-in-out; - -o-transition: -o-transform 0.2s ease-in-out; - transition: transform 0.2s ease-in-out; - - // -webkit-transition: all 0.2s ease-in-out; - // -moz-transition: all 0.2s ease-in-out; - // -o-transition: all 0.2s ease-in-out; - // transition: all 0.2s ease-in-out; - - z-index: 0; - - .active & { - z-index: -1; - - @media (max-width: $screen-xs) { - transform: scale(20); - } - - @media (min-width: $screen-xs + 1) { - transform: scale(40); - } - - @media (min-width: $screen-sm + 1) { - transform: scale(20); - } - - // @media (min-width: $screen-md + 1) { - // transform: scale(20); - // } - } - - @each $category, $color in $categories { - &.#{$category} { - background-color: $color; - } - } - } - - .category-list--icon { - position: absolute; - top: -16px; - left: -14px; - transform: scale(0.35); - } - - .category-list--icon--right { - position: absolute; - right: 9px; - top: 50%; - margin-top: -9px; - transform: scale(1.4); - } - - .list-group-item.active, - .list-group-item.active:hover, - .list-group-item.active:focus { - background-color: #f5f5f5; - } - - // @each $category, $color in $categories { - // &.#{$category} { - // .list-group-item.active, - // .list-group-item.active:hover, - // .list-group-item.active:focus { - // background-color: $color; - // } - // } - // } -} diff --git a/src/app/index.route.js b/src/app/index.route.js index e1e7b9f..d1a15cf 100644 --- a/src/app/index.route.js +++ b/src/app/index.route.js @@ -57,7 +57,7 @@ 'footer': { templateUrl: 'app/pages/footer/footer.html' } } }) - .state('programa-conheca', { + .state('conheca-o-programa', { url: '/programa/:slug/conheca-o-programa', views: { 'header': { templateUrl: 'app/pages/header/header.html' }, diff --git a/src/app/index.run.js b/src/app/index.run.js index e3f17e9..93826b2 100644 --- a/src/app/index.run.js +++ b/src/app/index.run.js @@ -18,7 +18,7 @@ $rootScope.$on('$stateChangeStart', function(event, next) { if (!next.data || !next.data.authorizedRoles) { - $log.debug('runAuth: public url/state'); + $log.debug('[RUN] Auth: public url/state'); return; } @@ -37,7 +37,7 @@ } }); - $log.debug('runAuth end.'); + $log.debug('[RUN] Auth end.'); } /** @ngInject */ @@ -75,7 +75,7 @@ } }; - $log.debug('runAccessibility end.'); + $log.debug('[RUN] Accessibility end.'); } /** @ngInject */ @@ -86,11 +86,11 @@ } /** @ngInject */ - function runPath($rootScope, api, $window, $log) { + function runPath($rootScope, API, $window, $log) { var isProduction = (/^http:\/\/dialoga\.gov\.br\//.test($window.location.href)); - $rootScope.basePath = isProduction ? api.hostProd : api.hostHom; + $rootScope.basePath = isProduction ? API.hostProd : API.hostHom; - $log.debug('runPath end.'); + $log.debug('[RUN] Path end.'); } /** @ngInject */ @@ -122,7 +122,7 @@ /** @ngInject */ function runBlock($log) { - $log.debug('runBlock end.'); + $log.debug('[RUN] Block end.'); } })(); diff --git a/src/app/index.scss b/src/app/index.scss index b4fe8f0..f52e45b 100644 --- a/src/app/index.scss +++ b/src/app/index.scss @@ -25,6 +25,12 @@ $gray: #f1f1f1; $categories: (saude: #3449b7, seguranca-publica: #e34748, educacao: #f39720, reducao-da-pobreza: #3ebb8f, cultura: #a63738); $categories-descriptions: (saude: "Saúde é direito de todos e dever do Estado. O Sistema Único de Saúde (SUS) é universal, integral e de responsabilidade do Governo Federal, estados e municípios. Atende a todos os brasileiros.", seguranca-publica: "A segurança pública é um direito fundamental dos cidadãos. A proteção da vida, a disseminação da cultura da paz e a integração dos órgãos e instituições municipais, estaduais e federais são os maiores compromissos dessa política pública.", educacao: "Uma pátria educadora se faz com oportunidades para todos. Nos últimos anos, o Brasil criou esse caminho de oportunidades. Ampliamos o acesso à educação em todos os níveis de ensino – da creche à pós-graduação – e para todos os brasileiros, independentemente de sua classe social. E ainda há muito a fazer. O Plano Nacional de Educação (PNE) estabelece novas metas para que o governo federal trabalhe em parceria com a sociedade, com os estados e os municípios na construção de um futuro melhor. Queremos agora um salto na qualidade do ensino.", reducao-da-pobreza: "Com o esforço do Brasil para reduzir a pobreza e a desigualdade, 36 milhões de pessoas superaram a miséria na última década e o país saiu do Mapa da Fome das Nações Unidas.", cultura: "O que nos singulariza no conjunto das nações é, em última instância, nossa cultura. É por ela que nos identificamos como brasileiros de norte a sul deste país. Uma grande nação precisa ter um desenvolvimento cultural à altura de sua grandeza, contemplando as dimensões simbólica, econômica e cidadã da cultura, que são parte central do projeto de um país democrático e plural. A pluralidade é nossa singularidade."); +// Programs +$scale: 1.1; +$time: .2s; +$darken: 15%; + + // ------------- body { @@ -53,11 +59,89 @@ body { z-index: 2; } -.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; +// Commons +.button--themed { + padding: 20px; + .btn { + color: #fff; + font-weight: bold; + padding: 15px 0; + border-left: 0; + border-right: 0; + border-top: 0; + border-radius: 6px; + + -webkit-transition: all $time ease-in-out; + -moz-transition: all $time ease-in-out; + -o-transition: all $time ease-in-out; + transition: all $time ease-in-out; + + @each $category, $color in $categories { + .#{$category} & { + background-color: $color; + border-bottom: 3px solid darken($color, $darken); + } + } + + &:hover, + &:focus { + @each $category, $color in $categories { + .#{$category} & { + background-color: darken($color, $darken); + } + } + } + + .contraste & { + color: #262626; + background-color: #fff; + } + } + + .btn-circle { + width: 64px; + height: 64px; + border-radius: 100%; + } + + // &.vote-buttons { + // padding-bottom: 40px; + // } + + .btn.vote-buttons-up { + float: right; + margin-right: 10px; + background-color: #32dbb5; + border-bottom: 3px solid #1da485; + + &:hover, + &:focus { + background-color: #1da485; + } + } + + .btn.vote-buttons-down { + float: left; + margin-left: 10px; + background-color: #db4127; + border-bottom: 3px solid #9c2d1a; + + &:hover, + &:focus { + background-color: #9c2d1a; + } + + + // @media (max-width: $screen-sm) { + // margin-left: + // } + } + + .vote-buttons-up, + .vote-buttons-down { + font-size: 30px; + margin-bottom: 20px; + } } // Hack to fix "Barra do Brasil" diff --git a/src/app/layout.scss b/src/app/layout.scss new file mode 100644 index 0000000..d8a54b4 --- /dev/null +++ b/src/app/layout.scss @@ -0,0 +1,65 @@ +.row-height { + display: table; + table-layout: fixed; + height: 100%; + width: 100%; + border-spacing: 20px; + + @media (max-width: $screen-sm) { + display: block; + } + + // @media (min-width: $screen-sm + 1) { + // height: $hLine * 2; + // } + + // @media (min-width: $screen-md + 1) { + // height: $hLine * 2; + // } +} + +.col-height { + display: table-cell; + float: none; + height: 100%; + vertical-align: top; + + border: 1px solid #000; + border-radius: 3px; + + @each $category, $color in $categories { + .#{$category} & { + border-color: $color; + } + } + + @media (max-width: $screen-sm){ + display: block; + border: none; + } +} + +.inside { + margin-top: 20px; + margin-bottom: 20px; +} + +.inside-full-height { + height: 100%; + margin-top: 0; + margin-bottom: 0; + + + @media (max-width: $screen-sm) { + border: 1px solid; + border-radius: 3px; + padding: 20px; + margin: 10px 0; + + @each $category, $color in $categories { + .#{$category} & { + border-color: $color; + } + } + } +} diff --git a/src/app/pages/article/article.service.js b/src/app/pages/article/article.service.js index 24a5632..79640ab 100644 --- a/src/app/pages/article/article.service.js +++ b/src/app/pages/article/article.service.js @@ -6,12 +6,12 @@ .factory('ArticleService', ArticleService); /** @ngInject */ - function ArticleService($http, $q, $rootScope, UtilService, Slug, $log) { + function ArticleService($http, $q, $rootScope, API, UtilService, Slug, $log) { $log.debug('ArticleService'); - var idArticleHome = '103358'; - var idArticleAbout = '108073'; - var idArticleTerms = '107880'; + var idArticleHome = API.articleId.home; + var idArticleAbout = API.articleId.about; + var idArticleTerms = API.articleId.terms; var _savedAbstract = null; @@ -22,6 +22,9 @@ getTerms: getTerms, getArticleById: getArticleById, getArticleBySlug: getArticleBySlug, + getCategories: getCategories, + getCategoryBySlug: getCategoryBySlug, + getPrograms: getPrograms, getContentById: getContentById, setHomeAbstract: setHomeAbstract, getHomeAbstract: getHomeAbstract @@ -89,6 +92,34 @@ }, cbError); } + function getCategories (cbSuccess, cbError) { + return getHome(function(data){ + cbSuccess(data.article.categories); + }, cbError); + } + + function getCategoryBySlug (slug, cbSuccess, cbError) { + return getHome(function (data){ + var result = null; + + for (var i = data.article.categories.length - 1; i >= 0; i--) { + var category = data.article.categories[i]; + if (category.slug === slug) { + result = category; + break; + } + } + + cbSuccess(result); + }, cbError); + } + + function getPrograms (cbSuccess, cbError) { + return getHome(function(data){ + cbSuccess(data.article.children); + }, cbError); + } + function getContentById (contentId, cbSuccess, cbError) { return getArticleById(contentId, { fields: 'id,body&content_type=ProposalsDiscussionPlugin::Topic' @@ -99,7 +130,7 @@ return getArticleById(idArticleHome, { fields: 'id,children,categories,abstract,title,image,url,setting,position', private_token: 'null' - }, _handleCategoryColors(cbSuccess), cbError); + }, _handleCategory(cbSuccess), cbError); } function getAbout (cbSuccess, cbError) { @@ -110,20 +141,23 @@ return getArticleById(idArticleTerms, {}, cbSuccess, cbError); } - function _handleCategoryColors (cbSuccess) { + function _handleCategory (cbSuccess) { // var darkFactor = 0.15; return function (data) { - // if(data.article.categories){ - // var categories = data.article.categories; + if(data.article.categories){ + // var categories = data.article.categories; + // Handle Category Data + + // Handle Category Colors // for (var i = categories.length - 1; i >= 0; i--) { // var category = categories[i]; // if(category.color && !category.bgColor){ // category.colorDarker = $window.ColorLuminance(category.color, 0.15); // } // }; - // } + } cbSuccess(data); }; } diff --git a/src/app/pages/inicio/inicio.html b/src/app/pages/inicio/inicio.html index 50b22de..dfd3afb 100644 --- a/src/app/pages/inicio/inicio.html +++ b/src/app/pages/inicio/inicio.html @@ -28,6 +28,13 @@
- +
+
+ +
+
+ +
+
diff --git a/src/app/pages/programas/conheca-o-programa.html b/src/app/pages/programas/conheca-o-programa.html index 2170c2d..3211396 100644 --- a/src/app/pages/programas/conheca-o-programa.html +++ b/src/app/pages/programas/conheca-o-programa.html @@ -1,20 +1,20 @@
-
- +
+
-
+
-
+
-
+
-