mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Set default ownership filter to either and fixed editing bug
This commit is contained in:
@@ -257,16 +257,20 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
// TODO probably better to use $watch above, to avoid this being calculated on every digest cycle
|
||||
$scope.filterChallenges = function(chal){
|
||||
|
||||
//Filter challenges that are owned by the user
|
||||
if ($scope.search._isOwner == true) {
|
||||
return (chal.leader._id == User.user.id);
|
||||
} else if ($scope.search._isOwner == false) {
|
||||
return (chal.leader._id != User.user.id);
|
||||
}
|
||||
if (!$scope.search) return true;
|
||||
|
||||
return (!$scope.search) ? true :
|
||||
($scope.search.group[chal.group._id] &&
|
||||
//Filter challenges that are owned by the user
|
||||
if ($scope.search._isOwner == true) {
|
||||
return (chal.leader._id == User.user.id);
|
||||
} else if ($scope.search._isOwner == false) {
|
||||
return (chal.leader._id != User.user.id);
|
||||
} else {
|
||||
return ($scope.search.group[chal.group._id] &&
|
||||
(typeof $scope.search._isMember == 'undefined' || $scope.search._isMember == chal._isMember));
|
||||
}
|
||||
|
||||
//By default we should return true to show all challenges
|
||||
return true;
|
||||
}
|
||||
|
||||
$scope.$watch('newChallenge.group', function(gid){
|
||||
|
||||
@@ -94,15 +94,15 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
|
||||
h4=env.t('challengedOwnedFilterHeader')
|
||||
.radio
|
||||
label
|
||||
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = true')
|
||||
input(type='radio', name='search-owner-radio', ng-click='search._isOwner = true')
|
||||
=env.t('challengedOwnedFilter')
|
||||
.radio
|
||||
label
|
||||
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = false')
|
||||
input(type='radio', name='search-owner-radio', ng-click='search._isOwner = false')
|
||||
=env.t('challengedNotOwnedFilter')
|
||||
.radio
|
||||
label
|
||||
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = undefined')
|
||||
input(type='radio', name='search-owner-radio', ng-click='search._isOwner = undefined', checked='checked')
|
||||
=env.t('challengedEitherOwnedFilter')
|
||||
.col-md-10
|
||||
a.btn.btn-info#back-to-challenges(ng-show="cid", ui-sref='options.social.challenges', ui-sref-opts='{reload: true}')
|
||||
|
||||
Reference in New Issue
Block a user