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 | 13 | apiArticles: $rootScope.basePath + '/api/v1/articles/', |
14 | 14 | apiCommunities: $rootScope.basePath + '/api/v1/communities/', |
15 | 15 | apiProposals: $rootScope.basePath + '/api/v1/proposals_discussion_plugin/', |
16 | + apiSearch: $rootScope.basePath + '/api/v1/search/', | |
16 | 17 | getArticleById: getArticleById, |
17 | 18 | getArticleBySlug: getArticleBySlug, |
18 | 19 | getCategories: getCategories, |
... | ... | @@ -234,7 +235,7 @@ |
234 | 235 | |
235 | 236 | function searchTopics (params, cbSuccess, cbError) { |
236 | 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 | 239 | var paramsExtended = angular.extend({ |
239 | 240 | // 'fields[]': ['id', 'title', 'slug', 'abstract', 'categories', 'setting', 'children_count', 'hits'], |
240 | 241 | 'type': 'ProposalsDiscussionPlugin::Topic' |
... | ... | @@ -249,7 +250,7 @@ |
249 | 250 | |
250 | 251 | function searchProposals (params, cbSuccess, cbError) { |
251 | 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 | 254 | var paramsExtended = angular.extend({ |
254 | 255 | page: 1, |
255 | 256 | per_page: 20, | ... | ... |
src/app/components/auth/auth.service.js
... | ... | @@ -37,12 +37,22 @@ |
37 | 37 | .then(function(response) { |
38 | 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 | 56 | return response; |
47 | 57 | }, function(response) { |
48 | 58 | $log.debug('AuthService.register [FAIL] response', response); | ... | ... |
src/app/components/cadastro-proposta/cadastro-proposta.html
... | ... | @@ -21,10 +21,16 @@ |
21 | 21 | <div class="col-sm-8"> |
22 | 22 | <label for="proposta-textarea">Descrição da proposta*</label> |
23 | 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 | 28 | ng-class="{ 'has-error' : formPropostas.proposta.$invalid && formPropostas.proposta.$touched }" |
26 | 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 | 34 | <validation-messages field="formPropostas.proposta" maxlength="'Ops, esse campo não pode ser maior que 200 caracteres.'"></validation-messages> |
29 | 35 | <div class="row"> |
30 | 36 | <div class="col-xs-6"> |
... | ... | @@ -32,6 +38,7 @@ |
32 | 38 | </div> |
33 | 39 | <div class="col-xs-6 text-right"> |
34 | 40 | <span>Máx. 200 caracteres</span> |
41 | + <span ng-if="proposta.length > 0">(restam {{(200 - proposta.length)}} caracteres)</span> | |
35 | 42 | </div> |
36 | 43 | </div> |
37 | 44 | </div> | ... | ... |
src/app/components/proposal-carousel/proposal-carousel.html
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | <div class="proposal-carousel-top-triggers" ng-if="vm.proposals"> |
9 | 9 | <ul class="list-inline"> |
10 | 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 | 12 | </li> |
13 | 13 | </ul> |
14 | 14 | </div> | ... | ... |
src/app/pages/auth/auth.controller.js
... | ... | @@ -61,6 +61,7 @@ |
61 | 61 | // handle logout |
62 | 62 | vm.$scope.$on(vm.AUTH_EVENTS.logoutSuccess, function() { |
63 | 63 | vm.currentUser = vm.Session.getCurrentUser(); |
64 | + vm._attachCaptcha(); | |
64 | 65 | }); |
65 | 66 | }; |
66 | 67 | |
... | ... | @@ -83,16 +84,15 @@ |
83 | 84 | var vm = this; |
84 | 85 | |
85 | 86 | vm.$scope.$on(vm.AUTH_EVENTS.registerSuccess, function(event, response) { |
86 | - vm.$log.debug('TODO: handle register success'); | |
87 | 87 | vm.$log.debug('[register success] response', response); |
88 | 88 | }); |
89 | 89 | |
90 | 90 | vm.$scope.$on(vm.AUTH_EVENTS.registerFailed, function(event, response) { |
91 | - vm.$log.debug('TODO: handle register error'); | |
92 | 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 | 98 | vm.$scope.$on('oauthClientPluginResult', function(event, response) { |
... | ... | @@ -103,6 +103,12 @@ |
103 | 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 | 112 | var stop = null; |
107 | 113 | stop = vm.$interval(function(){ |
108 | 114 | var $el = angular.element('#serpro_captcha'); |
... | ... | @@ -137,17 +143,26 @@ |
137 | 143 | // TODO: mensagens de sucesso |
138 | 144 | // 'Cadastro efetuado com sucesso.' |
139 | 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 | 148 | vm.redirectBack(); |
143 | 149 | }, function(response) { |
144 | 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 | 8 | <section role="main" class="section-gray auth-content"> |
9 | 9 | <div class="container"> |
10 | 10 | <div class="row"> |
11 | - <div ng-if="pageSignin.currentUser"> | |
11 | + <div ng-if="pageSignin.currentUser || pageSignin.signupMessageTitle"> | |
12 | 12 | <div class="row"> |
13 | 13 | <div class="col-sm-8 col-sm-offset-2"> |
14 | 14 | <div class="feedback-message"> |
15 | 15 | <show-message |
16 | 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 | 19 | ></show-message> |
20 | 20 | |
21 | 21 | <div class="row"> |
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | </div> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | - <div ng-if="!pageSignin.currentUser"> | |
38 | + <div ng-if="!pageSignin.currentUser && !pageSignin.signupMessageTitle"> | |
39 | 39 | <div class="col-sm-5"> |
40 | 40 | <div class="row"> |
41 | 41 | <div class="col-md-12"> |
... | ... | @@ -96,10 +96,10 @@ |
96 | 96 | </p> |
97 | 97 | </div> |
98 | 98 | </div> |
99 | - <div class="row" ng-if="pageSignin.errorMessage"> | |
99 | + <div class="row" ng-if="pageSignin.signupErrorMessage"> | |
100 | 100 | <div class="col-sm-12"> |
101 | 101 | <div class="alert alert-danger"> |
102 | - {{pageSignin.errorMessage}} | |
102 | + {{pageSignin.signupErrorMessage}} | |
103 | 103 | </div> |
104 | 104 | <div ng-if="vm.internalError"> |
105 | 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 | 81 | .program-preview--share { |
82 | 82 | margin-bottom: 20px; |
83 | 83 | position: relative; |
84 | + | |
84 | 85 | .dropdown { |
85 | 86 | display: inline-block; |
86 | 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 | 99 | .dropdown-menu { | ... | ... |