support long answers
This commit is contained in:
parent
9e63bb7180
commit
defa769dd2
1 changed files with 16 additions and 2 deletions
|
@ -6,6 +6,14 @@
|
||||||
|
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
|
|
||||||
|
<% if answers.iter().any(|x| x.len() > 4) { %>
|
||||||
|
<ol>
|
||||||
|
<% for answer in answers.iter() { %>
|
||||||
|
<li><h4><%= answer %></h4></li>
|
||||||
|
<% } %>
|
||||||
|
</ol>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var ctx = document.getElementById('myChart');
|
var ctx = document.getElementById('myChart');
|
||||||
|
@ -13,8 +21,14 @@
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: [
|
labels: [
|
||||||
<% for answer in answers.iter() { %>
|
<% if answers.iter().any(|x| x.len() > 4) { %>
|
||||||
"<%= answer %>",
|
<% for answer in answers.iter().enumerate().map(|(i, _)| i+1) { %>
|
||||||
|
"<%= answer %>",
|
||||||
|
<% } %>
|
||||||
|
<% } else { %>
|
||||||
|
<% for answer in answers.iter() { %>
|
||||||
|
"<%= answer %>",
|
||||||
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
],
|
],
|
||||||
<% if show_result { %>
|
<% if show_result { %>
|
||||||
|
|
Loading…
Reference in a new issue