Added fixes for party group plans (#8366)

This commit is contained in:
Keith Holliday
2017-01-05 16:52:05 -06:00
committed by GitHub
parent bc6102551d
commit 9abcfe8614
4 changed files with 40 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','Challenges','$state','$compile','Analytics','Quests','Social', 'Achievement',
function($rootScope, $scope, Groups, Chat, User, Challenges, $state, $compile, Analytics, Quests, Social, Achievement) {
habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','Challenges','$state','$compile','Analytics','Quests','Social', 'Achievement', 'Members', 'Tasks',
function($rootScope, $scope, Groups, Chat, User, Challenges, $state, $compile, Analytics, Quests, Social, Achievement, Members, Tasks) {
var PARTY_LOADING_MESSAGES = 4;
@@ -22,7 +22,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
function handlePartyResponse (group) {
// Assign and not replace so that all the references get the modifications
_.assign($rootScope.party, group);
$scope.group = $rootScope.party;
$scope.obj = $scope.group = $rootScope.party;
$scope.group.loadingParty = false;
checkForNotifications();
if ($state.is('options.social.party')) {
@@ -44,7 +44,40 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
}
}, 100);
}
Chat.markChatSeen($scope.group._id);
Chat.markChatSeen($scope.group._id)
.then (function () {
return Members.getGroupMembers($scope.group._id);
})
.then(function (response) {
$scope.group.members = response.data.data;
return Members.getGroupInvites($scope.group._id);
})
.then(function (response) {
$scope.group.invites = response.data.data;
return Challenges.getGroupChallenges($scope.group._id);
})
.then(function (response) {
$scope.group.challenges = response.data.data;
return Tasks.getGroupTasks($scope.group._id);
})
.then(function (response) {
var tasks = response.data.data;
tasks.forEach(function (element, index, array) {
if (!$scope.group[element.type + 's']) $scope.group[element.type + 's'] = [];
$scope.group[element.type + 's'].unshift(element);
});
$scope.group.approvals = [];
if (User.user._id === $scope.group.leader._id) {
return Tasks.getGroupApprovals($scope.group._id);
}
})
.then(function (response) {
if (response) $scope.group.approvals = response.data.data;
});
}
}

View File

@@ -10,7 +10,7 @@ div(ng-if='::task.type!="reward"')
input.form-control(ng-model='task._edit.alias' type='text' placeholder=env.t('taskAliasPlaceholder'))
fieldset.option-group.advanced-option(ng-show="task._edit._advanced")
group-tasks-actions(ng-if="obj.type == 'guild'", task='task', group='obj')
group-tasks-actions(ng-if="obj.purchased && obj.purchased.plan && obj.purchased.plan.customerId", task='task', group='obj')
div(ng-show='task._edit._advanced')
div(ng-if='::task.type == "daily"')

View File

@@ -6,7 +6,7 @@ include ./task_view/mixins
script(id='templates/habitrpg-tasks.html', type="text/ng-template")
.tasks-lists.container-fluid
.row
.col-sm-6(ng-repeat='list in lists', ng-class='::{ "rewards-module": list.type==="reward", "new-row-md": list.type==="todo", "col-md-3": !obj.type }')
.col-sm-3(ng-repeat='list in lists', ng-class='::{ "rewards-module": list.type==="reward", "new-row-md": list.type==="todo" }')
.task-column(class='{{::list.type}}s')
include ./task_view/graph

View File

@@ -20,7 +20,7 @@
// Icons only available if you own the tasks (aka, hidden from challenge stats)
span(ng-if='!obj._locked')
group-task-meta-actions(ng-if="obj.type == 'guild'", task='task', group='obj')
group-task-meta-actions(ng-if="obj.purchased && obj.purchased.plan && obj.purchased.plan.customerId", task='task', group='obj')
a(ng-click='pushTask(task,$index,"top")', tooltip=env.t('pushTaskToTop'), ng-class="{'push-down': ctrlPressed}")
span(ng-hide="ctrlPressed").glyphicon.glyphicon-open