mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Added filter by owner for challenges
This commit is contained in:
@@ -46,5 +46,9 @@
|
|||||||
"removeTasks": "Remove Tasks",
|
"removeTasks": "Remove Tasks",
|
||||||
"keepTasks": "Keep Tasks",
|
"keepTasks": "Keep Tasks",
|
||||||
"closeCha": "Close challenge and...",
|
"closeCha": "Close challenge and...",
|
||||||
"leaveCha": "Leave challenge and..."
|
"leaveCha": "Leave challenge and...",
|
||||||
|
"challengedOwnedFilterHeader": "Ownership",
|
||||||
|
"challengedOwnedFilter": "Owned",
|
||||||
|
"challengedNotOwnedFilter": "Not Owned",
|
||||||
|
"challengedEitherOwnedFilter": "Either"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,6 +256,14 @@ 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._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 :
|
return (!$scope.search) ? true :
|
||||||
($scope.search.group[chal.group._id] &&
|
($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));
|
||||||
|
|||||||
@@ -91,6 +91,19 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
|
|||||||
label
|
label
|
||||||
input(type='radio', name='search-participation-radio', ng-click='search._isMember = undefined', checked='checked')
|
input(type='radio', name='search-participation-radio', ng-click='search._isMember = undefined', checked='checked')
|
||||||
=env.t('either')
|
=env.t('either')
|
||||||
|
h4=env.t('challengedOwnedFilterHeader')
|
||||||
|
.radio
|
||||||
|
label
|
||||||
|
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = true')
|
||||||
|
=env.t('challengedOwnedFilter')
|
||||||
|
.radio
|
||||||
|
label
|
||||||
|
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = false')
|
||||||
|
=env.t('challengedNotOwnedFilter')
|
||||||
|
.radio
|
||||||
|
label
|
||||||
|
input(type='radio', name='search-participation-radio', ng-click='search._isOwner = undefined')
|
||||||
|
=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}')
|
||||||
| Back to all challenges
|
| Back to all challenges
|
||||||
|
|||||||
Reference in New Issue
Block a user