Browse Source

testing powerpoint display

pull/10/head
crunch 6 months ago
parent
commit
c16f5d0027
3 changed files with 79 additions and 37 deletions
  1. +31
    -0
      Consulta_project/landing/static/js/stats_test.js
  2. +41
    -37
      Consulta_project/polls/templates/polls/poll.html
  3. +7
    -0
      Consulta_project/polls/templates/polls/stats.html

+ 31
- 0
Consulta_project/landing/static/js/stats_test.js View File

@@ -0,0 +1,31 @@
function createBarChart(series, labels, target_id) {
/* console.log(series + " " + labels + " " + target_id); */
var ctx = document.getElementById("stats").getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',

// The data for our dataset
data: {
labels: ["test", "kek", "lel"],
datasets: [{
label: 'Number of votes',
backgroundColor: 'rgb(0,188,140)',
borderColor: '#282d32',
data: [1, 2, 3]
}]
},

// Configuration options go here
options: {
events: null,
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
}

+ 41
- 37
Consulta_project/polls/templates/polls/poll.html View File

@@ -1,51 +1,55 @@
{% extends "landing/index_base.html" %} {% block content %}

{% if poll.get_questions %}
<div class="d-flex justify-content-center align-items-center" style="text-align: center;margin-top: 30px;height: 75vh; background-color: #1f1f1f;">
<div class="container" style="padding-bottom: 30px;padding-top: 30px;font-family: Inter;">
<div class="row d-flex justify-content-center align-items-center">
<div
class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<h1>{{ poll.name }}</h1>
</div>
<div class="d-flex justify-content-center align-items-center"
style="text-align: center;margin-top: 30px;height: 75vh; background-color: #1f1f1f;">
<div class="container" style="padding-bottom: 30px;padding-top: 30px;font-family: Inter;">
<div class="row d-flex justify-content-center align-items-center">
<div
class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<h1>{{ poll.name }}</h1>
</div>
<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div
class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<h3>Available Questions:</h3>
</div>
</div>

{% if poll.get_questions %}
<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div
class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<h3>Available Questions:</h3>
</div>
<div class="row d-flex d-sm-flex d-md-flex d-lg-flex d-xl-flex justify-content-center justify-content-sm-center justify-content-md-center justify-content-lg-center justify-content-xl-center"
style="margin-top: 15px;margin-bottom: 15px;">
<div
class="col-auto d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<a href="{% url 'poll-stats' poll.slug %}">
<h5>Stats</h5>
</a>
</div>
<div
class="col-auto d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<a href="{% url 'poll-share' poll.slug %}">
<h5>Share</h5>
</a>
</div>
</div>
<div class="row d-flex d-sm-flex d-md-flex d-lg-flex d-xl-flex justify-content-center justify-content-sm-center justify-content-md-center justify-content-lg-center justify-content-xl-center"
style="margin-top: 15px;margin-bottom: 15px;">
<div
class="col-auto d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<a href="{% url 'poll-stats' poll.slug %}">
<h5>Stats</h5>
</a>
</div>
<div class="row d-flex d-xl-flex justify-content-center align-items-center justify-content-xl-center"
style="margin-right: 15vw;margin-left: 15vw;">
<div class="col-12 col-md-8 col-lg-9 col-xl-7">
{% for question in poll.get_questions %}
<div
class="col-auto d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<a href="{% url 'poll-share' poll.slug %}">
<h5>Share</h5>
</a>
</div>
</div>
{% endif %}
<div class="row d-flex d-xl-flex justify-content-center align-items-center justify-content-xl-center"
style="margin-right: 15vw;margin-left: 15vw;">
<div class="col-12 col-md-8 col-lg-9 col-xl-7">
{% for question in poll.get_questions %}

<a href="{{ question.get_absolute_url }}"><h4>{{ question.question_string }}</h4></a>
<a href="{{ question.get_absolute_url }}">
<h4>{{ question.question_string }}</h4>
</a>

{% empty %}
{% empty %}

<h2>There are currently no questions in this poll.</h2>
<h4>There are currently no questions in this poll.</h4>

{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>

{% endblock content %}

+ 7
- 0
Consulta_project/polls/templates/polls/stats.html View File

@@ -16,6 +16,12 @@
</div>
</div>

<div class="row d-flex justify-content-center">
<div class="col" style="margin-top: 15px;margin-bottom: 15px;">
<canvas id="stats"></canvas>
</div>
</div>

{% for question in poll.get_questions %}

{% if question.get_answers and question.answers_have_votes %}
@@ -72,4 +78,5 @@

{% block bottom_scripts %}
<script type="text/javascript" src="{% static 'js/stats.js' %}"></script>
<script type="text/javascript" src="{% static 'js/stats_test.js' %}"></script>
{% endblock %}

Loading…
Cancel
Save