Add input to hilight texts in responses

This commit is contained in:
nemunaire 2020-09-13 19:12:21 +02:00
parent c351de26ea
commit 1176c52ae7
2 changed files with 15 additions and 1 deletions

View File

@ -287,6 +287,17 @@ angular.module("AtsebaytApp")
.controller("QuestionController", function($scope, Survey, SurveyQuest, SurveyQuest, AllResponses, CorrectionTemplate, $http, $routeParams) {
$scope.notCorrected = true
$scope.highlight = ''
$scope.chHilight = function () {
var words = $scope.highlight.split(',').join('|')
$('.card-text').each(function (k, i) {
var e = $(i)
e.html(e.text().replace(new RegExp('(' + words + ')', 'g'), '<span class="bg-warning">$1</span>'))
})
}
$scope.survey = Survey.get({ surveyId: $routeParams.surveyId });
$scope.survey.$promise.then(function(survey) {
survey.start_availability = Date.parse(survey.start_availability)

View File

@ -1,8 +1,11 @@
<div class="btn-group-toggle float-right" data-toggle="buttons">
<div class="btn-group-toggle float-right ml-1" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="checkbox" ng-model="notCorrected"> Pas corrigés
</label>
</div>
<div class="float-right ml-1">
<input class="form-control" ng-model="highlight" placeholder="highlight1,highlight2,..." ng-change="chHilight()">
</div>
<h2>
<span class="text-muted">{{ survey.title }}</span>
<small>