From 70afa61814c652b170a4adc5b14ae74ed2676a71 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 9 Sep 2020 21:15:58 +0200 Subject: [PATCH] qa: new button to speed up +1 --- qa/static/js/qa.js | 16 ++++++++++++++++ qa/static/views/exercice.html | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/qa/static/js/qa.js b/qa/static/js/qa.js index 82432542..d5e658fe 100644 --- a/qa/static/js/qa.js +++ b/qa/static/js/qa.js @@ -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] } diff --git a/qa/static/views/exercice.html b/qa/static/views/exercice.html index 7152b459..87e488af 100644 --- a/qa/static/views/exercice.html +++ b/qa/static/views/exercice.html @@ -38,11 +38,15 @@ {{ field }} + + + +