BP2024/annotation_app/templates/anot.html

68 lines
2.2 KiB
HTML
Raw Normal View History

2024-04-09 13:39:11 +00:00
{% extends "base.html" %}
{% block title %} annotation {% endblock %}
{% block content%}
<div class="container" id="top-info">
<table class="table top-info">
<thead class="thead-dark">
<tr>
<th>Email</th>
<th>Počet anotovaných jednotiek</th>
</tr>
</thead>
<tr>
<td>{{ email }}</td>
<td>{{ annotated_count }}</td>
</tr>
</table>
</div>
2024-04-13 09:46:38 +00:00
<h5 class="container anot-nav">Anotujte nižšie daný text pomocou tlačidiel s klasifikačnými hodnotami</h3>
2024-04-09 13:39:11 +00:00
<div class="container">
<div class="anot">
<p class="anot-text">{{ text }}</p>
<button id="post" class="btn btn-primary" onclick="postBcknd('offensive', {{ sample_id }})">Ofenzívny</button>
<button id="post" class="btn btn-primary" onclick="postBcknd('not_offensive', {{ sample_id }})">Neofenzívny</button>
<button id="post" class="btn btn-primary" onclick="postBcknd('dont_know', {{ sample_id }})">Neviem</button>
</div>
<button id="get" class="btn btn-primary logout-btn" onclick="logout()"> Odhlásiť sa</button>
<script>
function postBcknd(value, sample_id){
var xhr = new XMLHttpRequest();
xhr.open('POST', '/process_anot', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function () {
if(xhr.status === 200) {
console.log('request sent succesfully');
window.location.href = '/anot';
} else {
console.log('request failed');
}
};
xhr.send(JSON.stringify({value: value, sample_id: sample_id}));
}
function logout() {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/', true);
xhr.onload = function () {
if (xhr.status === 200) {
console.log('Logout successful');
window.location.href = '/';
} else {
console.log('Logout request failed');
}
}
xhr.send(); // Send the request
}
</script>
{% endblock %}