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 678 $scope.closeProposalModal();
679 679 var popup = $ionicPopup.alert({ title: 'Criar proposta', template: 'Proposta criada com sucesso!' });
680 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 681 var proposal = {
688 682 id: resp.data.article.id,
689 683 title: data.title,
690 684 body: data.description,
691   - topic: topic,
  685 + topic: null,
692 686 categories: [data.city, data.state],
693 687 author: { name: $scope.profile.name, id: $scope.profile.id }
694 688 };
... ... @@ -1237,6 +1231,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1237 1231 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/vote'), jQuery.param({ private_token: $scope.token }), config)
1238 1232 .then(function(resp) {
1239 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 1235 $scope.voted.push(proposal);
1241 1236 $scope.votedIds.push(proposal.id);
1242 1237 $scope.loading = false;
... ... @@ -1311,11 +1306,12 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1311 1306  
1312 1307 $http.post(ConfJuvAppUtils.pathTo('articles/' + proposal.id + '/follow'), jQuery.param({ private_token: $scope.token }), config)
1313 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 1310 $scope.following.push(proposal);
1316 1311 $scope.followingIds.push(proposal.id);
1317 1312 $scope.loading = false;
1318 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 1315 }, function(err) {
1320 1316 $ionicPopup.alert({ title: 'Seguir proposta', template: 'Erro ao seguir proposta.' });
1321 1317 $scope.loading = false;
... ...