Commit 2bf2b9456ad70df7f98a6927e354f9e42c7d2b6a
Exists in
master
and in
6 other branches
Merge branch 'master' into staging
Showing
6 changed files
with
159 additions
and
63 deletions
Show diff stats
src/app/components/article-service/article.service.js
... | ... | @@ -27,7 +27,8 @@ |
27 | 27 | getEvents: getEvents, |
28 | 28 | subscribeToEvent: subscribeToEvent, |
29 | 29 | searchTopics: searchTopics, |
30 | - searchProposals: searchProposals | |
30 | + searchProposals: searchProposals, | |
31 | + sendContactForm: sendContactForm | |
31 | 32 | }; |
32 | 33 | |
33 | 34 | return service; |
... | ... | @@ -165,8 +166,16 @@ |
165 | 166 | |
166 | 167 | function voteProposal (proposal_id, params){ |
167 | 168 | var url = service.apiArticles + proposal_id + '/vote'; |
169 | + | |
170 | + var private_token = null; | |
171 | + if($rootScope.currentUser && $rootScope.currentUser.private_token){ | |
172 | + private_token = $rootScope.currentUser.private_token; | |
173 | + }else{ | |
174 | + private_token = $rootScope.temporaryToken; | |
175 | + } | |
176 | + | |
168 | 177 | var paramsExtended = angular.extend({ |
169 | - private_token: $rootScope.temporaryToken | |
178 | + private_token: private_token | |
170 | 179 | }, params); |
171 | 180 | |
172 | 181 | var encodedParams = angular.element.param(paramsExtended); |
... | ... | @@ -211,6 +220,18 @@ |
211 | 220 | return UtilService.post(url, encodedParams); |
212 | 221 | } |
213 | 222 | |
223 | + function sendContactForm (community_id, data){ | |
224 | + var url = service.apiCommunities + community_id + '/contact' | |
225 | + var encodedParams = [ | |
226 | + 'contact[name]=' + data.name, | |
227 | + 'contact[email]=' + data.email, | |
228 | + 'contact[subject]=' + data.subject, | |
229 | + 'contact[message]=' + data.message | |
230 | + ].join('&'); | |
231 | + | |
232 | + return UtilService.post(url, encodedParams); | |
233 | + } | |
234 | + | |
214 | 235 | function searchTopics (params, cbSuccess, cbError) { |
215 | 236 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Topic&query=cisternas |
216 | 237 | var url = '/api/v1/search/article'; | ... | ... |
src/app/components/dialoga-service/dialoga.service.js
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | extendedService.getQuestions = getQuestions; |
26 | 26 | extendedService.searchPrograms = searchPrograms; |
27 | 27 | extendedService.searchProposals = searchProposals; |
28 | + extendedService.sendContactForm = sendContactForm; | |
28 | 29 | extendedService.filterProposalsByCategorySlug = filterProposalsByCategorySlug; |
29 | 30 | extendedService.filterProposalsByProgramId = filterProposalsByProgramId; |
30 | 31 | |
... | ... | @@ -232,6 +233,10 @@ |
232 | 233 | ArticleService.searchProposals(params, cbSuccess, cbError); |
233 | 234 | } |
234 | 235 | |
236 | + function sendContactForm (data) { | |
237 | + return ArticleService.sendContactForm(API.communityId, data); | |
238 | + } | |
239 | + | |
235 | 240 | function filterProposalsByCategorySlug (input, categorySlug) { |
236 | 241 | |
237 | 242 | if(!angular.isArray(input)){ | ... | ... |
src/app/components/proposal-box/proposal-box.directive.js
... | ... | @@ -103,7 +103,7 @@ |
103 | 103 | ProposalBoxController.prototype.canVote = function() { |
104 | 104 | var vm = this; |
105 | 105 | |
106 | - return !!vm.$rootScope.temporaryToken; | |
106 | + return !!vm.$rootScope.temporaryToken || (vm.$rootScope.currentUser && !!vm.$rootScope.currentUser.private_token); | |
107 | 107 | }; |
108 | 108 | |
109 | 109 | ProposalBoxController.prototype.submitCaptcha = function($event, captchaForm) { | ... | ... |
src/app/pages/duvidas/duvidas.controller.js
... | ... | @@ -15,28 +15,59 @@ |
15 | 15 | vm.$log = $log; |
16 | 16 | |
17 | 17 | vm.init(); |
18 | + vm.loadData(); | |
18 | 19 | } |
19 | 20 | |
20 | 21 | DuvidasPageController.prototype.init = function () { |
21 | 22 | var vm = this; |
22 | 23 | |
23 | - vm.questions = null; | |
24 | - | |
24 | + vm.questions = [{ | |
25 | + question: 'O que é o Dialoga Brasil?', | |
26 | + answer: 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven`t heard of them accusamus labore sustainable VHS.' | |
27 | + },{ | |
28 | + question: 'O que ... ?', | |
29 | + answer: 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven`t heard of them accusamus labore sustainable VHS.' | |
30 | + } | |
31 | + ]; | |
25 | 32 | vm.loading = true; |
26 | 33 | vm.error = false; |
27 | - | |
28 | - vm.loadData(); | |
29 | 34 | }; |
30 | 35 | |
31 | - | |
32 | 36 | DuvidasPageController.prototype.loadData = function () { |
33 | 37 | var vm = this; |
34 | 38 | |
35 | - vm.DialogaService.getQuestions(function(questions){ | |
36 | - vm.questions = questions; | |
37 | - }, function (error) { | |
38 | - vm.error = error; | |
39 | - vm.$log.error(error); | |
39 | + // vm.DialogaService.getQuestions(function(questions){ | |
40 | + // vm.questions = questions; | |
41 | + // }, function (error) { | |
42 | + // vm.error = error; | |
43 | + // vm.$log.error(error); | |
44 | + // }); | |
45 | + }; | |
46 | + | |
47 | + DuvidasPageController.prototype.submitContactForm = function ($event, contactForm) { | |
48 | + var vm = this; | |
49 | + | |
50 | + vm.$log.debug('submitContactForm contactForm', contactForm); | |
51 | + vm.sendingContactForm = true; | |
52 | + | |
53 | + var data = { | |
54 | + name: contactForm.inputName.$modelValue, | |
55 | + email: contactForm.inputEmail.$modelValue, | |
56 | + subject: contactForm.inputSubject.$modelValue, | |
57 | + message: contactForm.inputMessage.$modelValue | |
58 | + }; | |
59 | + | |
60 | + vm.DialogaService.sendContactForm(data) | |
61 | + .then(function(response){ | |
62 | + // vm.$log.debug('sendContactForm success', response); | |
63 | + vm.successMessage = 'Mensagem enviada com sucesso!'; | |
64 | + }, function(response){ | |
65 | + vm.$log.warn('sendContactForm error', response); | |
66 | + vm.errorMessage = 'Erro ao enviar mensagem. Tente novamente mais tarde.'; | |
67 | + }) | |
68 | + .finally(function(response){ | |
69 | + vm.$log.debug('sendContactForm finally', response); | |
70 | + vm.sendingContactForm = false; | |
40 | 71 | }); |
41 | 72 | }; |
42 | 73 | })(); | ... | ... |
src/app/pages/duvidas/duvidas.html
1 | -<div class="page--duvidas"> | |
1 | +<div class="page--duvidas" role="main"> | |
2 | 2 | <div class="container"> |
3 | 3 | <div class="row"> |
4 | 4 | <div class="col-sm-12"> |
... | ... | @@ -8,22 +8,22 @@ |
8 | 8 | </div> |
9 | 9 | </div> |
10 | 10 | |
11 | - <section role="duvidas" class="section-gray"> | |
11 | + <section class="section-gray"> | |
12 | 12 | <div class="container"> |
13 | 13 | <div class="row"> |
14 | 14 | <div class="panel-group" id="accordion-duvidas" role="tablist" aria-multiselectable="false"> |
15 | - | |
16 | 15 | <div class="panel panel-default"> |
17 | - <div class="panel-heading" role="tab" id="duvida-01" class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion-duvidas" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | |
18 | - <span class="num-duvida">1</span> | |
19 | - <span class="panel-title">O que é o Dialoga Brasil?</span> | |
20 | - <span class="glyphicon glyphicon-chevron-down icon-white pull-right" aria-hidden="true" > | |
21 | - </div> | |
22 | - <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="duvida-01"> | |
23 | - <div class="panel-body"> | |
24 | - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. | |
16 | + <div class="question-item" ng-repeat="question in pageDuvidas.questions"> | |
17 | + <div id="duvida-{{($index + 1)}}" class="panel-heading" role="tab"> | |
18 | + <div class="panel-title" role="button" data-target="#collapse-{{($index + 1)}}" aria-expanded="($index === 0) ? 'true' : 'false'" aria-controls="collapse-{{($index + 1)}}" data-toggle="collapse" data-parent="#accordion-duvidas"> | |
19 | + <span class="num-duvida">{{($index + 1)}}</span> | |
20 | + <span class="panel-title">{{question.question}}</span> | |
21 | + <span class="glyphicon glyphicon-chevron-down icon-white pull-right" aria-hidden="true"></span> | |
25 | 22 | </div> |
26 | 23 | </div> |
24 | + <div id="collapse-{{($index + 1)}}" class="panel-collapse collapse" ng-class="{ 'in': ($index === 0) }" role="tabpanel" aria-expanded="($index === 0) ? 'true' : 'false'" aria-labelledby="duvida-{{($index + 1)}}"> | |
25 | + <div class="panel-body" ng-bind-html="question.question"></div> | |
26 | + </div> | |
27 | 27 | </div> |
28 | 28 | </div> |
29 | 29 | </div> |
... | ... | @@ -31,53 +31,73 @@ |
31 | 31 | </section> |
32 | 32 | |
33 | 33 | |
34 | - <section role="formulario" > | |
34 | + <section> | |
35 | 35 | <div class="container"> |
36 | 36 | <div class="row"> |
37 | 37 | <h2>Tem outras dúvidas ou sugestões?</h2> |
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="row"> |
41 | - <form role="form" name="duvidasForm" ng-submit="" novalidate> | |
42 | - <div class="form-group"> | |
43 | - <label for="inputAssunto">Assunto*</label> | |
44 | - <select id="inputAssunto" name="inputAssunto" class="form-control input-lg dark-input" ng-model="data.inputAssunto" required> | |
45 | - <option value="">---Please select---</option> | |
46 | - <option value="">---Please select---</option> | |
47 | - <option value="">---Please select---</option> | |
48 | - <option value="">---Please select---</option> | |
49 | - <option value="">---Please select---</option> | |
50 | - </select> | |
51 | - <validation-messages field="duvidasForm.inputAssunto"/> | |
52 | - </div> | |
53 | - <div class="row"> | |
54 | - <div class="col-sm-6"> | |
55 | - <div class="form-group"> | |
56 | - <span>Nome*</span> | |
57 | - <input type="text" id="inputNome" name="inputNome" class="form-control input-lg light-input" ng-class="{ 'has-error' : duvidasForm.inputNome.$invalid && duvidasForm.inputNome.$touched }" ng-model="senha" ng-minlength="" ng-maxlength="" required> | |
58 | - <validation-messages field="duvidasForm.inputNome"/> | |
41 | + <div class="col-sm-12"> | |
42 | + <form role="form" name="contactForm" ng-submit="pageDuvidas.submitContactForm($event, contactForm)" novalidate> | |
43 | + <div class="row"> | |
44 | + <div class="col-sm-6"> | |
45 | + <div class="form-group"> | |
46 | + <label for="inputSubject">Assunto*</label> | |
47 | + <select id="inputSubject" name="inputSubject" class="form-control input-lg dark-input" ng-model="data.inputSubject" required> | |
48 | + <option value="">-- Selecione um Assunto --</option> | |
49 | + <option value="Dúvidas">Dúvidas</option> | |
50 | + <option value="Sugestões">Sugestões</option> | |
51 | + <option value="Outro">Outro</option> | |
52 | + </select> | |
53 | + <validation-messages field="contactForm.inputSubject"></validation-messages> | |
54 | + </div> | |
59 | 55 | </div> |
60 | 56 | </div> |
61 | - <div class="col-sm-6"> | |
62 | - <div class="form-group"> | |
63 | - <span>E-mail*</span> | |
64 | - <input type="email" id="inputEmai" name="inputEmai" class="form-control input-lg light-input" ng-class="{ 'has-error' : duvidasForm.inputEmai.$invalid && duvidasForm.inputEmai.$touched }" ng-model="senhaRepetida" ng-minlength="" ng-maxlength="" required> | |
65 | - <validation-messages field="duvidasForm.inputEmai"/> | |
57 | + <div class="row"> | |
58 | + <div class="col-sm-6"> | |
59 | + <div class="form-group"> | |
60 | + <label for="inputName">Nome*</label> | |
61 | + <input type="text" id="inputName" name="inputName" class="form-control input-lg light-input" ng-class="{ 'has-error' : contactForm.inputName.$invalid && contactForm.inputName.$touched }" ng-model="inputName" ng-minlength="" ng-maxlength="" required> | |
62 | + <validation-messages field="contactForm.inputName"></validation-messages> | |
63 | + </div> | |
64 | + </div> | |
65 | + <div class="col-sm-6"> | |
66 | + <div class="form-group"> | |
67 | + <label for="inputEmail">E-mail*</label> | |
68 | + <input type="email" id="inputEmail" name="inputEmail" class="form-control input-lg light-input" ng-class="{ 'has-error' : contactForm.inputEmail.$invalid && contactForm.inputEmail.$touched }" ng-model="inputEmail" ng-minlength="" ng-maxlength="" required> | |
69 | + <validation-messages field="contactForm.inputEmail"></validation-messages> | |
70 | + </div> | |
66 | 71 | </div> |
67 | 72 | </div> |
68 | - </div> | |
69 | - <div class="form-group"> | |
70 | - <span>Mensagem*</span> | |
71 | - <textarea id="mensagem" name="mensagem" class="mensagem-text-area form-control light-input" ng-class="{ 'has-error' : duvidasForm.mensagem.$invalid && duvidasForm.mensagem.$touched }" ng-model="mensagem" required ></textarea> | |
72 | - <validation-messages field="duvidasForm.mensagem"/> | |
73 | - </div> | |
74 | - <span class="pull-left">*Dados obrigatórios</span> | |
75 | - <div class="row"> | |
76 | - <div class="col-sm-4 form-group pull-right"> | |
73 | + <div class="form-group"> | |
74 | + <label for="inputMessage">Mensagem*</label> | |
75 | + <textarea id="inputMessage" name="inputMessage" class="mensagem-text-area form-control light-input" ng-class="{ 'has-error' : contactForm.inputMessage.$invalid && contactForm.inputMessage.$touched }" ng-model="inputMessage" required ></textarea> | |
76 | + <validation-messages field="contactForm.inputMessage"></validation-messages> | |
77 | + </div> | |
78 | + <span class="pull-left">*Dados obrigatórios</span> | |
79 | + <div class="row"> | |
80 | + <div class="col-sm-4 form-group pull-right"> | |
81 | + <div class="row" ng-show="pageDuvidas.sendingContactForm"> | |
82 | + <div class="col-sm-12"> | |
83 | + <div class="alert alert-info" role="alert">Enviando formulário...</div> | |
84 | + </div> | |
85 | + </div> | |
86 | + <div class="row" ng-if="pageDuvidas.successMessage"> | |
87 | + <div class="col-sm-12"> | |
88 | + <div class="alert alert-success" role="alert">{{pageDuvidas.successMessage}}</div> | |
89 | + </div> | |
90 | + </div> | |
91 | + <div class="row" ng-if="pageDuvidas.errorMessage"> | |
92 | + <div class="col-sm-12"> | |
93 | + <div class="alert alert-danger" role="alert">{{pageDuvidas.errorMessage}}</div> | |
94 | + </div> | |
95 | + </div> | |
77 | 96 | <button class="btn btn-lg btn-block btn-submit" type="submit">Enviar Mensagem</button> |
97 | + </div> | |
78 | 98 | </div> |
79 | - </div> | |
80 | - </form> | |
99 | + </form> | |
100 | + </div> | |
81 | 101 | </div> |
82 | 102 | </div> |
83 | 103 | </section> | ... | ... |
src/app/pages/duvidas/duvidas.scss
... | ... | @@ -5,18 +5,37 @@ |
5 | 5 | background-color: $defaultblue; |
6 | 6 | display: inline-block; |
7 | 7 | text-align: center; |
8 | + | |
8 | 9 | width: 45px; |
9 | 10 | height: 45px; |
10 | - margin-left: 10px; | |
11 | - padding: 0; | |
11 | + | |
12 | + padding: 10px 0 0 0; | |
13 | + margin: 0 20px 0 15px; | |
14 | + | |
12 | 15 | border-radius: 100%; |
16 | + | |
13 | 17 | font-size: 18px; |
14 | - padding-top: 10px; | |
15 | 18 | } |
16 | 19 | |
17 | - .panel-default > .panel-heading { | |
20 | + .panel-default .panel-heading { | |
18 | 21 | background-color: #fff; |
19 | 22 | border-color: #ddd; |
23 | + font-weight: bold; | |
24 | + | |
25 | + &.active { | |
26 | + background-color: $defaultblue; | |
27 | + color: #fff; | |
28 | + } | |
29 | + } | |
30 | + | |
31 | + .panel-title { | |
32 | + .glyphicon { | |
33 | + padding-top: 15px; | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + .question-item { | |
38 | + border-bottom: 1px solid #ddd; | |
20 | 39 | } |
21 | 40 | |
22 | 41 | .mensagem-text-area { | ... | ... |