Commit ebde1e5ac530880c30ce8291f0d6a14f37b4685c

Authored by Caio Almeida
1 parent 3dfefc12

Ticket #62: Minimum length for proposal text

ConfJuvApp/www/html/_create_proposal.html
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <span class="free-conference-label">De conferência livre?</span> 26 <span class="free-conference-label">De conferência livre?</span>
27 27
28 <p class="text-center" style="clear: both;"> 28 <p class="text-center" style="clear: both;">
29 - <button onclick="this.innerHTML='Criando...'" ripple class="button" type="submit" id="save-proposal">Salvar</button> 29 + <button class="button" type="submit" id="save-proposal">Criar</button>
30 </p> 30 </p>
31 </form> 31 </form>
32 </ion-content> 32 </ion-content>
ConfJuvApp/www/js/controllers.js
@@ -500,7 +500,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -500,7 +500,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
500 else { 500 else {
501 // Initiate the modal 501 // Initiate the modal
502 $scope.loadStates(); 502 $scope.loadStates();
503 - $ionicModal.fromTemplateUrl('html/_create_proposal.html?11', { 503 + $ionicModal.fromTemplateUrl('html/_create_proposal.html?12', {
504 scope: $scope, 504 scope: $scope,
505 animation: 'slide-in-up' 505 animation: 'slide-in-up'
506 }).then(function(modal) { 506 }).then(function(modal) {
@@ -529,15 +529,23 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -529,15 +529,23 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
529 $scope.openCreateProposalForm(); 529 $scope.openCreateProposalForm();
530 }); 530 });
531 } 531 }
532 - else if (data.description.length > 1000) { 532 + else if (data.description.length > 2000) {
533 $scope.closeProposalModal(); 533 $scope.closeProposalModal();
534 - var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'A descrição deve ter no máximo 1000 caracteres!' }); 534 + var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'A descrição deve ter no máximo 2000 caracteres!' });
  535 + popup.then(function() {
  536 + $scope.openCreateProposalForm();
  537 + });
  538 + }
  539 + else if (data.description.length < 140) {
  540 + $scope.closeProposalModal();
  541 + var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'A descrição deve ter no mínimo 140 caracteres! (a sua contém ' + data.description.length + ')'});
535 popup.then(function() { 542 popup.then(function() {
536 $scope.openCreateProposalForm(); 543 $scope.openCreateProposalForm();
537 }); 544 });
538 } 545 }
539 else { 546 else {
540 $scope.loading = true; 547 $scope.loading = true;
  548 + document.getElementById('save-proposal').innerHTML = 'Criando...';
541 549
542 var config = { 550 var config = {
543 headers: { 551 headers: {
@@ -579,7 +587,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -579,7 +587,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
579 $scope.proposalsByTopic[data.topic_id.id].push(proposal); 587 $scope.proposalsByTopic[data.topic_id.id].push(proposal);
580 $scope.loading = false; 588 $scope.loading = false;
581 $scope.data.title = $scope.data.description = $scope.data.topic_id = null; 589 $scope.data.title = $scope.data.description = $scope.data.topic_id = null;
582 - document.getElementById('save-proposal').innerHTML = 'Salvar'; 590 + document.getElementById('save-proposal').innerHTML = 'Criar';
583 }); 591 });
584 }, function(err) { 592 }, function(err) {
585 $scope.closeProposalModal(); 593 $scope.closeProposalModal();