Commit 69b4090923d8575e4dc0e6725d42a247f81e6e00

Authored by Caio Almeida
1 parent fbcac03e

Ticket #139: Fix reloading of own, followed and voted proposals

Showing 1 changed file with 4 additions and 8 deletions   Show diff stats
www/js/controllers.js
@@ -678,17 +678,11 @@ angular.module('confjuvapp.controllers', []) @@ -678,17 +678,11 @@ angular.module('confjuvapp.controllers', [])
678 $scope.closeProposalModal(); 678 $scope.closeProposalModal();
679 var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'Proposta criada com sucesso!' }); 679 var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'Proposta criada com sucesso!' });
680 popup.then(function() { 680 popup.then(function() {
681 - var topic = null;  
682 - for (var i = 0; i < $scope.topics.length; i++) {  
683 - if (data.topic_id.id == $scope.topics[i].id) {  
684 - topic = $scope.topics[i];  
685 - }  
686 - }  
687 var proposal = { 681 var proposal = {
688 id: resp.data.article.id, 682 id: resp.data.article.id,
689 title: data.title, 683 title: data.title,
690 body: data.description, 684 body: data.description,
691 - topic: topic, 685 + topic: null,
692 categories: [data.city, data.state], 686 categories: [data.city, data.state],
693 author: { name: $scope.profile.name, id: $scope.profile.id } 687 author: { name: $scope.profile.name, id: $scope.profile.id }
694 }; 688 };
@@ -1237,6 +1231,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -1237,6 +1231,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1237 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/vote'), jQuery.param({ private_token: $scope.token }), config) 1231 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/vote'), jQuery.param({ private_token: $scope.token }), config)
1238 .then(function(resp) { 1232 .then(function(resp) {
1239 $ionicPopup.alert({ title: 'Apoiar proposta', template: 'Pronto! Proposta apoiada. Você pode acompanhar suas propostas apoiadas no menu lateral esquerdo.' }); 1233 $ionicPopup.alert({ title: 'Apoiar proposta', template: 'Pronto! Proposta apoiada. Você pode acompanhar suas propostas apoiadas no menu lateral esquerdo.' });
  1234 + proposal.topic = null;
1240 $scope.voted.push(proposal); 1235 $scope.voted.push(proposal);
1241 $scope.votedIds.push(proposal.id); 1236 $scope.votedIds.push(proposal.id);
1242 $scope.loading = false; 1237 $scope.loading = false;
@@ -1311,11 +1306,12 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -1311,11 +1306,12 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1311 1306
1312 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/follow'), jQuery.param({ private_token: $scope.token }), config) 1307 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/follow'), jQuery.param({ private_token: $scope.token }), config)
1313 .then(function(resp) { 1308 .then(function(resp) {
1314 - $ionicPopup.alert({ title: 'Seguir proposta', template: 'Pronto! Você pode acompanhar suas propostas seguidas através do menu lateral esquerdo.' }); 1309 + proposal.topic = false;
1315 $scope.following.push(proposal); 1310 $scope.following.push(proposal);
1316 $scope.followingIds.push(proposal.id); 1311 $scope.followingIds.push(proposal.id);
1317 $scope.loading = false; 1312 $scope.loading = false;
1318 $scope.clicked = false; 1313 $scope.clicked = false;
  1314 + $ionicPopup.alert({ title: 'Seguir proposta', template: 'Pronto! Você pode acompanhar suas propostas seguidas através do menu lateral esquerdo.' });
1319 }, function(err) { 1315 }, function(err) {
1320 $ionicPopup.alert({ title: 'Seguir proposta', template: 'Erro ao seguir proposta.' }); 1316 $ionicPopup.alert({ title: 'Seguir proposta', template: 'Erro ao seguir proposta.' });
1321 $scope.loading = false; 1317 $scope.loading = false;