mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
* Add task indication to Group Plans Tasks Awaiting Approval page * Render markdown tasks on Group Plans Tasks Awaiting Approval page * Fix panel code- fixes formatting issue of Approve button on Group Plans Tasks Awaiting Approval page
24 lines
838 B
JavaScript
24 lines
838 B
JavaScript
habitrpg.controller('GroupApprovalsCtrl', ['$scope', 'Tasks',
|
|
function ($scope, Tasks) {
|
|
$scope.approve = function (taskId, userId, username, $index) {
|
|
if (!confirm(env.t('confirmTaskApproval', {username: username}))) return;
|
|
Tasks.approve(taskId, userId)
|
|
.then(function (response) {
|
|
$scope.group.approvals.splice($index, 1);
|
|
});
|
|
};
|
|
|
|
$scope.approvalTitle = function (approval) {
|
|
return env.t('approvalTitle', {type: approval.type, text: approval.text, userName: approval.userId.profile.name});
|
|
};
|
|
|
|
$scope.refreshApprovals = function () {
|
|
$scope.loading = true;
|
|
Tasks.getGroupApprovals($scope.group._id)
|
|
.then(function (response) {
|
|
if (response) $scope.group.approvals = response.data.data;
|
|
$scope.loading = false;
|
|
});
|
|
};
|
|
}]);
|