Commit a4087bc36aaf52682d41561335e8bf4410fdc9c4
Exists in
master
and in
4 other branches
Merge branch 'master' into staging
Showing
13 changed files
with
68 additions
and
62 deletions
Show diff stats
src/app/components/article-service/article.service.js
... | ... | @@ -128,7 +128,6 @@ |
128 | 128 | |
129 | 129 | function getProposalByIdRanked (proposalId, params, cbSuccess, cbError) { |
130 | 130 | var url = service.apiProposals + proposalId + '/ranking?per_page=5&page=1'; |
131 | - console.log(url); | |
132 | 131 | var paramsExtended = angular.extend({ |
133 | 132 | // 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], |
134 | 133 | // 'per_page':'1', |
... | ... | @@ -283,7 +282,6 @@ |
283 | 282 | function searchProposals (params, cbSuccess, cbError) { |
284 | 283 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas |
285 | 284 | var url = service.apiSearch + 'article'; |
286 | - console.log('url',url); | |
287 | 285 | var paramsExtended = angular.extend({ |
288 | 286 | page: 1, |
289 | 287 | per_page: 10, |
... | ... | @@ -306,8 +304,6 @@ |
306 | 304 | ] |
307 | 305 | }, params); |
308 | 306 | |
309 | - console.log("params",paramsExtended); | |
310 | - | |
311 | 307 | UtilService.get(url, {params: paramsExtended}).then(function(data){ |
312 | 308 | _pipeInjectSlugIntoParentProgram(data); |
313 | 309 | cbSuccess(data); | ... | ... |
src/app/components/category-list/category-list.directive.js
... | ... | @@ -21,7 +21,6 @@ |
21 | 21 | vm.$element = $element; |
22 | 22 | vm.$log = $log; |
23 | 23 | |
24 | - | |
25 | 24 | // initialization |
26 | 25 | vm.init(); |
27 | 26 | } |
... | ... | @@ -33,13 +32,13 @@ |
33 | 32 | |
34 | 33 | vm.showCloseBtn = true; |
35 | 34 | |
36 | - // Disable button remove of page ranking | |
37 | - if(vm.pathUrl=="/ranking"){ | |
35 | + // Disable button 'remove' of page ranking | |
36 | + if (vm.pathUrl === '/ranking') { | |
38 | 37 | vm.showCloseBtn = false; |
39 | 38 | } |
40 | 39 | |
41 | 40 | // Default values |
42 | - if(!vm.isCollapsed){ | |
41 | + if (!vm.isCollapsed) { | |
43 | 42 | vm.isCollapsed = false; |
44 | 43 | } |
45 | 44 | |
... | ... | @@ -48,14 +47,13 @@ |
48 | 47 | CategoryListController.prototype._disableUnselect = function() { |
49 | 48 | var vm = this; |
50 | 49 | |
51 | - if(vm.disableUnselect && vm.disableUnselect === 'true'){ | |
50 | + if (vm.disableUnselect && vm.disableUnselect === 'true') { | |
52 | 51 | return true; |
53 | 52 | } |
54 | 53 | |
55 | 54 | return false; |
56 | 55 | }; |
57 | 56 | |
58 | - | |
59 | 57 | CategoryListController.prototype.selectCategory = function(category, $event) { |
60 | 58 | var vm = this; |
61 | 59 | |
... | ... | @@ -65,9 +63,9 @@ |
65 | 63 | if (category !== vm.selectedCategory) { |
66 | 64 | vm.selectedCategory = category; |
67 | 65 | |
68 | - }else{ | |
66 | + }else { | |
69 | 67 | |
70 | - if(vm._disableUnselect()){ | |
68 | + if (vm._disableUnselect()) { | |
71 | 69 | vm.$log.info('Unselect is disabled.'); |
72 | 70 | return; |
73 | 71 | } |
... | ... | @@ -79,11 +77,10 @@ |
79 | 77 | vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory); |
80 | 78 | }; |
81 | 79 | |
82 | - | |
83 | 80 | CategoryListController.prototype.toogleList = function() { |
84 | 81 | var vm = this; |
85 | 82 | |
86 | - if(!vm._listGroup){ | |
83 | + if (!vm._listGroup) { | |
87 | 84 | vm._listGroup = vm.$element.find('.list-group'); |
88 | 85 | } |
89 | 86 | vm._listGroup.slideToggle(); |
... | ... | @@ -105,4 +102,4 @@ |
105 | 102 | return directive; |
106 | 103 | } |
107 | 104 | |
108 | -})(); | |
109 | 105 | \ No newline at end of file |
106 | +})(); | ... | ... |
src/app/components/dialoga-service/dialoga.service.js
... | ... | @@ -366,6 +366,11 @@ |
366 | 366 | _pipeHackPrograms(CACHE.programs); |
367 | 367 | } |
368 | 368 | |
369 | + /** | |
370 | + * Quebra o 'abstract' do artigo na tag '<hr />' em 2. | |
371 | + * A primeira parte vai para o atributo 'summary' do programa. | |
372 | + * A segunda parte vai para o atributo 'summaryExtended' do programa. | |
373 | + */ | |
369 | 374 | function _pipeHackPrograms (programs) { |
370 | 375 | |
371 | 376 | if(!angular.isArray(programs)){ | ... | ... |
src/app/components/proposal-box/proposal-box.directive.js
src/app/components/proposal-carousel/proposal-carousel.directive.js
... | ... | @@ -22,11 +22,11 @@ |
22 | 22 | vm.init(); |
23 | 23 | } |
24 | 24 | |
25 | - ProposalCarouselController.prototype.init = function () { | |
25 | + ProposalCarouselController.prototype.init = function() { | |
26 | 26 | // initial values |
27 | 27 | var vm = this; |
28 | 28 | |
29 | - if(!vm.proposals){ | |
29 | + if (!vm.proposals) { | |
30 | 30 | throw { name: 'NotDefined', message: 'The attribute "proposals" is undefined.'}; |
31 | 31 | } |
32 | 32 | |
... | ... | @@ -36,38 +36,38 @@ |
36 | 36 | vm.proposalsLength = vm.proposals.length; |
37 | 37 | }; |
38 | 38 | |
39 | - ProposalCarouselController.prototype.swipeLeft = function () { | |
39 | + ProposalCarouselController.prototype.swipeLeft = function() { | |
40 | 40 | var vm = this; |
41 | 41 | |
42 | 42 | vm.activeIndex = (vm.activeIndex < vm.proposalsLength - 1) ? ++vm.activeIndex : 0; |
43 | 43 | }; |
44 | 44 | |
45 | - ProposalCarouselController.prototype.swipeRight = function () { | |
45 | + ProposalCarouselController.prototype.swipeRight = function() { | |
46 | 46 | var vm = this; |
47 | 47 | |
48 | 48 | vm.activeIndex = (vm.activeIndex > 0) ? --vm.activeIndex : vm.proposalsLength - 1; |
49 | 49 | }; |
50 | 50 | |
51 | - ProposalCarouselController.prototype.switchProposal = function (index) { | |
51 | + ProposalCarouselController.prototype.switchProposal = function(index) { | |
52 | 52 | var vm = this; |
53 | 53 | |
54 | - if(index >= 0 && index < vm.proposalsLength) { | |
54 | + if (index >= 0 && index < vm.proposalsLength) { | |
55 | 55 | vm.activeIndex = index; |
56 | - }else{ | |
56 | + }else { | |
57 | 57 | vm.$log.warn('[switchProposal] "index" not handled:', index); |
58 | 58 | } |
59 | 59 | }; |
60 | 60 | |
61 | - ProposalCarouselController.prototype.showProposalsList = function () { | |
61 | + ProposalCarouselController.prototype.showProposalsList = function() { | |
62 | 62 | var vm = this; |
63 | 63 | |
64 | 64 | // notify parents - handled by parents |
65 | 65 | vm.$scope.$emit('proposal-carousel:showProposalsList'); |
66 | 66 | }; |
67 | 67 | |
68 | - ProposalCarouselController.prototype.showContent = function (proposal) { | |
68 | + ProposalCarouselController.prototype.showContent = function(proposal) { | |
69 | 69 | var vm = this; |
70 | - console.log("PROPOSAL-CARROUSEL",proposal); | |
70 | + | |
71 | 71 | vm.$state.go('programa', { |
72 | 72 | slug: proposal.parent.slug, |
73 | 73 | proposal_id: proposal.proposal_id |
... | ... | @@ -89,8 +89,7 @@ |
89 | 89 | bindToController: true |
90 | 90 | }; |
91 | 91 | |
92 | - | |
93 | 92 | return directive; |
94 | 93 | } |
95 | 94 | |
96 | -})(); | |
97 | 95 | \ No newline at end of file |
96 | +})(); | ... | ... |
src/app/components/proposal-list/proposal-list.directive.js
src/app/index.run.js
... | ... | @@ -267,11 +267,10 @@ |
267 | 267 | }; |
268 | 268 | |
269 | 269 | $window.addEventListener('message', function(eventMessage) { |
270 | - // $log.debug('eventMessage', eventMessage); | |
271 | 270 | |
272 | 271 | if (eventMessage.data.message === 'oauthClientPluginResult') { |
273 | 272 | $rootScope.$broadcast('oauthClientPluginResult', eventMessage); |
274 | - // eventMessage.source.close(); | |
273 | + eventMessage.source.close(); | |
275 | 274 | } |
276 | 275 | }); |
277 | 276 | } | ... | ... |
src/app/pages/auth/auth.controller.js
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | vm.search = vm.$location.search(); |
47 | 47 | var redirect = vm.search.redirect_uri || ''; |
48 | 48 | if (redirect && redirect.length > 0) { |
49 | - vm.params = JSON.parse('{"' + decodeURI(redirect).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}'); | |
49 | + vm.params = JSON.parse('{"' + decodeURI(redirect).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); | |
50 | 50 | vm.hasRedirect = true; |
51 | 51 | } |
52 | 52 | |
... | ... | @@ -99,9 +99,22 @@ |
99 | 99 | vm.$scope.$on('oauthClientPluginResult', function(event, response) { |
100 | 100 | vm.$log.debug('response', response); |
101 | 101 | |
102 | - // var logged_id = response.data.logged_id; | |
103 | - // var private_token = response.data.private_token; | |
104 | - // var user = response.data.user; | |
102 | + var logged_in = response.data.logged_in; | |
103 | + // var message = response.data.message; | |
104 | + var private_token = response.data.private_token; | |
105 | + | |
106 | + // Garante que o 'user' sempre terá a propriedade 'private_token' | |
107 | + if(response.data.user && !response.data.user.private_token){ | |
108 | + response.data.user.private_token = private_token; | |
109 | + } | |
110 | + | |
111 | + // Se o usuário autorizou o login via a rede social, 'logged_in' é 'true' | |
112 | + if (logged_in) { | |
113 | + var currentUser = vm.Session.create(response.data); | |
114 | + | |
115 | + vm.$rootScope.currentUser = currentUser; | |
116 | + vm.$rootScope.$broadcast(vm.AUTH_EVENTS.loginSuccess, currentUser); | |
117 | + } | |
105 | 118 | }); |
106 | 119 | |
107 | 120 | vm._attachCaptcha(); |
... | ... | @@ -111,10 +124,10 @@ |
111 | 124 | var vm = this; |
112 | 125 | |
113 | 126 | var stop = null; |
114 | - stop = vm.$interval(function(){ | |
127 | + stop = vm.$interval(function() { | |
115 | 128 | var $el = angular.element('#serpro_captcha'); |
116 | 129 | |
117 | - if ($el && $el.length > 0 ){ | |
130 | + if ($el && $el.length > 0) { | |
118 | 131 | vm.$window.initCaptcha($el[0]); |
119 | 132 | vm.$interval.cancel(stop); |
120 | 133 | stop = undefined; |
... | ... | @@ -155,15 +168,15 @@ |
155 | 168 | vm.signupErrorMessage = response.data.message; |
156 | 169 | |
157 | 170 | // 4xx client error |
158 | - if (response.status >= 400 && response.status < 500){ | |
171 | + if (response.status >= 400 && response.status < 500) { | |
159 | 172 | var errors = JSON.parse(response.data.message); |
160 | - if(errors && errors.email){ | |
173 | + if (errors && errors.email) { | |
161 | 174 | vm.signupErrorMessage = 'E-mail já está em uso.'; |
162 | 175 | } |
163 | 176 | } |
164 | 177 | |
165 | 178 | // 5xx server error |
166 | - if (response.status >= 500 && response.status < 600){ | |
179 | + if (response.status >= 500 && response.status < 600) { | |
167 | 180 | vm.internalError = true; |
168 | 181 | } |
169 | 182 | }); |
... | ... | @@ -184,12 +197,12 @@ |
184 | 197 | vm.signinError = true; |
185 | 198 | |
186 | 199 | // 4xx client error |
187 | - if ( response.status >= 400 && response.status < 500 ) { | |
200 | + if (response.status >= 400 && response.status < 500) { | |
188 | 201 | |
189 | 202 | vm.signinErrorTitle = 'Erro!'; |
190 | 203 | vm.signinErrorContent = response.data.message; |
191 | 204 | |
192 | - if(response.status === 401){ | |
205 | + if (response.status === 401) { | |
193 | 206 | vm.signinErrorTitle = 'Acesso não autorizado!'; |
194 | 207 | vm.signinErrorContent = 'E-mail ou senha incorretos.'; |
195 | 208 | } |
... | ... | @@ -221,27 +234,27 @@ |
221 | 234 | }); |
222 | 235 | |
223 | 236 | // ERROR |
224 | - promiseRequest.catch(function(response){ | |
237 | + promiseRequest.catch(function(response) { | |
225 | 238 | vm.$log.debug('recover error.response', response); |
226 | 239 | |
227 | 240 | vm.recoverError = true; |
228 | 241 | vm.recoverErrorMessage = response.data.message; |
229 | 242 | |
230 | 243 | // Client Error |
231 | - if (response.status >= 400 && response.status < 500){ | |
232 | - if(response.status === 404){ | |
244 | + if (response.status >= 400 && response.status < 500) { | |
245 | + if (response.status === 404) { | |
233 | 246 | vm.recoverErrorMessage = 'E-mail não cadastrado no Dialoga Brasil.'; |
234 | 247 | } |
235 | 248 | } |
236 | 249 | |
237 | 250 | // Server Error |
238 | - if (response.status >= 500 && response.status < 600){ | |
251 | + if (response.status >= 500 && response.status < 600) { | |
239 | 252 | vm.internalError = true; |
240 | 253 | } |
241 | 254 | }); |
242 | 255 | |
243 | 256 | // ALWAYS |
244 | - promiseRequest.finally(function(){ | |
257 | + promiseRequest.finally(function() { | |
245 | 258 | vm.loadingSubmitRecover = false; |
246 | 259 | }); |
247 | 260 | }; |
... | ... | @@ -266,15 +279,15 @@ |
266 | 279 | |
267 | 280 | // Feedback para usuário já ativo na plataforma |
268 | 281 | var user = response.data.users[0]; |
269 | - if ( user && (user.activated === true) ) { | |
282 | + if (user && (user.activated === true)) { | |
270 | 283 | vm.resendConfirmationSuccessTitle = 'Usuário já está ativo!'; |
271 | 284 | vm.resendConfirmationSuccessMessage = 'O e-mail informado já foi confirmado.'; |
272 | - }else{ | |
285 | + }else { | |
273 | 286 | vm.resendConfirmationSuccessTitle = 'Pronto!'; |
274 | 287 | vm.resendConfirmationSuccessMessage = 'Em instantes você receberá em seu e-mail um link para confirmar o seu cadastro.'; |
275 | 288 | } |
276 | 289 | |
277 | - }, function(response){ | |
290 | + }, function(response) { | |
278 | 291 | vm.$log.debug('resendConfirmation error.response', response); |
279 | 292 | |
280 | 293 | vm.resendConfirmationError = true; |
... | ... | @@ -284,10 +297,10 @@ |
284 | 297 | // if (response.status >= 400 && response.status < 500){} |
285 | 298 | |
286 | 299 | // Server Error |
287 | - if (response.status >= 500 && response.status < 600){ | |
300 | + if (response.status >= 500 && response.status < 600) { | |
288 | 301 | vm.internalError = true; |
289 | 302 | } |
290 | - }).catch(function(error){ | |
303 | + }).catch(function(error) { | |
291 | 304 | vm.$log.debug('resendConfirmation catch.error', error); |
292 | 305 | }); |
293 | 306 | }; |
... | ... | @@ -370,7 +383,7 @@ |
370 | 383 | vm.$window.oauthClientAction(url); |
371 | 384 | }; |
372 | 385 | |
373 | - function getCaptchaValFromEvent($event){ | |
386 | + function getCaptchaValFromEvent($event) { | |
374 | 387 | return angular.element($event.target).find('[name="txtToken_captcha_serpro_gov_br"]').val(); |
375 | 388 | } |
376 | 389 | })(); | ... | ... |
src/app/pages/programas/programa.controller.js
src/app/pages/propostas/propostas.controller.js
... | ... | @@ -172,7 +172,7 @@ |
172 | 172 | vm.DialogaService.searchProposals(params, function(data){ |
173 | 173 | vm.total_proposals = parseInt(data._obj.headers('total')); |
174 | 174 | vm.filtredProposals = data.articles; |
175 | - console.log("FiltredProposals",vm.filtredProposals); | |
175 | + | |
176 | 176 | vm.loadingProposals = false; |
177 | 177 | }, function (error) { |
178 | 178 | vm.error = error; | ... | ... |
src/app/pages/ranking/ranking.controller.js
src/app/pages/respostas/respostas.controller.js
... | ... | @@ -200,8 +200,7 @@ |
200 | 200 | |
201 | 201 | vm.total_proposals = parseInt(data._obj.headers('total')); |
202 | 202 | vm.filtredProposals = data.articles; |
203 | - console.log("vm.filtredProposals",vm.filtredProposals); | |
204 | - | |
203 | + | |
205 | 204 | vm.loadingProposals = false; |
206 | 205 | }, function (error) { |
207 | 206 | vm.error = error; | ... | ... |
src/index.html
... | ... | @@ -10,9 +10,9 @@ |
10 | 10 | <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> |
11 | 11 | |
12 | 12 | <!-- OpenGraph --> |
13 | - <meta name="og:title" content="Dialoga Brasil"> | |
14 | - <meta name="og:description" content="O País fica melhor quando você participa"> | |
15 | - <meta name="og:image" content="http://dialoga.gov.br/images/logo.png"> | |
13 | + <meta property="og:title" content="Dialoga Brasil"> | |
14 | + <meta property="og:description" content="O País fica melhor quando você participa"> | |
15 | + <meta property="og:image" content="http://dialoga.gov.br/images/logo.png"> | |
16 | 16 | |
17 | 17 | <!-- build:css({.tmp/serve,src}) styles/vendor.css --> |
18 | 18 | <!-- bower:css --> | ... | ... |