Files
habitica/website/client-old/js/components/groupApprovals/groupApprovalsController.js
Joe P 06c53677f6 Group Approvals Formatting - Fix #8677 (#8784)
* 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
2017-07-01 09:33:24 -07:00

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;
});
};
}]);