forked from bofh/fetsite
AutoCommit Fre Jul 31 10:03:05 CEST 2015
This commit is contained in:
@@ -3,7 +3,70 @@
|
||||
<% answeredquestion.choices.each do |c| %>
|
||||
<li>
|
||||
<%= c.to_s %><%= answeredquestion.answers.where(choice_id: c.id).count %>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#container_question_<%= answeredquestion.id %>').highcharts({
|
||||
chart: {
|
||||
type: 'bar'
|
||||
},
|
||||
title: {
|
||||
text: '<%= answeredquestion.title%>'
|
||||
},
|
||||
subtitle: {
|
||||
text: '<%= answeredquestion.text %>'
|
||||
},
|
||||
xAxis: {
|
||||
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+c.text+"'"}.join(",")) %>],
|
||||
title: {
|
||||
text: null
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
min: 0,
|
||||
title: {
|
||||
text: 'Answers',
|
||||
align: 'high'
|
||||
},
|
||||
labels: {
|
||||
overflow: 'justify'
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
valueSuffix: ' votes'
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
dataLabels: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'top',
|
||||
x: -40,
|
||||
y: 80,
|
||||
floating: true,
|
||||
borderWidth: 1,
|
||||
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
|
||||
shadow: true
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '<%= answeredquestion.title%>',
|
||||
data: [<%= raw(answeredquestion.choices.map{|c| c.answers.count.to_s}.join(",")) %>]
|
||||
}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<div style="background:red"><b><%= question.title%></b>
|
||||
<%= semantic_form_for question, url: answer_survey_question_path do |f| %>
|
||||
<%= f.input :selected, as: :check_boxes, collection: question.choices, label: false %>
|
||||
<%= f.input :selected, as: :radio, collection: question.choices, label: false %>
|
||||
<%= 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>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</p><p>
|
||||
<%= params.to_yaml %>
|
||||
</p>
|
||||
<%= params[:survey_question][:selected].map{|c|c.to_i}.to_yaml %>
|
||||
|
||||
<p>
|
||||
<b>Typ:</b>
|
||||
<%= @survey_question.typ %>
|
||||
|
||||
Reference in New Issue
Block a user