mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +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
|
// TODO probably better to use $watch above, to avoid this being calculated on every digest cycle
|
||||||
$scope.filterChallenges = function(chal){
|
$scope.filterChallenges = function(chal){
|
||||||
|
|
||||||
//Filter challenges that are owned by the user
|
if (!$scope.search) return true;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (!$scope.search) ? true :
|
//Filter challenges that are owned by the user
|
||||||
($scope.search.group[chal.group._id] &&
|
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));
|
(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){
|
$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')
|
h4=env.t('challengedOwnedFilterHeader')
|
||||||
.radio
|
.radio
|
||||||
label
|
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')
|
=env.t('challengedOwnedFilter')
|
||||||
.radio
|
.radio
|
||||||
label
|
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')
|
=env.t('challengedNotOwnedFilter')
|
||||||
.radio
|
.radio
|
||||||
label
|
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')
|
=env.t('challengedEitherOwnedFilter')
|
||||||
.col-md-10
|
.col-md-10
|
||||||
a.btn.btn-info#back-to-challenges(ng-show="cid", ui-sref='options.social.challenges', ui-sref-opts='{reload: true}')
|
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