diff --git a/app/assets/images/bg-dark.jpg b/app/assets/images/bg-dark.jpg deleted file mode 100644 index 6ba714f..0000000 Binary files a/app/assets/images/bg-dark.jpg and /dev/null differ diff --git a/app/assets/images/bg-green.jpg b/app/assets/images/bg-green.jpg deleted file mode 100644 index 885dabf..0000000 Binary files a/app/assets/images/bg-green.jpg and /dev/null differ diff --git a/app/assets/images/fond copie.png b/app/assets/images/fond copie.png deleted file mode 100644 index 68f2ce4..0000000 Binary files a/app/assets/images/fond copie.png and /dev/null differ diff --git a/app/assets/images/fond.png b/app/assets/images/fond.png index 367d2d1..870373b 100644 Binary files a/app/assets/images/fond.png and b/app/assets/images/fond.png differ diff --git a/app/assets/images/legno.jpg b/app/assets/images/legno.jpg deleted file mode 100644 index 7cca00f..0000000 Binary files a/app/assets/images/legno.jpg and /dev/null differ diff --git a/app/assets/images/logo3.png b/app/assets/images/logo3.png deleted file mode 100644 index 4413cf4..0000000 Binary files a/app/assets/images/logo3.png and /dev/null differ diff --git a/app/assets/images/logo4.png b/app/assets/images/logo4.png deleted file mode 100644 index 64a8c6c..0000000 Binary files a/app/assets/images/logo4.png and /dev/null differ diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png deleted file mode 100644 index d5edc04..0000000 Binary files a/app/assets/images/rails.png and /dev/null differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9617c66..66df385 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -108,7 +108,7 @@ function chartbar(Container, Datas, Categories, Title){ tooltip: { formatter: function() { return ''+ - this.x +' : '+ this.y +' personne(s) ('+ this.point.name +")"; + this.x +' : '+ this.y +' personne(s) ('+ this.point.per +")"; } }, plotOptions: { diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 7e63b7b..c438358 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -119,6 +119,8 @@ font-size:0.9em; } input[type=submit]{ + background-clip: border-box; + background-position:5px 0px; display: block; margin:auto; margin-bottom:10em; diff --git a/app/views/survey_sets/_question_set.html.haml b/app/views/survey_sets/_question_set.html.haml index b0969b0..609895a 100644 --- a/app/views/survey_sets/_question_set.html.haml +++ b/app/views/survey_sets/_question_set.html.haml @@ -22,7 +22,7 @@ -elsif item.questions_type == 4 -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.label :content, answer.label_text, :value => answer.label_text diff --git a/app/views/survey_sets/show.html.haml b/app/views/survey_sets/show.html.haml index 80786f9..8a2b656 100644 --- a/app/views/survey_sets/show.html.haml +++ b/app/views/survey_sets/show.html.haml @@ -99,7 +99,7 @@ %td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1 -categories << answer.label_text - -chart_data << [per.to_s, tot] + -chart_data << {:name => answer.label_text, :y => tot, :per => per.to_s} -count = 0 @@ -114,7 +114,7 @@ %td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1 -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 -np = 0 @@ -142,10 +142,82 @@ %script $(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+')' + )); + + }); + .bar_chart{:id => r} .break \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index 7aec79b..b60a0e8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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) @@ -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 => "cabanes d’observation", :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) d’information(s) ?", :item_type => 1) - +item = @survey.items.build(:questions_type => 4, :title => "Êtes-vous satisfait de ce(s) mode(s) d’information(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) -item = @survey.items.build(:questions_type => 2, :text_presentation => 2, :title => "Avez-vous des remarques ou commentaires à faire à propos des sorties organisée par l’association ?", :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 l’association ?", :item_type => 1) @survey.save