mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Added param to filter challenges by guild when a challenge is first clicked from guild
This commit is contained in:
@@ -148,6 +148,7 @@ window.habitrpg = angular.module('habitrpg',
|
|||||||
// Options > Social > Challenges
|
// Options > Social > Challenges
|
||||||
.state('options.social.challenges', {
|
.state('options.social.challenges', {
|
||||||
url: "/challenges",
|
url: "/challenges",
|
||||||
|
params: { groupIdFilter: null },
|
||||||
controller: 'ChallengesCtrl',
|
controller: 'ChallengesCtrl',
|
||||||
templateUrl: "partials/options.social.challenges.html"
|
templateUrl: "partials/options.social.challenges.html"
|
||||||
})
|
})
|
||||||
@@ -156,7 +157,6 @@ window.habitrpg = angular.module('habitrpg',
|
|||||||
templateUrl: 'partials/options.social.challenges.detail.html',
|
templateUrl: 'partials/options.social.challenges.detail.html',
|
||||||
controller: ['$scope', 'Challenges', '$stateParams',
|
controller: ['$scope', 'Challenges', '$stateParams',
|
||||||
function($scope, Challenges, $stateParams){
|
function($scope, Challenges, $stateParams){
|
||||||
|
|
||||||
$scope.obj = $scope.challenge = Challenges.Challenge.get({cid:$stateParams.cid}, function(){
|
$scope.obj = $scope.challenge = Challenges.Challenge.get({cid:$stateParams.cid}, function(){
|
||||||
$scope.challenge._locked = true;
|
$scope.challenge._locked = true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||||||
// challenge
|
// challenge
|
||||||
$scope.cid = $state.params.cid;
|
$scope.cid = $state.params.cid;
|
||||||
|
|
||||||
|
$scope.groupIdFilter = $stateParams.groupIdFilter;
|
||||||
|
|
||||||
_getChallenges();
|
_getChallenges();
|
||||||
|
|
||||||
// FIXME $scope.challenges needs to be resolved first (see app.js)
|
// FIXME $scope.challenges needs to be resolved first (see app.js)
|
||||||
@@ -381,6 +383,11 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||||||
_isMember: "either",
|
_isMember: "either",
|
||||||
_isOwner: "either"
|
_isOwner: "either"
|
||||||
};
|
};
|
||||||
|
//If we game from a group, then override the filter to that group
|
||||||
|
if ($scope.groupIdFilter) {
|
||||||
|
$scope.search.group = {};
|
||||||
|
$scope.search.group[$scope.groupIdFilter] = true ;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
tr(ng-repeat='challenge in group.challenges')
|
tr(ng-repeat='challenge in group.challenges')
|
||||||
td
|
td
|
||||||
a(ui-sref='options.social.challenges.detail({cid:challenge._id})') {{challenge.name}}
|
a(ui-sref='options.social.challenges.detail({cid:challenge._id, groupIdFilter: group._id})') {{challenge.name}}
|
||||||
div(ng-if='group.challenges.length == 0')
|
div(ng-if='group.challenges.length == 0')
|
||||||
p
|
p
|
||||||
|
|
|
|
||||||
|
|||||||
Reference in New Issue
Block a user