Commit 36438b8f750e809477fd4433e12c4ffbb1cbcdda
Exists in
master
and in
4 other branches
Merge branch 'master' into staging
Showing
8 changed files
with
70 additions
and
27 deletions
Show diff stats
src/app/components/article-service/article.service.js
@@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
13 | apiArticles: $rootScope.basePath + '/api/v1/articles/', | 13 | apiArticles: $rootScope.basePath + '/api/v1/articles/', |
14 | apiCommunities: $rootScope.basePath + '/api/v1/communities/', | 14 | apiCommunities: $rootScope.basePath + '/api/v1/communities/', |
15 | apiProposals: $rootScope.basePath + '/api/v1/proposals_discussion_plugin/', | 15 | apiProposals: $rootScope.basePath + '/api/v1/proposals_discussion_plugin/', |
16 | + apiSearch: $rootScope.basePath + '/api/v1/search/', | ||
16 | getArticleById: getArticleById, | 17 | getArticleById: getArticleById, |
17 | getArticleBySlug: getArticleBySlug, | 18 | getArticleBySlug: getArticleBySlug, |
18 | getCategories: getCategories, | 19 | getCategories: getCategories, |
@@ -234,7 +235,7 @@ | @@ -234,7 +235,7 @@ | ||
234 | 235 | ||
235 | function searchTopics (params, cbSuccess, cbError) { | 236 | function searchTopics (params, cbSuccess, cbError) { |
236 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Topic&query=cisternas | 237 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Topic&query=cisternas |
237 | - var url = '/api/v1/search/article'; | 238 | + var url = service.apiSearch + '/article'; |
238 | var paramsExtended = angular.extend({ | 239 | var paramsExtended = angular.extend({ |
239 | // 'fields[]': ['id', 'title', 'slug', 'abstract', 'categories', 'setting', 'children_count', 'hits'], | 240 | // 'fields[]': ['id', 'title', 'slug', 'abstract', 'categories', 'setting', 'children_count', 'hits'], |
240 | 'type': 'ProposalsDiscussionPlugin::Topic' | 241 | 'type': 'ProposalsDiscussionPlugin::Topic' |
@@ -249,7 +250,7 @@ | @@ -249,7 +250,7 @@ | ||
249 | 250 | ||
250 | function searchProposals (params, cbSuccess, cbError) { | 251 | function searchProposals (params, cbSuccess, cbError) { |
251 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas | 252 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas |
252 | - var url = '/api/v1/search/article'; | 253 | + var url = service.apiSearch + '/article'; |
253 | var paramsExtended = angular.extend({ | 254 | var paramsExtended = angular.extend({ |
254 | page: 1, | 255 | page: 1, |
255 | per_page: 20, | 256 | per_page: 20, |
src/app/components/auth/auth.service.js
@@ -37,12 +37,22 @@ | @@ -37,12 +37,22 @@ | ||
37 | .then(function(response) { | 37 | .then(function(response) { |
38 | $log.debug('AuthService.register [SUCCESS] response', response); | 38 | $log.debug('AuthService.register [SUCCESS] response', response); |
39 | 39 | ||
40 | - var currentUser = Session.create(response.data); | 40 | + var data = response.data; |
41 | 41 | ||
42 | - $rootScope.currentUser = currentUser; | ||
43 | - $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, currentUser); | ||
44 | - $rootScope.$broadcast(AUTH_EVENTS.loginSuccess, currentUser); | 42 | + if ( data.user && data.user.activated === false){ |
43 | + // usuário criado E não verificado o e-mail | ||
44 | + | ||
45 | + } | ||
46 | + | ||
47 | + if ( data.user && data.user.activated === true){ | ||
48 | + // usuário criado E não verificado o e-mail | ||
49 | + var currentUser = Session.create(data); | ||
45 | 50 | ||
51 | + $rootScope.currentUser = currentUser; | ||
52 | + $rootScope.$broadcast(AUTH_EVENTS.loginSuccess, currentUser); | ||
53 | + } | ||
54 | + | ||
55 | + $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, currentUser); | ||
46 | return response; | 56 | return response; |
47 | }, function(response) { | 57 | }, function(response) { |
48 | $log.debug('AuthService.register [FAIL] response', response); | 58 | $log.debug('AuthService.register [FAIL] response', response); |
src/app/components/cadastro-proposta/cadastro-proposta.html
@@ -21,10 +21,16 @@ | @@ -21,10 +21,16 @@ | ||
21 | <div class="col-sm-8"> | 21 | <div class="col-sm-8"> |
22 | <label for="proposta-textarea">Descrição da proposta*</label> | 22 | <label for="proposta-textarea">Descrição da proposta*</label> |
23 | <a tabindex="0" class="btn btn-link btn-question" role="button" data-toggle="popover" data-trigger="focus">?</a> | 23 | <a tabindex="0" class="btn btn-link btn-question" role="button" data-toggle="popover" data-trigger="focus">?</a> |
24 | - <textarea id="proposta-textarea" name="proposta" class="texto-proposta form-control" | 24 | + <textarea |
25 | + id="proposta-textarea" | ||
26 | + name="proposta" | ||
27 | + class="texto-proposta form-control" | ||
25 | ng-class="{ 'has-error' : formPropostas.proposta.$invalid && formPropostas.proposta.$touched }" | 28 | ng-class="{ 'has-error' : formPropostas.proposta.$invalid && formPropostas.proposta.$touched }" |
26 | ng-model="proposta" | 29 | ng-model="proposta" |
27 | - required ng-maxlength="200" ></textarea> | 30 | + ng-trim="false" |
31 | + ng-maxlength="200" | ||
32 | + maxlength="200" | ||
33 | + required></textarea> | ||
28 | <validation-messages field="formPropostas.proposta" maxlength="'Ops, esse campo não pode ser maior que 200 caracteres.'"></validation-messages> | 34 | <validation-messages field="formPropostas.proposta" maxlength="'Ops, esse campo não pode ser maior que 200 caracteres.'"></validation-messages> |
29 | <div class="row"> | 35 | <div class="row"> |
30 | <div class="col-xs-6"> | 36 | <div class="col-xs-6"> |
@@ -32,6 +38,7 @@ | @@ -32,6 +38,7 @@ | ||
32 | </div> | 38 | </div> |
33 | <div class="col-xs-6 text-right"> | 39 | <div class="col-xs-6 text-right"> |
34 | <span>Máx. 200 caracteres</span> | 40 | <span>Máx. 200 caracteres</span> |
41 | + <span ng-if="proposta.length > 0">(restam {{(200 - proposta.length)}} caracteres)</span> | ||
35 | </div> | 42 | </div> |
36 | </div> | 43 | </div> |
37 | </div> | 44 | </div> |
src/app/components/proposal-carousel/proposal-carousel.html
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <div class="proposal-carousel-top-triggers" ng-if="vm.proposals"> | 8 | <div class="proposal-carousel-top-triggers" ng-if="vm.proposals"> |
9 | <ul class="list-inline"> | 9 | <ul class="list-inline"> |
10 | <li class="item-dot" ng-repeat="proposal in vm.proposals"> | 10 | <li class="item-dot" ng-repeat="proposal in vm.proposals"> |
11 | - <button type="button" ng-class="{'active': vm.activeIndex === $index}" ng-click="vm.switchProposal($index)" title="Apersentar proposta na posição {{$index}}"></button> | 11 | + <button type="button" ng-class="{'active': vm.activeIndex === $index}" ng-click="vm.switchProposal($index)" title="Apersentar proposta {{ ( $index + 1 ) }}"></button> |
12 | </li> | 12 | </li> |
13 | </ul> | 13 | </ul> |
14 | </div> | 14 | </div> |
src/app/pages/auth/auth.controller.js
@@ -61,6 +61,7 @@ | @@ -61,6 +61,7 @@ | ||
61 | // handle logout | 61 | // handle logout |
62 | vm.$scope.$on(vm.AUTH_EVENTS.logoutSuccess, function() { | 62 | vm.$scope.$on(vm.AUTH_EVENTS.logoutSuccess, function() { |
63 | vm.currentUser = vm.Session.getCurrentUser(); | 63 | vm.currentUser = vm.Session.getCurrentUser(); |
64 | + vm._attachCaptcha(); | ||
64 | }); | 65 | }); |
65 | }; | 66 | }; |
66 | 67 | ||
@@ -83,16 +84,15 @@ | @@ -83,16 +84,15 @@ | ||
83 | var vm = this; | 84 | var vm = this; |
84 | 85 | ||
85 | vm.$scope.$on(vm.AUTH_EVENTS.registerSuccess, function(event, response) { | 86 | vm.$scope.$on(vm.AUTH_EVENTS.registerSuccess, function(event, response) { |
86 | - vm.$log.debug('TODO: handle register success'); | ||
87 | vm.$log.debug('[register success] response', response); | 87 | vm.$log.debug('[register success] response', response); |
88 | }); | 88 | }); |
89 | 89 | ||
90 | vm.$scope.$on(vm.AUTH_EVENTS.registerFailed, function(event, response) { | 90 | vm.$scope.$on(vm.AUTH_EVENTS.registerFailed, function(event, response) { |
91 | - vm.$log.debug('TODO: handle register error'); | ||
92 | vm.$log.debug('[register error] response', response); | 91 | vm.$log.debug('[register error] response', response); |
93 | 92 | ||
94 | - var reason = response.data.message; | ||
95 | - vm.errorMessage = reason; | 93 | + // REMOVED: feedback alread on "reject handler" |
94 | + // var reason = response.data.message; | ||
95 | + // vm.errorMessage = reason; | ||
96 | }); | 96 | }); |
97 | 97 | ||
98 | vm.$scope.$on('oauthClientPluginResult', function(event, response) { | 98 | vm.$scope.$on('oauthClientPluginResult', function(event, response) { |
@@ -103,6 +103,12 @@ | @@ -103,6 +103,12 @@ | ||
103 | // var user = response.data.user; | 103 | // var user = response.data.user; |
104 | }); | 104 | }); |
105 | 105 | ||
106 | + vm._attachCaptcha(); | ||
107 | + }; | ||
108 | + | ||
109 | + AuthPageController.prototype._attachCaptcha = function() { | ||
110 | + var vm = this; | ||
111 | + | ||
106 | var stop = null; | 112 | var stop = null; |
107 | stop = vm.$interval(function(){ | 113 | stop = vm.$interval(function(){ |
108 | var $el = angular.element('#serpro_captcha'); | 114 | var $el = angular.element('#serpro_captcha'); |
@@ -137,17 +143,26 @@ | @@ -137,17 +143,26 @@ | ||
137 | // TODO: mensagens de sucesso | 143 | // TODO: mensagens de sucesso |
138 | // 'Cadastro efetuado com sucesso.' | 144 | // 'Cadastro efetuado com sucesso.' |
139 | // 'Verifique seu email para confirmar o cadastro.' | 145 | // 'Verifique seu email para confirmar o cadastro.' |
140 | - vm.messageTitle = 'Cadastro efetuado com sucesso!'; | ||
141 | - vm.successMessage = 'Verifique seu e-mail para confirmar o cadastro.'; | 146 | + vm.signupMessageTitle = 'Cadastro efetuado com sucesso!'; |
147 | + vm.signupSuccessMessage = 'Verifique seu e-mail para confirmar o cadastro.'; | ||
142 | vm.redirectBack(); | 148 | vm.redirectBack(); |
143 | }, function(response) { | 149 | }, function(response) { |
144 | vm.$log.debug('register error.response', response); | 150 | vm.$log.debug('register error.response', response); |
145 | 151 | ||
146 | - var message = response.data.message; | ||
147 | - vm.errorMessage = message; | ||
148 | - | ||
149 | - if(response.data.code === 500){ | ||
150 | - vm.internalError = true; | 152 | + vm.internalError = true; |
153 | + | ||
154 | + switch (response.data.code) { | ||
155 | + case 400: // bad request | ||
156 | + var errors = JSON.parse(response.data.message); | ||
157 | + if(errors && errors.email){ | ||
158 | + vm.signupErrorMessage = "E-mail já está em uso." | ||
159 | + } | ||
160 | + break; | ||
161 | + case 500: | ||
162 | + vm.signupErrorMessage = message; | ||
163 | + break; | ||
164 | + default: | ||
165 | + break; | ||
151 | } | 166 | } |
152 | 167 | ||
153 | 168 |
src/app/pages/auth/signin.html
@@ -8,14 +8,14 @@ | @@ -8,14 +8,14 @@ | ||
8 | <section role="main" class="section-gray auth-content"> | 8 | <section role="main" class="section-gray auth-content"> |
9 | <div class="container"> | 9 | <div class="container"> |
10 | <div class="row"> | 10 | <div class="row"> |
11 | - <div ng-if="pageSignin.currentUser"> | 11 | + <div ng-if="pageSignin.currentUser || pageSignin.signupMessageTitle"> |
12 | <div class="row"> | 12 | <div class="row"> |
13 | <div class="col-sm-8 col-sm-offset-2"> | 13 | <div class="col-sm-8 col-sm-offset-2"> |
14 | <div class="feedback-message"> | 14 | <div class="feedback-message"> |
15 | <show-message | 15 | <show-message |
16 | type="'success'" | 16 | type="'success'" |
17 | - message="pageSignin.messageTitle || 'Você está logado!'" | ||
18 | - description="pageSignin.successMessage" | 17 | + message="pageSignin.signupMessageTitle || 'Você está logado!'" |
18 | + description="pageSignin.signupSuccessMessage" | ||
19 | ></show-message> | 19 | ></show-message> |
20 | 20 | ||
21 | <div class="row"> | 21 | <div class="row"> |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
38 | - <div ng-if="!pageSignin.currentUser"> | 38 | + <div ng-if="!pageSignin.currentUser && !pageSignin.signupMessageTitle"> |
39 | <div class="col-sm-5"> | 39 | <div class="col-sm-5"> |
40 | <div class="row"> | 40 | <div class="row"> |
41 | <div class="col-md-12"> | 41 | <div class="col-md-12"> |
@@ -96,10 +96,10 @@ | @@ -96,10 +96,10 @@ | ||
96 | </p> | 96 | </p> |
97 | </div> | 97 | </div> |
98 | </div> | 98 | </div> |
99 | - <div class="row" ng-if="pageSignin.errorMessage"> | 99 | + <div class="row" ng-if="pageSignin.signupErrorMessage"> |
100 | <div class="col-sm-12"> | 100 | <div class="col-sm-12"> |
101 | <div class="alert alert-danger"> | 101 | <div class="alert alert-danger"> |
102 | - {{pageSignin.errorMessage}} | 102 | + {{pageSignin.signupErrorMessage}} |
103 | </div> | 103 | </div> |
104 | <div ng-if="vm.internalError"> | 104 | <div ng-if="vm.internalError"> |
105 | <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p> | 105 | <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p> |
src/app/pages/programas/programas.scss
@@ -81,9 +81,19 @@ | @@ -81,9 +81,19 @@ | ||
81 | .program-preview--share { | 81 | .program-preview--share { |
82 | margin-bottom: 20px; | 82 | margin-bottom: 20px; |
83 | position: relative; | 83 | position: relative; |
84 | + | ||
84 | .dropdown { | 85 | .dropdown { |
85 | display: inline-block; | 86 | display: inline-block; |
86 | position: relative; | 87 | position: relative; |
88 | + | ||
89 | + @media screen and (max-width: $screen-xs) { | ||
90 | + display: block; | ||
91 | + | ||
92 | + .dropdown-menu-right { | ||
93 | + left: 0; | ||
94 | + right: auto; | ||
95 | + } | ||
96 | + } | ||
87 | } | 97 | } |
88 | 98 | ||
89 | .dropdown-menu { | 99 | .dropdown-menu { |
src/app/pages/ranking/ranking.controller.js
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | var vm = this; | 28 | var vm = this; |
29 | 29 | ||
30 | vm.page = 1; | 30 | vm.page = 1; |
31 | - vm.per_page = 20; | 31 | + vm.per_page = 10; |
32 | vm.themes = null; | 32 | vm.themes = null; |
33 | vm.selectedTheme = null; | 33 | vm.selectedTheme = null; |
34 | vm.filtredPrograms = null; | 34 | vm.filtredPrograms = null; |