mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Merge branch 'develop' into TheHollidayInn-challenges-owner-filter
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -126,19 +125,27 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
$scope.challenges = Challenges.Challenge.query();
|
||||
User.log({});
|
||||
}
|
||||
$scope.cancelClosing = function() {
|
||||
$scope.cancelClosing = function(challenge) {
|
||||
$scope.popoverEl.popover('destroy');
|
||||
$scope.popoverEl = undefined;
|
||||
$scope.closingChal = undefined;
|
||||
challenge.winner = undefined;
|
||||
}
|
||||
$scope["delete"] = function(challenge) {
|
||||
if (!confirm(window.env.t('sureDelCha'))) return;
|
||||
var warningMsg;
|
||||
if(challenge.group._id == 'habitrpg') {
|
||||
warningMsg = window.env.t('sureDelChaTavern');
|
||||
} else {
|
||||
warningMsg = window.env.t('sureDelCha');
|
||||
}
|
||||
if (!confirm(warningMsg)) return;
|
||||
challenge.$delete(function(){
|
||||
$scope.popoverEl.popover('destroy');
|
||||
backToChallenges();
|
||||
});
|
||||
};
|
||||
$scope.selectWinner = function(challenge) {
|
||||
if (!challenge.winner) return;
|
||||
if (!confirm(window.env.t('youSure'))) return;
|
||||
challenge.$close({uid:challenge.winner}, function(){
|
||||
$scope.popoverEl.popover('destroy');
|
||||
|
||||
Reference in New Issue
Block a user