version finale formulaire

This commit is contained in:
Nicolas Bally 2012-08-18 18:45:11 +02:00
parent a20c9c8e19
commit bb6c346fab
13 changed files with 89 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -108,7 +108,7 @@ function chartbar(Container, Datas, Categories, Title){
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return ''+ return ''+
this.x +' : '+ this.y +' personne(s) ('+ this.point.name +")"; this.x +' : '+ this.y +' personne(s) ('+ this.point.per +")";
} }
}, },
plotOptions: { plotOptions: {

View File

@ -119,6 +119,8 @@ font-size:0.9em;
} }
input[type=submit]{ input[type=submit]{
background-clip: border-box;
background-position:5px 0px;
display: block; display: block;
margin:auto; margin:auto;
margin-bottom:10em; margin-bottom:10em;

View File

@ -22,7 +22,7 @@
-elsif item.questions_type == 4 -elsif item.questions_type == 4
-item.answers.each do |answer| -item.answers.each do |answer|
.answer_p .answer_p{:style =>( "display:inline;" if item.display_type == 1)}
=f.radio_button :content, answer.label_text =f.radio_button :content, answer.label_text
=f.label :content, answer.label_text, :value => answer.label_text =f.label :content, answer.label_text, :value => answer.label_text

View File

@ -99,7 +99,7 @@
%td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1 %td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1
-categories << answer.label_text -categories << answer.label_text
-chart_data << [per.to_s, tot] -chart_data << {:name => answer.label_text, :y => tot, :per => per.to_s}
-count = 0 -count = 0
@ -114,7 +114,7 @@
%td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1 %td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1
-categories << "non répondu" -categories << "non répondu"
-chart_data << [per.to_s, count] -chart_data << {:name => "non répondu", :y => count, :per => per.to_s}
-if item.answers.where(:field_type => 2).count > 0 -if item.answers.where(:field_type => 2).count > 0
-np = 0 -np = 0
@ -142,7 +142,79 @@
%script %script
$(document).ready(function() { $(document).ready(function() {
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_s+', '+categories.to_s+', "'+item.title+'")' -if item.answers.count > 4
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_json+', '+categories.to_s+', "'+item.title+'");'
-else
charts.push(new Highcharts.Chart(
=raw 'getChartConfig("'+r.to_s+'", "'+item.title+'", '+chart_data.to_json+')'
));
});
.bar_chart{:id => r}
-if item.questions_type == 4
-#chart_data = "['oui',#{oui}],['non',#{non}],['non répondu', #{nr}]"
-chart_data = []
-categories = []
%table
-item.answers.each do |answer|
%tr
%td=answer.label_text
%td
=tot = item.question_sets.where(:content => answer.label_text).count
%td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1
-categories << answer.label_text
-chart_data << {:name => answer.label_text, :y => tot, :per => per.to_s}
%tr
%td non répondu
%td=count = item.question_sets.where(:content => nil).count
%td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1
-categories << "non répondu"
-chart_data << {:name => "non répondu", :y => count, :per => per.to_s}
-if item.answers.where(:field_type => 2).count > 0
-np = 0
-item.answers.where(:field_type => 2).each do |a|
%h4
Réponses personnalisées pour "
=a.label_text
"
%table.large
-a.answer_sets.where(:is_checked => true).each do |a|
-if a.content?
%tr
%td{:colspan => 3}=a.content
-else
-np = np +1
%tr
%td
Non précisé
%td=np
%td=number_to_percentage (np*100.00)/(a.answer_sets.where(:is_checked => true).count), :precision => 1
-r = rand 99999
%script
$(document).ready(function() {
-if item.answers.count > 4
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_json+', '+categories.to_s+', "'+item.title+'");'
-else
charts.push(new Highcharts.Chart(
=raw 'getChartConfig("'+r.to_s+'", "'+item.title+'", '+chart_data.to_json+')'
));
}); });

View File

@ -28,8 +28,10 @@ item.answers.build(:label_text => "voyage organisé sur un weekend ou plusieurs
@survey.items.build(:questions_type => 1, :title => "La fréquence actuelle des sorties vous convient-elle ?", :item_type => 1) item = @survey.items.build(:questions_type => 4, :title => "La fréquence actuelle des sorties vous convient-elle ?", :item_type => 1, :display_type => 1)
item.answers.build(:label_text => "oui", :field_type => 1)
item.answers.build(:label_text => "non", :field_type => 1)
item.answers.build(:label_text => "pas totalement", :field_type => 1)
item = @survey.items.build(:questions_type => 3, :title => "Quels sont les thèmes que vous préférez ?", :item_type => 1) item = @survey.items.build(:questions_type => 3, :title => "Quels sont les thèmes que vous préférez ?", :item_type => 1)
@ -41,6 +43,7 @@ item.answers.build(:label_text => "jardin", :field_type => 1)
item.answers.build(:label_text => "visite de site", :field_type => 1) item.answers.build(:label_text => "visite de site", :field_type => 1)
item.answers.build(:label_text => "cabanes dobservation", :field_type => 1) item.answers.build(:label_text => "cabanes dobservation", :field_type => 1)
item.answers.build(:label_text => "lecture de paysage", :field_type => 1) item.answers.build(:label_text => "lecture de paysage", :field_type => 1)
item.answers.build(:label_text => "autres", :field_type => 2)
@ -50,8 +53,10 @@ item = @survey.items.build(:questions_type => 2, :title => "Par quel(s) moyen(s)
@survey.items.build(:questions_type => 1, :title => "Êtes-vous satisfait de ce(s) mode(s) dinformation(s) ?", :item_type => 1) item = @survey.items.build(:questions_type => 4, :title => "Êtes-vous satisfait de ce(s) mode(s) dinformation(s) ?", :item_type => 1, :display_type => 1)
item.answers.build(:label_text => "oui", :field_type => 1)
item.answers.build(:label_text => "non", :field_type => 1)
item.answers.build(:label_text => "pas totalement", :field_type => 1)
@ -66,7 +71,7 @@ item.answers.build(:label_text => "autres", :field_type => 2)
@survey.items.build(:questions_type => 1, :title => "Souhaiteriez-vous faire du covoiturage pour vous rendre sur le lieu d'une sortie ?", :item_type => 1) @survey.items.build(:questions_type => 1, :title => "Souhaiteriez-vous faire du covoiturage pour vous rendre sur le lieu d'une sortie ?", :item_type => 1)
item = @survey.items.build(:questions_type => 2, :text_presentation => 2, :title => "Avez-vous des remarques ou commentaires à faire à propos des sorties organisée par lassociation ?", :item_type => 1) item = @survey.items.build(:questions_type => 2, :text_presentation => 2, :title => "Avez-vous des remarques ou commentaires à faire à propos des sorties organisées par lassociation ?", :item_type => 1)
@survey.save @survey.save