Commit df97962822454bdf24ebbc1e3205642160c1434c
1 parent
8c107e10
Exists in
master
and in
6 other branches
Fix pageDuvidas. Add contact form.
Showing
5 changed files
with
108 additions
and
46 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; |
... | ... | @@ -211,6 +212,13 @@ |
211 | 212 | return UtilService.post(url, encodedParams); |
212 | 213 | } |
213 | 214 | |
215 | + function sendContactForm (community_id, data){ | |
216 | + var url = service.apiCommunities + community_id + '/contact' | |
217 | + var encodedParams = angular.element.param(data); | |
218 | + | |
219 | + return UtilService.post(url, encodedParams); | |
220 | + } | |
221 | + | |
214 | 222 | function searchTopics (params, cbSuccess, cbError) { |
215 | 223 | // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Topic&query=cisternas |
216 | 224 | 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/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 | + | |
64 | + }, function(response){ | |
65 | + vm.$log.debug('sendContactForm error', response); | |
66 | + | |
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,50 +31,49 @@ |
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> | |
41 | + <form role="form" name="contactForm" ng-submit="pageDuvidas.submitContactForm($event, contactForm)" novalidate> | |
42 | 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> | |
43 | + <label for="inputSubject">Assunto*</label> | |
44 | + <select id="inputSubject" name="inputSubject" class="form-control input-lg dark-input" ng-model="data.inputSubject" required> | |
45 | + <option value="">-- Selecione um Assunto --</option> | |
46 | + <option value="Dúvidas">Dúvidas</option> | |
47 | + <option value="Outro">Outro</option> | |
50 | 48 | </select> |
51 | - <validation-messages field="duvidasForm.inputAssunto"/> | |
49 | + <validation-messages field="contactForm.inputSubject"/> | |
52 | 50 | </div> |
53 | 51 | <div class="row"> |
54 | 52 | <div class="col-sm-6"> |
55 | 53 | <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"/> | |
54 | + <label for="inputName">Nome*</label> | |
55 | + <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> | |
56 | + <validation-messages field="contactForm.inputName"/> | |
59 | 57 | </div> |
60 | 58 | </div> |
61 | 59 | <div class="col-sm-6"> |
62 | 60 | <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"/> | |
61 | + <label for="inputEmail">E-mail*</label> | |
62 | + <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> | |
63 | + <validation-messages field="contactForm.inputEmail"/> | |
66 | 64 | </div> |
67 | 65 | </div> |
68 | 66 | </div> |
69 | 67 | <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"/> | |
68 | + <label for="inputMessage">Mensagem*</label> | |
69 | + <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> | |
70 | + <validation-messages field="contactForm.inputMessage"/> | |
73 | 71 | </div> |
74 | 72 | <span class="pull-left">*Dados obrigatórios</span> |
75 | 73 | <div class="row"> |
76 | 74 | <div class="col-sm-4 form-group pull-right"> |
77 | - <button class="btn btn-lg btn-block btn-submit" type="submit">Enviar Mensagem</button> | |
75 | + <button class="btn btn-lg btn-block btn-submit" type="submit">Enviar Mensagem</button> | |
76 | + <span ng-show="vm.sendingContactForm">Enviando...</span> | |
78 | 77 | </div> |
79 | 78 | </div> |
80 | 79 | </form> | ... | ... |
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 { | ... | ... |