qa: new button to speed up +1

This commit is contained in:
nemunaire 2020-09-09 21:15:58 +02:00
parent 7c51ce7c4f
commit 70afa61814
2 changed files with 20 additions and 0 deletions

View File

@ -395,6 +395,22 @@ angular.module("FICApp")
})
}
$scope.thumbUp = function(qid) {
$http({
url: "api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[qid].id + "/comments",
method: "POST",
data: { "content": "+1" },
}).then(function(response) {
$http({
url: "api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments"
}).then(function(response) {
$scope.queries_comments = response.data
})
}, function(response) {
$scope.addToast('danger', 'An error occurs when trying to respond to QA entry:', response.data.errmsg);
})
}
$scope.updateQA = function(qid) {
$scope.newQuery = $scope.queries[$scope.query_selected]
}

View File

@ -38,11 +38,15 @@
<th ng-repeat="field in fields">
{{ field }}
</th>
<th></th>
</tr>
</thead>
<tbody ng-if="queries.length">
<tr ng-repeat="(qid, q) in queries" ng-click="showComments(qid)" ng-class="{'bg-warning': qid == query_selected}">
<td ng-repeat="field in fields" ng-bind-html="q[field]"></td>
<td>
<button type="button" ng-click="thumbUp(qid)" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span></button>
</td>
</tr>
</tbody>
<tbody ng-if="!queries.length">