InQuire/templates/student.html

168 lines
6.5 KiB
HTML
Raw Normal View History

2018-11-28 11:08:23 +01:00
{% extends "index.html" %}
{% block title %}Panel studenta{% endblock %}
{% block content %}
<div class="container header__container">
2018-12-04 17:21:08 +01:00
<a href="/logout" id="btn--logout" class="btn-floating color--primary btn-small waves-effect waves-light" title="Wyloguj się"><i class="material-icons">power_settings_new</i></a>
<div class="row" style="margin-top: 80px;">
2018-11-28 11:08:23 +01:00
<div class="col s12">
<div class="card color--primary white-text">
<span class="card-title">Panel studenta</span>
</div>
</div>
</div>
</div>
<div class="container body__container">
<div class="row">
<div class="col s12">
2018-12-19 11:17:27 +01:00
<div class="card white-text">
<div class="card-content" style="padding-bottom: 0px">
2018-12-19 11:17:27 +01:00
<span class="card-title color--primary card-title__body">Pytania studentów</span>
<ul class="collapsible">
{% for question in questions %}
2018-12-19 11:17:27 +01:00
<li >
<div {% if question[5] == 1 %} class="collapsible-header color--answered" {% else %} class="collapsible-header color--primary" {% endif %}> <!--style="pointer-events:none !important;"> -->
<span class="col s7" style="display:flex; align-items:center; text-align: left;">
{{ question[3] }}
</span>
<span class="counter col s2">
<i class="btn-thumb-up material-icons" id="{{ question[0] }}">thumb_up</i>
<span>{{ question[4] }}</span>
</span>
<!-- <a class="col s3 btn--answer waves-effect waves-light btn-large red" style="pointer-events: auto;">ODPOWIEDZ</a> -->
</div>
{% if question[5] == 1 %}
2018-12-19 11:17:27 +01:00
<div class="collapsible-body color--answered" id="clpsbl">
<p style="color:#fff">{{question[6]}}</p>
</div>
{% endif %}
</li>
{% endfor %}
2018-11-28 11:08:23 +01:00
</ul>
</div>
2019-01-14 15:45:07 +01:00
<ul class="collapsible">
<li>
<div class="ask__container--content collapsible-header">
<div class="col s12 modal-trigger red" id="ask-question" href="#modalAsk" style="pointer-events: auto;">Zadaj pytanie</div>
</div>
<div id="modalAsk" class="collapsible-body">
<div class="modal-content">
<h4>Zadaj pytanie</h4>
<form class="col s12">
<div class="row">
<div class="input-field col s12">
<textarea id="textarea1" class="materialize-textarea" name ="questionText"></textarea>
<label for="textarea1">Tutaj wpisz swoje pytanie</label>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<a href="#!" id="btn-cancel-ask" class="modal-close waves-effect red btn">Anuluj</a>
<a href="#!" id="btn-send" class="modal-close waves-effect waves-primary btn">Wyślij</a>
</div>
</div>
</li>
2018-12-09 12:53:12 +01:00
</div>
2019-01-14 15:45:07 +01:00
</ul>
2018-12-09 12:53:12 +01:00
</div>
</div>
</div>
2019-01-29 21:25:28 +01:00
<!--
2018-12-09 12:53:12 +01:00
<div class="container footer__container">
<div class="row">
<div class="col s12">
<div class="card color--primary white-text">
<div class="card-content footer__container--content">
2019-01-23 17:42:29 +01:00
<div class="col s6 backtolectures" >Powrót</div>
2019-01-29 21:25:28 +01:00
<div class="col s4 modal-trigger" href="#modalAsk">Zadaj pytanie</div>
2018-12-09 12:53:12 +01:00
<div class="col s6">Informacje</div>
2018-11-28 11:08:23 +01:00
</div>
</div>
</div>
</div>
</div>
2019-01-29 21:25:28 +01:00
-->
2019-01-14 15:45:07 +01:00
<!--
2018-11-28 11:08:23 +01:00
<div id="modalAsk" class="modal">
<div class="modal-content">
<h4>Zadaj pytanie</h4>
<form class="col s12">
<div class="row">
<div class="input-field col s12">
<textarea id="textarea1" class="materialize-textarea" name ="questionText"></textarea>
2018-11-28 11:08:23 +01:00
<label for="textarea1">Tutaj wpisz swoje pytanie</label>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<a href="#!" class="modal-close waves-effect red btn">Anuluj</a>
<a href="#!" id="btn-send" class="modal-close waves-effect waves-primary btn">Wyślij</a>
</div>
</div>
2019-01-14 15:45:07 +01:00
-->
2018-11-28 11:08:23 +01:00
{% endblock %}
{%block script%}
<script>
$(document).ready(() => {
$('.modal').modal();
});
$(document).ready(function(){
$('.collapsible').collapsible();
});
$('#btn-cancel-ask').on('click', function(event) {
event.preventDefault();
2019-01-14 15:45:07 +01:00
$('#ask-question').click();
});
$('#btn-send').on('click', function(event) {
event.preventDefault();
2018-12-12 12:29:00 +01:00
var question = $('#textarea1').val();
var pathloc = window.location.pathname;
var splpath = pathloc.split('/');
var askUrl = '/ask/' + splpath.pop();
2018-12-05 10:57:01 +01:00
$.ajax({
url: askUrl,
2018-12-05 10:57:01 +01:00
type: 'POST',
data: question,
2019-01-14 17:28:38 +01:00
complete: function() {
2019-01-14 17:40:19 +01:00
alertify.notify('Pomyślnie wysłano pytanie', 'success', 3).then(
location.reload());
2018-12-05 10:57:01 +01:00
}
2019-01-14 16:44:31 +01:00
});
2019-01-14 17:28:38 +01:00
2019-01-14 16:43:09 +01:00
//location.reload();
2019-01-14 16:32:34 +01:00
2018-12-05 10:57:01 +01:00
2018-11-28 11:08:23 +01:00
});
$('.btn-thumb-up').on('click', function(event) {
event.preventDefault();
var link = '/upvote/' + event.target.id;
$.ajax({
url: link,
type: 'POST',
2019-01-14 17:40:19 +01:00
complete: function() {
alertify.notify('Pomyślnie oceniono pytanie', 'success', 3);
2018-12-12 12:29:00 +01:00
location.reload();
}
});
2018-12-04 17:21:08 +01:00
});
2018-12-05 10:57:01 +01:00
2019-01-23 17:42:29 +01:00
$('.backtolectures').on('click', function(event) {
event.preventDefault();
var pathloc = window.location.pathname;
var splpath = pathloc.split('/');
var link = '/lectures/' + splpath.pop();
window.location.href = link;
});
2018-12-05 10:57:01 +01:00
2018-11-28 11:08:23 +01:00
</script>
{%endblock%}