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 26 <span class="free-conference-label">De conferência livre?</span>
27 27  
28 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 30 </p>
31 31 </form>
32 32 </ion-content>
... ...
ConfJuvApp/www/js/controllers.js
... ... @@ -500,7 +500,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
500 500 else {
501 501 // Initiate the modal
502 502 $scope.loadStates();
503   - $ionicModal.fromTemplateUrl('html/_create_proposal.html?11', {
  503 + $ionicModal.fromTemplateUrl('html/_create_proposal.html?12', {
504 504 scope: $scope,
505 505 animation: 'slide-in-up'
506 506 }).then(function(modal) {
... ... @@ -529,15 +529,23 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
529 529 $scope.openCreateProposalForm();
530 530 });
531 531 }
532   - else if (data.description.length > 1000) {
  532 + else if (data.description.length > 2000) {
533 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 542 popup.then(function() {
536 543 $scope.openCreateProposalForm();
537 544 });
538 545 }
539 546 else {
540 547 $scope.loading = true;
  548 + document.getElementById('save-proposal').innerHTML = 'Criando...';
541 549  
542 550 var config = {
543 551 headers: {
... ... @@ -579,7 +587,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
579 587 $scope.proposalsByTopic[data.topic_id.id].push(proposal);
580 588 $scope.loading = false;
581 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 592 }, function(err) {
585 593 $scope.closeProposalModal();
... ...