forked from bofh/fetsite
AutoCommit Don Aug 6 22:03:02 CEST 2015
This commit is contained in:
@@ -1,68 +1,66 @@
|
||||
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: <%= (100+answeredquestion.choices.count * 90).to_s%>px; margin: 0 auto" class="contentbox">
|
||||
<div style="background:red"><b><%= answeredquestion.title%></b>
|
||||
|
||||
<ul>
|
||||
<% answeredquestion.choices.each do |c| %>
|
||||
<li>
|
||||
<%= c.to_s %>: <%= answeredquestion.answers.where(choice_id: c.id).count %> votes
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: <%= (100+answeredquestion.choices.count * 90).to_s %>px; margin: 0 auto" class="contentbox">
|
||||
<div style="background:red">
|
||||
<b><%= answeredquestion.title%></b>
|
||||
<ul>
|
||||
<% answeredquestion.choices.each do |c| %>
|
||||
<li>
|
||||
<%= c.to_s %>: <%= answeredquestion.answers.where(choice_id: c.id).count %> votes
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#container_question_<%= answeredquestion.id %>').highcharts({
|
||||
chart: {
|
||||
type: 'bar'
|
||||
},
|
||||
chart: {
|
||||
type: 'bar'
|
||||
},
|
||||
title: {
|
||||
text: '<%= answeredquestion.title%>'
|
||||
},
|
||||
subtitle: {
|
||||
text: '<%= answeredquestion.text %>'
|
||||
},
|
||||
xAxis: {
|
||||
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+escape_javascript(c.html)+"'"}.join(",")) %>],
|
||||
title: {
|
||||
text: '<%= answeredquestion.title%>'
|
||||
text: null
|
||||
},
|
||||
subtitle: {
|
||||
text: '<%= answeredquestion.text %>'
|
||||
labels: {
|
||||
useHTML: true
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
min: 0,
|
||||
title: {
|
||||
text: 'Answers',
|
||||
align: 'high'
|
||||
},
|
||||
xAxis: {
|
||||
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+escape_javascript(c.html)+"'"}.join(",")) %>],
|
||||
title: {
|
||||
text: null
|
||||
},
|
||||
labels: {
|
||||
useHTML: true
|
||||
}
|
||||
labels: {
|
||||
overflow: 'justify'
|
||||
},
|
||||
yAxis: {
|
||||
min: 0,
|
||||
title: {
|
||||
text: 'Answers',
|
||||
align: 'high'
|
||||
},
|
||||
labels: {
|
||||
overflow: 'justify'
|
||||
},
|
||||
minTickInterval: 1
|
||||
},
|
||||
tooltip: {
|
||||
valueSuffix: ' votes'
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
dataLabels: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '<%= answeredquestion.title%>',
|
||||
data: [<%= raw(answeredquestion.choices.map{|c| c.answers.count.to_s}.join(",")) %>]
|
||||
}]
|
||||
minTickInterval: 1
|
||||
},
|
||||
tooltip: {
|
||||
valueSuffix: ' votes'
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
dataLabels: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '<%= answeredquestion.title %>',
|
||||
data: [<%= raw(answeredquestion.choices.map{|c| c.answers.count.to_s}.join(",")) %>]
|
||||
}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<% if current_user.nil? %>
|
||||
<%= div_tag_for(question) do%>
|
||||
<%= render partial: "survey/questions/answeredquestion", object: question %>
|
||||
<%= render partial: "survey/questions/answeredquestion", object: question %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="contentbox" id ="<%= divid_for(question) %>" style="">
|
||||
<div >
|
||||
<b><%= question.title%></b> <%=question.text%><%= link_to fa_icon("pencil"), edit_survey_question_path(question) , class: "btn btn-link navbar-btn" , remote: true%>
|
||||
<b><%= question.title%></b>
|
||||
<%= question.text %>
|
||||
<%= link_to fa_icon("pencil"), edit_survey_question_path(question) , class: "btn btn-link navbar-btn" , remote: true %>
|
||||
<%= flag_link(question, "delete")%>
|
||||
<%= flag_link(question, "template")%>
|
||||
|
||||
<ul class="choice-list">
|
||||
<% question.choices.each do |c| %>
|
||||
|
||||
Reference in New Issue
Block a user