From 50bbe5b2f549f057c25761a5601e087610b2676a Mon Sep 17 00:00:00 2001 From: Kevin Gisi Date: Fri, 10 Apr 2015 08:53:00 -0400 Subject: [PATCH 1/2] Fixes #5001 Singleton challenge edit -> detail on save --- website/public/js/controllers/challengesCtrl.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/website/public/js/controllers/challengesCtrl.js b/website/public/js/controllers/challengesCtrl.js index 5f1f23980a..00ce97808a 100644 --- a/website/public/js/controllers/challengesCtrl.js +++ b/website/public/js/controllers/challengesCtrl.js @@ -99,10 +99,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User', $scope.challenges = Challenges.Challenge.query(); User.sync(); } else { - // TODO figure out a more elegant way about this - //challenge._editing = false; - challenge._locked = true; - getChallenges(); + $state.go('options.social.challenges.detail', {cid: _challenge._id}); } }); }; From ad6443c5b88352e8ff64952b73ef7cc5888ccea0 Mon Sep 17 00:00:00 2001 From: Kevin Gisi Date: Sun, 12 Apr 2015 00:04:49 -0400 Subject: [PATCH 2/2] Ensure reload on transition from challeng edit -> detail --- website/public/js/controllers/challengesCtrl.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/website/public/js/controllers/challengesCtrl.js b/website/public/js/controllers/challengesCtrl.js index 00ce97808a..24985e85ac 100644 --- a/website/public/js/controllers/challengesCtrl.js +++ b/website/public/js/controllers/challengesCtrl.js @@ -94,12 +94,14 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User', challenge.$save(function(_challenge){ if (isNew) { Notification.text(window.env.t('challengeCreated')); - $state.go('options.social.challenges.detail', {cid: _challenge._id}); - $scope.discard(); - $scope.challenges = Challenges.Challenge.query(); + $state.transitionTo('options.social.challenges.detail', {cid: challenge._id}, { + reload: true, inherit: false, notify: true + }); User.sync(); } else { - $state.go('options.social.challenges.detail', {cid: _challenge._id}); + $state.transitionTo('options.social.challenges.detail', {cid: challenge._id}, { + reload: true, inherit: false, notify: true + }); } }); };