Merge pull request #5008 from gisikw/fix-singleton-challenge-edit

Singleton challenge edit -> detail on save -- Fixes #5001
This commit is contained in:
Blade Barringer 2015-06-09 08:41:00 -05:00
commit b1e8f16639

View file

@ -94,15 +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 {
// TODO figure out a more elegant way about this
//challenge._editing = false;
challenge._locked = true;
getChallenges();
$state.transitionTo('options.social.challenges.detail', {cid: challenge._id}, {
reload: true, inherit: false, notify: true
});
}
});
};