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>
|
2018-12-17 15:37:50 +01:00
|
|
|
<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">
|
2018-12-17 15:37:50 +01:00
|
|
|
<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>
|
2018-12-19 09:13:18 +01:00
|
|
|
<ul class="collapsible">
|
2018-12-12 09:12:36 +01:00
|
|
|
{% 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;"> -->
|
2018-12-19 09:13:18 +01:00
|
|
|
<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">
|
2018-12-19 09:13:18 +01:00
|
|
|
<p style="color:#fff">{{question[6]}}</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-12-17 15:37:50 +01:00
|
|
|
</li>
|
2018-12-12 09:12:36 +01:00
|
|
|
{% endfor %}
|
2018-11-28 11:08:23 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
2018-12-17 15:37:50 +01:00
|
|
|
<div class="ask__container--content">
|
|
|
|
<div class="col s12 modal-trigger red" id="ask-question" href="#modalAsk">Zadaj pytanie</div>
|
2018-12-09 12:53:12 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<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">
|
|
|
|
<div class="col s6">Powrót</div>
|
|
|
|
<!--<div class="col s4 modal-trigger" href="#modalAsk">Zadaj pytanie</div>-->
|
|
|
|
<div class="col s6">Informacje</div>
|
2018-11-28 11:08:23 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<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">
|
2018-12-17 15:37:50 +01:00
|
|
|
<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>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{%block script%}
|
|
|
|
<script>
|
|
|
|
$(document).ready(() => {
|
|
|
|
$('.modal').modal();
|
|
|
|
});
|
|
|
|
|
2018-12-19 09:13:18 +01:00
|
|
|
$(document).ready(function(){
|
|
|
|
$('.collapsible').collapsible();
|
|
|
|
});
|
|
|
|
|
2018-11-28 11:08:23 +01:00
|
|
|
$('#btn-send').on('click', () => {
|
2018-12-12 12:29:00 +01:00
|
|
|
var question = $('#textarea1').val();
|
2018-12-05 10:57:01 +01:00
|
|
|
$.ajax({
|
2018-12-12 11:38:46 +01:00
|
|
|
url: '/ask',
|
2018-12-05 10:57:01 +01:00
|
|
|
type: 'POST',
|
|
|
|
data: question,
|
|
|
|
succes: function(response) {
|
2018-12-12 12:29:00 +01:00
|
|
|
location.reload();
|
2018-12-05 10:57:01 +01:00
|
|
|
}
|
|
|
|
});
|
2018-12-12 12:29:00 +01:00
|
|
|
location.reload();
|
|
|
|
alertify.notify('Pomyślnie wysłano pytanie', 'success', 3);
|
2018-12-05 10:57:01 +01:00
|
|
|
|
|
|
|
|
2018-11-28 11:08:23 +01:00
|
|
|
});
|
|
|
|
$('.btn-thumb-up').on('click', () => {
|
2018-12-12 09:12:36 +01:00
|
|
|
//alert(event.target.id)
|
|
|
|
var link = '/upvote/' + event.target.id;
|
2018-12-05 11:26:32 +01:00
|
|
|
$.ajax({
|
2018-12-12 09:12:36 +01:00
|
|
|
url: link,
|
2018-12-05 11:26:32 +01:00
|
|
|
type: 'POST',
|
|
|
|
succes: function(response) {
|
2018-12-12 12:29:00 +01:00
|
|
|
location.reload();
|
|
|
|
//alert(response)
|
2018-12-05 11:26:32 +01:00
|
|
|
}
|
|
|
|
});
|
2018-11-28 11:08:23 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
2018-11-28 11:08:23 +01:00
|
|
|
</script>
|
|
|
|
{%endblock%}
|