breakpointer-surveyor 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/MIT-LICENSE +20 -0
- data/README.md +20 -0
- data/Rakefile +57 -0
- data/VERSION +1 -0
- data/app/controllers/answers_controller.rb +87 -0
- data/app/controllers/dependencies_controller.rb +87 -0
- data/app/controllers/dependency_conditions_controller.rb +87 -0
- data/app/controllers/questions_controller.rb +85 -0
- data/app/controllers/sections_controller.rb +87 -0
- data/app/controllers/surveying_controller.rb +139 -0
- data/app/controllers/surveys_controller.rb +87 -0
- data/app/helpers/answers_helper.rb +2 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/questions_helper.rb +2 -0
- data/app/helpers/sections_helper.rb +2 -0
- data/app/helpers/survey_form_builder.rb +38 -0
- data/app/helpers/survey_importer_helper.rb +2 -0
- data/app/helpers/surveying_helper.rb +91 -0
- data/app/helpers/surveys_helper.rb +2 -0
- data/app/models/answer.rb +18 -0
- data/app/models/dependency.rb +43 -0
- data/app/models/dependency_condition.rb +76 -0
- data/app/models/question.rb +44 -0
- data/app/models/question_group.rb +5 -0
- data/app/models/response.rb +58 -0
- data/app/models/response_set.rb +174 -0
- data/app/models/survey.rb +54 -0
- data/app/models/survey_section.rb +19 -0
- data/app/models/user.rb +5 -0
- data/app/views/answer_display_types/_any_answer.html.haml +3 -0
- data/app/views/answer_display_types/_any_other_and_string.html.haml +5 -0
- data/app/views/answer_display_types/_any_string.html.haml +4 -0
- data/app/views/answer_display_types/_date.html.haml +3 -0
- data/app/views/answer_display_types/_datetime.html.haml +2 -0
- data/app/views/answer_display_types/_default.html.haml +1 -0
- data/app/views/answer_display_types/_float.html.haml +5 -0
- data/app/views/answer_display_types/_grid_any_answer.html.haml +2 -0
- data/app/views/answer_display_types/_grid_default.html.haml +2 -0
- data/app/views/answer_display_types/_grid_float.html.haml +2 -0
- data/app/views/answer_display_types/_grid_integer.html.haml +2 -0
- data/app/views/answer_display_types/_grid_one_answer.html.haml +2 -0
- data/app/views/answer_display_types/_grid_string.html.haml +2 -0
- data/app/views/answer_display_types/_integer.html.haml +6 -0
- data/app/views/answer_display_types/_one_answer.html.haml +3 -0
- data/app/views/answer_display_types/_one_string.html.haml +6 -0
- data/app/views/answer_display_types/_repeater_integer.html.haml +6 -0
- data/app/views/answer_display_types/_repeater_string.html.haml +7 -0
- data/app/views/answer_display_types/_string.html.haml +7 -0
- data/app/views/answer_display_types/_text.html.haml +6 -0
- data/app/views/answer_display_types/_time.html.haml +2 -0
- data/app/views/layouts/surveys.html.erb +17 -0
- data/app/views/question_display_types/_default.html.haml +12 -0
- data/app/views/question_display_types/_dropdown.html.haml +12 -0
- data/app/views/question_display_types/_grid_default.html.haml +14 -0
- data/app/views/question_display_types/_grid_dropdown.html.haml +15 -0
- data/app/views/question_display_types/_group_default.html.haml +8 -0
- data/app/views/question_display_types/_group_dropdown.html.haml +6 -0
- data/app/views/question_display_types/_image.html.haml +2 -0
- data/app/views/question_display_types/_inline.html.haml +12 -0
- data/app/views/question_display_types/_label.html.haml +4 -0
- data/app/views/question_display_types/_repeater_default.html.haml +10 -0
- data/app/views/question_display_types/_repeater_dropdown.html.haml +8 -0
- data/app/views/question_display_types/_slider.html.haml +17 -0
- data/app/views/question_group_display_types/_default.html.haml +13 -0
- data/app/views/question_group_display_types/_grid.html.haml +24 -0
- data/app/views/question_group_display_types/_repeater.html.haml +20 -0
- data/app/views/surveying/edit.html.haml +38 -0
- data/app/views/surveying/finish.html.haml +1 -0
- data/app/views/surveying/index.html.erb +19 -0
- data/app/views/surveying/new.html.haml +17 -0
- data/app/views/surveying/show.html.haml +8 -0
- data/config/routes.rb +10 -0
- data/generators/surveyor/surveyor_generator.rb +38 -0
- data/generators/surveyor/templates/README +9 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_arrows_leftright.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_arrows_updown.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_close.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_doc.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_folder_closed.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_folder_open.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_minus.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_plus.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_11x11_icon_resize_se.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_35x9_colorpicker_indicator.gif.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_7x7_arrow_down.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_7x7_arrow_left.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_7x7_arrow_right.gif +0 -0
- data/generators/surveyor/templates/assets/images/222222_7x7_arrow_up.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_arrows_leftright.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_arrows_updown.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_close.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_doc.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_folder_closed.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_folder_open.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_minus.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_11x11_icon_plus.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_7x7_arrow_down.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_7x7_arrow_left.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_7x7_arrow_right.gif +0 -0
- data/generators/surveyor/templates/assets/images/454545_7x7_arrow_up.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_arrows_leftright.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_arrows_updown.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_close.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_doc.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_folder_closed.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_folder_open.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_minus.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_11x11_icon_plus.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_7x7_arrow_down.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_7x7_arrow_left.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_7x7_arrow_right.gif +0 -0
- data/generators/surveyor/templates/assets/images/888888_7x7_arrow_up.gif +0 -0
- data/generators/surveyor/templates/assets/images/dadada_40x100_textures_02_glass_75.png +0 -0
- data/generators/surveyor/templates/assets/images/e6e6e6_40x100_textures_02_glass_75.png +0 -0
- data/generators/surveyor/templates/assets/images/ffffff_40x100_textures_01_flat_0.png +0 -0
- data/generators/surveyor/templates/assets/images/ffffff_40x100_textures_02_glass_65.png +0 -0
- data/generators/surveyor/templates/assets/javascripts/accessibleUISlider.jQuery.js +201 -0
- data/generators/surveyor/templates/assets/javascripts/jquery-1.2.6.js +3549 -0
- data/generators/surveyor/templates/assets/javascripts/jquery-ui-personalized-1.5.3.js +7616 -0
- data/generators/surveyor/templates/assets/javascripts/jquery.form.js +637 -0
- data/generators/surveyor/templates/assets/javascripts/surveyor.js +35 -0
- data/generators/surveyor/templates/assets/stylesheets/jquery-ui-slider-additions.css +71 -0
- data/generators/surveyor/templates/assets/stylesheets/reset.css +46 -0
- data/generators/surveyor/templates/assets/stylesheets/sass/surveyor.sass +321 -0
- data/generators/surveyor/templates/assets/stylesheets/surveyor.css +245 -0
- data/generators/surveyor/templates/assets/stylesheets/ui.theme.css +851 -0
- data/generators/surveyor/templates/migrate/create_answers.rb +46 -0
- data/generators/surveyor/templates/migrate/create_dependencies.rb +21 -0
- data/generators/surveyor/templates/migrate/create_dependency_conditions.rb +29 -0
- data/generators/surveyor/templates/migrate/create_question_groups.rb +18 -0
- data/generators/surveyor/templates/migrate/create_questions.rb +33 -0
- data/generators/surveyor/templates/migrate/create_response_sets.rb +22 -0
- data/generators/surveyor/templates/migrate/create_responses.rb +33 -0
- data/generators/surveyor/templates/migrate/create_survey_sections.rb +25 -0
- data/generators/surveyor/templates/migrate/create_surveys.rb +25 -0
- data/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +201 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/tasks/surveyor_tasks.rake +29 -0
- data/lib/tiny_code.rb +58 -0
- data/lib/user_manager.rb +9 -0
- data/lib/xml_formatter.rb +12 -0
- data/script/surveyor/answer.rb +84 -0
- data/script/surveyor/columnizer.rb +36 -0
- data/script/surveyor/dependency.rb +43 -0
- data/script/surveyor/dependency_condition.rb +74 -0
- data/script/surveyor/dslparse.rb +66 -0
- data/script/surveyor/question.rb +76 -0
- data/script/surveyor/question_group.rb +33 -0
- data/script/surveyor/specs/answer_spec.rb +66 -0
- data/script/surveyor/specs/question_dependency_spec.rb +46 -0
- data/script/surveyor/specs/question_group_spec.rb +9 -0
- data/script/surveyor/specs/question_spec.rb +111 -0
- data/script/surveyor/specs/section_spec.rb +58 -0
- data/script/surveyor/survey.rb +108 -0
- data/script/surveyor/survey_section.rb +153 -0
- data/script/surveyor/whr_dsl.tmproj +244 -0
- data/spec/controllers/answers_controller_spec.rb +64 -0
- data/spec/controllers/dependencies_controller_spec.rb +63 -0
- data/spec/controllers/dependency_conditions_controller_spec.rb +64 -0
- data/spec/controllers/questions_controller_spec.rb +64 -0
- data/spec/controllers/sections_controller_spec.rb +64 -0
- data/spec/controllers/surveying_controller_spec.rb +328 -0
- data/spec/controllers/surveying_routing_spec.rb +45 -0
- data/spec/controllers/surveys_controller_spec.rb +64 -0
- data/spec/fixtures/answers.yml +9 -0
- data/spec/fixtures/dependencies.yml +7 -0
- data/spec/fixtures/dependency_conditions.yml +27 -0
- data/spec/fixtures/question_groups.yml +7 -0
- data/spec/fixtures/questions.yml +15 -0
- data/spec/fixtures/response_sets.yml +13 -0
- data/spec/fixtures/responses.yml +9 -0
- data/spec/fixtures/survey_sections.yml +11 -0
- data/spec/fixtures/surveys.yml +9 -0
- data/spec/fixtures/users.yml +7 -0
- data/spec/helpers/survey_importer_helper_spec.rb +11 -0
- data/spec/helpers/surveying_helper_spec.rb +11 -0
- data/spec/models/answer_spec.rb +62 -0
- data/spec/models/dependency_condition_spec.rb +347 -0
- data/spec/models/dependency_spec.rb +82 -0
- data/spec/models/question_group_spec.rb +11 -0
- data/spec/models/question_spec.rb +70 -0
- data/spec/models/response_set_spec.rb +172 -0
- data/spec/models/response_spec.rb +94 -0
- data/spec/models/survey_section_spec.rb +34 -0
- data/spec/models/survey_spec.rb +72 -0
- data/spec/models/user_spec.rb +11 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +72 -0
- data/spec/views/app/edit.html.erb_spec.rb +20 -0
- data/spec/views/app/index.html.erb_spec.rb +19 -0
- data/spec/views/app/new.html.erb_spec.rb +21 -0
- data/spec/views/app/show.html.erb_spec.rb +17 -0
- data/surveyor.gemspec +258 -0
- data/uninstall.rb +1 -0
- metadata +286 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
class SurveySection < ActiveRecord::Base
|
2
|
+
|
3
|
+
# Associations
|
4
|
+
has_many :questions, :order => "display_order" # 0 or more
|
5
|
+
belongs_to :survey
|
6
|
+
|
7
|
+
# Validations
|
8
|
+
validates_presence_of :title, :survey, :display_order
|
9
|
+
|
10
|
+
def next
|
11
|
+
SurveySection.find(:first, :conditions => ["display_order > ? and survey_id = ?",self.display_order, self.survey_id], :order => "display_order ASC")
|
12
|
+
end
|
13
|
+
|
14
|
+
def previous
|
15
|
+
SurveySection.find(:first, :conditions => ["display_order < ? and survey_id = ?",self.display_order, self.survey_id], :order => "display_order DESC")
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
data/app/models/user.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
= answer.text
|
@@ -0,0 +1,5 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- fields_for_response(response_obj) do |response_form|
|
3
|
+
= response_form.label(:float_value, answer_text_prefix_helper(answer.text)) unless hide_label
|
4
|
+
= response_form.text_field(:float_value, :size => 5, :maxlength => 10, :autocomplete => "off")
|
5
|
+
= response_form.label(:float_value, answer_text_postfix_helper(answer.text)) unless hide_label
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- fields_for_response(response_obj) do |response_form|
|
3
|
+
= response_form.label(:integer_value, answer_text_prefix_helper(answer.text)) unless hide_label
|
4
|
+
= response_form.text_field(:integer_value, :size => 5, :maxlength => 10, :autocomplete => "off")
|
5
|
+
= response_form.label(:integer_value, answer_text_postfix_helper(answer.text)) unless hide_label
|
6
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- fields_for_radio(response_obj) do |response_form|
|
2
|
+
-# response_form.hidden_field(:answer_id, :value => 0, :index => nil)
|
3
|
+
= response_form.radio_button(:answer_id, answer.id, :checked => response_obj.selected?)
|
4
|
+
= response_form.label(:answer_id, answer.text)
|
5
|
+
- fields_for_response(response_obj) do |second_form|
|
6
|
+
= second_form.text_field(:string_value, :size => 25, :maxlength => 250, :autocomplete => "off")
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- disabled ||= false
|
3
|
+
- fields_for_repeater_response(response_obj, response_group) do |response_form|
|
4
|
+
= response_form.label(:integer_value, answer_text_prefix_helper(answer.text), :class => "#{(disabled)? 'disabled' : 'enabled'}") unless hide_label
|
5
|
+
= response_form.text_field(:integer_value, :size => 5, :maxlength => 10, :autocomplete => "off", :disabled => disabled)
|
6
|
+
= response_form.label(:integer_value, answer_text_postfix_helper(answer.text), :class => "#{(disabled)? 'disabled' : 'enabled'}") unless hide_label
|
@@ -0,0 +1,7 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- disabled ||= false
|
3
|
+
- fields_for_repeater_response(response_obj, response_group) do |response_form|
|
4
|
+
= response_form.label(:string_value, answer_text_prefix_helper(answer.text), :class => "#{(disabled)? 'disabled' : 'enabled'}") unless hide_label
|
5
|
+
= response_form.text_field(:string_value, :size => 25, :maxlength => 250, :autocomplete => "off", :disabled => disabled)
|
6
|
+
= response_form.label(:string_value, answer_text_postfix_helper(answer.text), :class => "#{(disabled)? 'disabled' : 'enabled'}") unless hide_label
|
7
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- fields_for_response(response_obj) do |response_form|
|
3
|
+
= response_form.label(:string_value, answer_text_prefix_helper(answer.text)) unless hide_label
|
4
|
+
= response_form.text_field(:string_value, :size => 25, :maxlength => 250, :autocomplete => "off")
|
5
|
+
= response_form.label(:string_value, answer_text_postfix_helper(answer.text)) unless hide_label
|
6
|
+
|
7
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- hide_label ||= false
|
2
|
+
- fields_for_response(response_obj) do |response_form|
|
3
|
+
= response_form.label(:text_value, answer_text_prefix_helper(answer.text)) unless hide_label
|
4
|
+
= response_form.text_area(:text_value, :cols => 80, :rows => 10)
|
5
|
+
= response_form.label(:text_value, answer_text_postfix_helper(answer.text)) unless hide_label
|
6
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>Survey: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'surveyor/reset', 'surveyor/surveyor', 'surveyor/ui.theme.css','surveyor/jquery-ui-slider-additions' %>
|
9
|
+
<%= javascript_include_tag 'surveyor/jquery-1.2.6.js', 'surveyor/jquery-ui-personalized-1.5.3.js', 'surveyor/accessibleUISlider.jQuery.js','jquery.form.js', 'surveyor/surveyor.js' %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="flash"><%= flash[:notice] %></div>
|
13
|
+
<div id="survey_with_menu" >
|
14
|
+
<%= yield %>
|
15
|
+
</div
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.question{:id => question_id_helper(question), :class => "#{'hidden' unless show_question} #{'dependent' if question.has_dependency?}"}
|
2
|
+
.number= question_number_helper number
|
3
|
+
%fieldset
|
4
|
+
%legend
|
5
|
+
%span.text
|
6
|
+
=question.text
|
7
|
+
%span.help= question.help_text
|
8
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
9
|
+
%ol.answers
|
10
|
+
- question.answers.each do |answer|
|
11
|
+
%li.answer{:id => answer_id_helper(answer)}
|
12
|
+
=render(:partial => "/answer_display_types/#{answer.partial_name}", :locals => {:answer => answer, :response_obj => @response_set.response_for(question.id, answer.id), :hide_label => answer.hide_label})
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.question{:id => question_id_helper(question), :class => "#{'hidden' unless show_question} #{'dependent' if question.has_dependency?}"}
|
2
|
+
.number= question_number_helper number
|
3
|
+
%fieldset
|
4
|
+
%legend{:style => "display:inline;"}
|
5
|
+
.text
|
6
|
+
= question.text
|
7
|
+
%span.help= question.help_text
|
8
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
9
|
+
%ol.answers
|
10
|
+
%li.answer
|
11
|
+
- options= question.answers.collect{|a| "<option #{ (response_set.response_for(question.id, a.id).selected?)? "selected='selected'" : nil } value ='#{a.id}'>#{a.text}</option>" }
|
12
|
+
= select_tag("responses[#{question.id}][answer_id]", ["<option value=''>Select one...</option>"].concat(options))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- reset_cycle("column_highlight")
|
2
|
+
%tr
|
3
|
+
%td.question_prefix
|
4
|
+
.question
|
5
|
+
%span.text= question_text_prefix_helper(question.text)
|
6
|
+
%span.help= question.help_text
|
7
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
8
|
+
- question.answers.each do |answer|
|
9
|
+
%td{:class => "#{cycle("column_highlight", "", :name => "column_highlight")}"}
|
10
|
+
.answer
|
11
|
+
= render(:partial => "/answer_display_types/grid_#{answer.partial_name}", :locals => {:answer => answer, :response_obj => response_set.response_for(question.id, answer.id)})
|
12
|
+
%td.question_postfix
|
13
|
+
.question
|
14
|
+
%span.text= question_text_postfix_helper(question.text)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- reset_cycle("column_highlight")
|
2
|
+
%tr
|
3
|
+
%td.question_prefix
|
4
|
+
.question
|
5
|
+
%span.text= question_text_prefix_helper(question.text)
|
6
|
+
%span.help= question.help_text
|
7
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
8
|
+
- question.answers.each do |answer|
|
9
|
+
%td{:class => "#{cycle("column_highlight", "", :name => "column_highlight")}"}
|
10
|
+
.answer
|
11
|
+
- options= question.answers.collect{|a| "<option #{ (response_set.response_for(question.id, a.id).selected?)? "selected='selected'" : nil } value ='#{a.id}'>#{a.text}</option>" }
|
12
|
+
= select_tag("responses[#{question.id}][answer_id]", ["<option value=''>Select one...</option>"].concat(options))
|
13
|
+
%td.question_postfix
|
14
|
+
.question
|
15
|
+
%span.text= question_text_postfix_helper(question.text)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
.question
|
2
|
+
%span.text= question.text
|
3
|
+
%span.help= question.help_text
|
4
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
5
|
+
%ol.answers
|
6
|
+
- question.answers.each do |answer|
|
7
|
+
%li.answer
|
8
|
+
=render(:partial => "/answer_display_types/#{answer.partial_name}", :locals => {:answer => answer, :response_obj => response_set.response_for(question.id, answer.id), :hide_label => true})
|
@@ -0,0 +1,6 @@
|
|
1
|
+
.question
|
2
|
+
%span.text= question.text
|
3
|
+
%span.help= question.help_text
|
4
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
5
|
+
- options= question.answers.collect{|a| "<option #{ (response_set.response_for(question.id, a.id).selected?)? "selected='selected'" : nil } value ='#{a.id}'>#{a.text}</option>" }
|
6
|
+
= select_tag("responses[#{question.id}][answer_id]", ["<option>Select one...</option>"].concat(options))
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.question{:id => question_id_helper(question), :class => "#{'hidden' unless show_question} #{'dependent' if question.has_dependency?}"}
|
2
|
+
.number= question_number_helper number
|
3
|
+
%fieldset
|
4
|
+
%legend
|
5
|
+
.text
|
6
|
+
= question.text
|
7
|
+
%span.help= question.help_text
|
8
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
9
|
+
%ol.answers_inline
|
10
|
+
- question.answers.each do |answer|
|
11
|
+
%li.answer
|
12
|
+
=render(:partial => "/answer_display_types/#{answer.partial_name}", :locals => {:answer => answer, :response_obj => @response_set.response_for(question.id, answer.id)})
|
@@ -0,0 +1,10 @@
|
|
1
|
+
-disabled ||= false
|
2
|
+
.question{ :class => "#{(disabled)? 'disabled' : 'enabled'}"}
|
3
|
+
%span.text= question.text
|
4
|
+
%span.help= question.help_text
|
5
|
+
= hidden_field_tag("response_groups[#{question.id}][#{response_group}][response_group]", response_group)
|
6
|
+
= hidden_field_tag("response_groups[#{question.id}][#{response_group}][question_id]", question.id)
|
7
|
+
%ol.answers
|
8
|
+
- question.answers.each do |answer|
|
9
|
+
%li.answer
|
10
|
+
=render(:partial => "/answer_display_types/repeater_#{answer.partial_name}", :locals => {:answer => answer, :response_obj => response_set.response_for(question.id, answer.id, response_group),:response_group => response_group, :hide_label => true, :disabled => disabled})
|
@@ -0,0 +1,8 @@
|
|
1
|
+
-disabled ||= false
|
2
|
+
.question{ :class => "#{(disabled)? 'disabled' : 'enabled'}"}
|
3
|
+
%span.text= question.text
|
4
|
+
%span.help= question.help_text
|
5
|
+
= hidden_field_tag("response_groups[#{question.id}][#{response_group}][response_group]", response_group)
|
6
|
+
= hidden_field_tag("response_groups[#{question.id}][#{response_group}][question_id]", question.id)
|
7
|
+
- options= question.answers.collect{|a| "<option #{ (response_set.response_for(question.id, a.id, response_group).selected?)? "selected='selected'" : nil } value ='#{a.id}'>#{a.text}</option>" }
|
8
|
+
= select_tag("response_groups[#{question.id}][#{response_group}][answer_id]", ["<option value=''>Select one...</option>"].concat(options), :disabled => disabled)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
%script{:type => "text/javascript"}
|
2
|
+
$(function(){
|
3
|
+
//demo 1
|
4
|
+
="$('#slider_#{question.id}').accessibleUISlider({width: 400, labels:#{question.answers.size} }).hide();"
|
5
|
+
});
|
6
|
+
.question{:id => question_id_helper(question), :class => "#{'hidden' unless show_question} #{'dependent' if question.has_dependency?}"}
|
7
|
+
.number= question_number_helper number
|
8
|
+
%fieldset
|
9
|
+
%legend{:style => "display:inline;"}
|
10
|
+
.text
|
11
|
+
= question.text
|
12
|
+
%span.help= question.help_text
|
13
|
+
= hidden_field_tag("responses[#{question.id}][question_id]", question.id)
|
14
|
+
%ol.answers
|
15
|
+
%li.answer
|
16
|
+
- options= question.answers.collect{|a| "<option #{ (response_set.response_for(question.id, a.id).selected?)? "selected='selected'" : nil } value ='#{a.id}'>#{a.text}</option>" }
|
17
|
+
= select_tag("responses[#{question.id}][answer_id]", options, {:id => "slider_#{question.id}"})
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.question_group
|
2
|
+
.head
|
3
|
+
.number= question_number_helper number
|
4
|
+
.text
|
5
|
+
= group.text
|
6
|
+
%span.help= group.help_text
|
7
|
+
- number_counter = 1
|
8
|
+
%ul
|
9
|
+
- group.questions.each do |question|
|
10
|
+
- if !question.has_dependency? or question.dependency_is_satisfied?(@response_set)
|
11
|
+
%li
|
12
|
+
= render(:partial => "/question_display_types/group_#{(!question.display_type.empty?)? question.display_type : "default"}", :locals => {:question => question, :response_set => @response_set, :number => "#{number}.#{number_counter}", :hide_label => true})
|
13
|
+
- number_counter += 1 if question.display_type != "label"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.question_group
|
2
|
+
.head
|
3
|
+
.number= question_number_helper number
|
4
|
+
.text
|
5
|
+
= group.text
|
6
|
+
%span.help= group.help_text
|
7
|
+
%table.grid
|
8
|
+
%thead
|
9
|
+
%th= " "
|
10
|
+
- reset_cycle("column_highlight")
|
11
|
+
- group.questions.first.answers.each do |answer|
|
12
|
+
%th{:class => "#{cycle("column_highlight", "", :name => "column_highlight")}"}= answer.text
|
13
|
+
%tfoot
|
14
|
+
%th= " "
|
15
|
+
- reset_cycle("column_highlight")
|
16
|
+
- group.questions.first.answers.each do |answer|
|
17
|
+
%th{:class => "#{cycle("column_highlight","", :name => "column_highlight")}"}= answer.text
|
18
|
+
%tbody
|
19
|
+
- number_counter = 1
|
20
|
+
- group.questions.each do |question|
|
21
|
+
- if !question.has_dependency? or question.dependency_is_satisfied?(response_set)
|
22
|
+
= render(:partial => "/question_display_types/grid_#{question.display_type}", :locals => {:question => question, :response_set => response_set, :number => "#{number}.#{number_counter}"})
|
23
|
+
- number_counter += 1 if question.display_type != "label"
|
24
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
- group_anchor_id = "qg#{group.id}"
|
2
|
+
.question_group
|
3
|
+
%span.anchor
|
4
|
+
%a{:name => group_anchor_id}
|
5
|
+
.head
|
6
|
+
.number= question_number_helper number
|
7
|
+
.text
|
8
|
+
= group.text
|
9
|
+
%span.help= group.help_text
|
10
|
+
%ul.repeater
|
11
|
+
- (response_set.count_group_responses(group) + 1).times do |group_number|
|
12
|
+
- number_counter = 1
|
13
|
+
%li.repeater
|
14
|
+
- group.questions.each do |question|
|
15
|
+
= render(:partial => "/question_display_types/repeater_#{question.display_type}", :locals => {:question => question, :response_set => response_set, :number => "#{number}.#{number_counter}" ,:hide_label => true, :response_group => group_number, :disabled => false})
|
16
|
+
- number_counter += 1 if question.display_type != "label"
|
17
|
+
%li.repeater
|
18
|
+
- group.questions.each do |question|
|
19
|
+
= render(:partial => "/question_display_types/repeater_#{question.display_type}", :locals => {:question => question, :response_set => response_set, :number => "" ,:hide_label => true, :response_group => 9999, :disabled => true})
|
20
|
+
= submit_tag("<= add row", :name => section_submit_name_helper(group.questions.first.survey_section,group_anchor_id), :class => "add_row")
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#content
|
2
|
+
- form_tag(update_my_survey_path, :method => :put, :id => "survey_form") do
|
3
|
+
-unless @survey.sections.size < 3
|
4
|
+
#menu
|
5
|
+
Sections:
|
6
|
+
%ul
|
7
|
+
- @survey.sections.each do |survey_section|
|
8
|
+
- if (survey_section == @section)
|
9
|
+
%li{:class => "active"}= section_submit_helper(survey_section)
|
10
|
+
- else
|
11
|
+
%li= section_submit_helper(survey_section)
|
12
|
+
#header
|
13
|
+
.title= @survey.title
|
14
|
+
.previous_section
|
15
|
+
- unless @section.previous == nil
|
16
|
+
= section_previous_helper(@section.previous) unless @section.previous == nil
|
17
|
+
- unless @dependents.empty?
|
18
|
+
#dependents
|
19
|
+
.title
|
20
|
+
Follow-up questions from your answers on the previous page
|
21
|
+
- @dependents.each_with_index do |question, index|
|
22
|
+
= dependency_explanation_helper(question, @response_set)
|
23
|
+
= render(:partial => "/question_display_types/#{question.display_type}", :locals => {:question => question, :response_set => @response_set, :number => "D#{index+1}", :show_question => true})
|
24
|
+
.section{:id => section_id_helper(@section)}
|
25
|
+
%span.title= @section.title
|
26
|
+
.questions
|
27
|
+
- number_counter = 1
|
28
|
+
- @section.questions.each_with_index do |question, index|
|
29
|
+
- unless question.part_of_group?
|
30
|
+
- show_question = (question.dependency_satisfied?(@response_set) or !question.has_dependency?)
|
31
|
+
= render(:partial => "/question_display_types/#{(!question.display_type.empty?)? question.display_type : "default"}", :locals => {:question => question, :response_set => @response_set, :number => !question.has_dependency? ? number_counter : nil, :show_question => show_question})
|
32
|
+
- number_counter += 1 if question.display_type != "label" and question.display_type != "image" and !question.has_dependency?
|
33
|
+
- else
|
34
|
+
- if (index + 1 >= @section.questions.size) or (question.question_group_id != @section.questions[index + 1].question_group_id) #looking ahead
|
35
|
+
= render(:partial => "/question_group_display_types/#{(!question.question_group.display_type.empty?)? question.question_group.display_type : "default"}", :locals => {:group => question.question_group, :response_set => @response_set, :number => number_counter})
|
36
|
+
- number_counter += 1
|
37
|
+
.next_section
|
38
|
+
= @section.next ? section_next_helper(@section.next) : submit_tag("Click here to finish", :name => "0")
|
@@ -0,0 +1 @@
|
|
1
|
+
Thank you for finishing this survey
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1>Listing surveys</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
</tr>
|
6
|
+
<% if @surveys %>
|
7
|
+
<% for survey in @surveys %>
|
8
|
+
<tr>
|
9
|
+
<td><%= survey.title %></td>
|
10
|
+
<td> </td>
|
11
|
+
<td><%= link_to 'Show', survey %></td>
|
12
|
+
</tr>
|
13
|
+
<% end %>
|
14
|
+
</table>
|
15
|
+
<% else %>
|
16
|
+
No surveys
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<br />
|