AutoCommit Fre Jul 31 11:03:07 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-07-31 11:03:07 +02:00
parent b450757e47
commit 8a4a168fe4
4 changed files with 30 additions and 14 deletions

View File

@@ -1,13 +1,15 @@
<div style="background:red"><b><%= answeredquestion.title%></b>
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: <%= (100+answeredquestion.choices.count * 50).to_s%>px; margin: 0 auto">
<ul>
<% answeredquestion.choices.each do |c| %>
<li>
<%= c.to_s %><%= answeredquestion.answers.where(choice_id: c.id).count %>
<%= c.to_s %>: <%= answeredquestion.answers.where(choice_id: c.id).count %> votes
</li>
<% end %>
</ul>
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
</div>
<script>
$(function () {
$('#container_question_<%= answeredquestion.id %>').highcharts({
@@ -21,10 +23,13 @@ $(function () {
text: '<%= answeredquestion.text %>'
},
xAxis: {
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+c.text+"'"}.join(",")) %>],
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+escape_javascript(ff_icon("ffi1-good2"))+c.text+"'"}.join(",")) %>],
title: {
text: null
}
},
labels: {
useHTML: true
}
},
yAxis: {
min: 0,

View File

@@ -1,9 +1,11 @@
<div style="background:red"><b><%= question.title%></b>
<%= form_for question, url: answer_survey_question_path do |f| %>
<%= f.check_box :selected, {as: :check_boxes, collection: question.choices, label: false}, ["1"] %>
<%= f.action :submit, :as => :input %>
<% end %>
</div>
<% if current_user.nil? %>
<%= render partial: "answeredquestion", object: question %>
<% else %>
<div style="background:red"><b><%= question.title%></b>
<ul>
<% question.choices.each do |c| %>
<li><%= render c %></li>
<% end %>
</ul>
</div>
<% end %>