surveyor_gui 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/.travis.yml +17 -0
  4. data/Gemfile +7 -0
  5. data/LICENSE +21 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +159 -0
  8. data/Rakefile +66 -0
  9. data/app/controllers/answers_controller.rb +3 -0
  10. data/app/controllers/application_controller.rb +3 -0
  11. data/app/controllers/dependencys_controller.rb +286 -0
  12. data/app/controllers/question_groups_controller.rb +84 -0
  13. data/app/controllers/questions_controller.rb +187 -0
  14. data/app/controllers/survey_sections_controller.rb +80 -0
  15. data/app/controllers/surveyforms_controller.rb +4 -0
  16. data/app/controllers/surveyor_controller.rb +89 -0
  17. data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
  18. data/app/controllers/surveyor_gui/responses_controller.rb +39 -0
  19. data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
  20. data/app/facades/report_formatter.rb +44 -0
  21. data/app/facades/report_preview_wrapper.rb +11 -0
  22. data/app/facades/report_response_generator.rb +147 -0
  23. data/app/helpers/application_helper.rb +2 -0
  24. data/app/helpers/dependency_helper.rb +5 -0
  25. data/app/helpers/question_helper.rb +22 -0
  26. data/app/helpers/surveyform_helper.rb +179 -0
  27. data/app/helpers/surveyor_gui/report_helper.rb +19 -0
  28. data/app/helpers/surveyor_helper.rb +4 -0
  29. data/app/inputs/currency_input.rb +5 -0
  30. data/app/inputs/date_picker_input.rb +7 -0
  31. data/app/inputs/datetime_picker_input.rb +5 -0
  32. data/app/inputs/percent_input.rb +5 -0
  33. data/app/inputs/time_picker_input.rb +5 -0
  34. data/app/mailers/.gitkeep +0 -0
  35. data/app/models/.gitkeep +0 -0
  36. data/app/models/answer.rb +4 -0
  37. data/app/models/column.rb +3 -0
  38. data/app/models/dependency.rb +4 -0
  39. data/app/models/dependency_condition.rb +4 -0
  40. data/app/models/permitted_params_decorator.rb +80 -0
  41. data/app/models/question.rb +4 -0
  42. data/app/models/question_group.rb +4 -0
  43. data/app/models/question_type.rb +7 -0
  44. data/app/models/response.rb +4 -0
  45. data/app/models/response_set.rb +4 -0
  46. data/app/models/row.rb +3 -0
  47. data/app/models/survey.rb +4 -0
  48. data/app/models/survey_section.rb +4 -0
  49. data/app/models/surveyform.rb +103 -0
  50. data/app/uploaders/blob_uploader.rb +48 -0
  51. data/app/views/dependencys/_column.html.erb +1 -0
  52. data/app/views/dependencys/_dependency.html.erb +22 -0
  53. data/app/views/dependencys/_dependency_condition_fields.html.erb +48 -0
  54. data/app/views/dependencys/_form.html.erb +20 -0
  55. data/app/views/dependencys/blank.html.erb +0 -0
  56. data/app/views/dependencys/edit.html.erb +1 -0
  57. data/app/views/dependencys/new.html.erb +1 -0
  58. data/app/views/layouts/application.html.erb +14 -0
  59. data/app/views/layouts/surveyor_gui_blank.html.erb +12 -0
  60. data/app/views/layouts/surveyor_gui_default.html.erb +16 -0
  61. data/app/views/layouts/surveyor_modified.html.erb +14 -0
  62. data/app/views/partials/_answer.html.haml +33 -0
  63. data/app/views/partials/_question.html.haml +33 -0
  64. data/app/views/partials/_question_group.html.haml +73 -0
  65. data/app/views/partials/_section.html.haml +13 -0
  66. data/app/views/question_groups/_form.html.erb +56 -0
  67. data/app/views/question_groups/_group_inline_field.html.erb +21 -0
  68. data/app/views/question_groups/_group_inline_fields.html.erb +25 -0
  69. data/app/views/question_groups/blank.html.erb +0 -0
  70. data/app/views/question_groups/edit.html.erb +1 -0
  71. data/app/views/question_groups/new.html.erb +1 -0
  72. data/app/views/questions/_answer_fields.html.erb +23 -0
  73. data/app/views/questions/_answer_options.html.erb +28 -0
  74. data/app/views/questions/_form.html.erb +65 -0
  75. data/app/views/questions/_grid_dropdown_columns.html.erb +10 -0
  76. data/app/views/questions/_grid_dropdown_fields.html.erb +42 -0
  77. data/app/views/questions/_grid_fields.html.erb +9 -0
  78. data/app/views/questions/_no_picks.html.erb +29 -0
  79. data/app/views/questions/_pick.html +21 -0
  80. data/app/views/questions/_picks.html.erb +12 -0
  81. data/app/views/questions/blank.html.erb +0 -0
  82. data/app/views/questions/edit.html.erb +1 -0
  83. data/app/views/questions/new.html.erb +1 -0
  84. data/app/views/survey_sections/_form.html.erb +13 -0
  85. data/app/views/survey_sections/blank.html.erb +0 -0
  86. data/app/views/survey_sections/edit.html.erb +1 -0
  87. data/app/views/survey_sections/new.html.erb +1 -0
  88. data/app/views/surveyforms/_form.html.erb +50 -0
  89. data/app/views/surveyforms/_question_field.html.erb +148 -0
  90. data/app/views/surveyforms/_question_group.html.erb +116 -0
  91. data/app/views/surveyforms/_question_group_fields.html.erb +3 -0
  92. data/app/views/surveyforms/_question_name_and_number.html.erb +6 -0
  93. data/app/views/surveyforms/_question_section.html.erb +15 -0
  94. data/app/views/surveyforms/_question_wrapper.html.erb +109 -0
  95. data/app/views/surveyforms/_survey_section_fields.html.erb +138 -0
  96. data/app/views/surveyforms/clone_survey.html.erb +13 -0
  97. data/app/views/surveyforms/edit.html.erb +5 -0
  98. data/app/views/surveyforms/index.html.erb +40 -0
  99. data/app/views/surveyforms/new.html.erb +1 -0
  100. data/app/views/surveyforms/show.html.erb +5 -0
  101. data/app/views/surveyor_gui/reports/_graphs.html.haml +21 -0
  102. data/app/views/surveyor_gui/reports/_grid.html.haml +42 -0
  103. data/app/views/surveyor_gui/reports/_grid_dropdown.html.haml +56 -0
  104. data/app/views/surveyor_gui/reports/_repeater.html.haml +28 -0
  105. data/app/views/surveyor_gui/reports/_show_report.html.haml +33 -0
  106. data/app/views/surveyor_gui/reports/_single_question.html.haml +70 -0
  107. data/app/views/surveyor_gui/reports/show.html.erb +14 -0
  108. data/app/views/surveyor_gui/responses/_grid.html.haml +20 -0
  109. data/app/views/surveyor_gui/responses/_grid_dropdown.html.haml +20 -0
  110. data/app/views/surveyor_gui/responses/_repeater.html.haml +22 -0
  111. data/app/views/surveyor_gui/responses/_survey_results.html.haml +40 -0
  112. data/app/views/surveyor_gui/responses/index.html.haml +24 -0
  113. data/app/views/surveyor_gui/responses/show.html.haml +42 -0
  114. data/app/views/surveyor_gui/shared/_grid_comments.html.haml +10 -0
  115. data/app/views/surveyor_gui/shared/_new_line.html.haml +2 -0
  116. data/app/views/surveyor_gui/shared/_pick_comments.html.haml +15 -0
  117. data/app/views/surveyor_gui/shared/_question_number.html.haml +9 -0
  118. data/app/views/surveyor_gui/shared/_report_data.html.haml +24 -0
  119. data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
  120. data/config.ru +4 -0
  121. data/config/environment.rb +0 -0
  122. data/config/routes.rb +71 -0
  123. data/db/migrate/20140307204049_add_template_to_surveys.rb +5 -0
  124. data/db/migrate/20140307235607_add_test_data_to_response_sets.rb +5 -0
  125. data/db/migrate/20140308171947_add_original_choice_to_answers.rb +5 -0
  126. data/db/migrate/20140308172118_add_blob_to_responses.rb +5 -0
  127. data/db/migrate/20140308172417_add_modifiable_to_survey_section.rb +5 -0
  128. data/db/migrate/20140308174532_add_modifiable_to_question.rb +5 -0
  129. data/db/migrate/20140308175305_add_dynamically_generate_to_questions.rb +5 -0
  130. data/db/migrate/20140311032923_add_dummy_blob_to_questions.rb +5 -0
  131. data/db/migrate/20140311160609_add_dynamic_source_to_questions.rb +5 -0
  132. data/db/migrate/20140311161714_add_report_code_to_questions.rb +5 -0
  133. data/db/migrate/20140530181134_add_is_comment_to_questions.rb +5 -0
  134. data/db/migrate/20140531012006_add_is_comment_to_answers.rb +5 -0
  135. data/db/migrate/20140531225529_create_rows.rb +9 -0
  136. data/db/migrate/20140601011151_create_columns.rb +11 -0
  137. data/db/migrate/20140602030330_add_column_id_to_answers.rb +5 -0
  138. data/db/migrate/20140603155606_add_column_id_to_responses.rb +5 -0
  139. data/db/migrate/20140606023527_add_column_id_to_dependency_conditions.rb +5 -0
  140. data/db/migrate/20140815165307_add_user_id_to_survey.rb +5 -0
  141. data/lib/assets/.gitkeep +0 -0
  142. data/lib/assets/images/addicon.png +0 -0
  143. data/lib/assets/images/datepicker.gif +0 -0
  144. data/lib/assets/images/delete.gif +0 -0
  145. data/lib/assets/images/delete.png +0 -0
  146. data/lib/assets/images/images/border.png +0 -0
  147. data/lib/assets/images/images/controls.png +0 -0
  148. data/lib/assets/images/images/loading.gif +0 -0
  149. data/lib/assets/images/images/loading_background.png +0 -0
  150. data/lib/assets/images/images/overlay.png +0 -0
  151. data/lib/assets/images/rails.png +0 -0
  152. data/lib/assets/images/star.gif +0 -0
  153. data/lib/assets/javascripts/.gitkeep +0 -0
  154. data/lib/assets/javascripts/surveyor_gui/jquery.MetaData.js +121 -0
  155. data/lib/assets/javascripts/surveyor_gui/jquery.blockUI.js +619 -0
  156. data/lib/assets/javascripts/surveyor_gui/jquery.rating.js +377 -0
  157. data/lib/assets/javascripts/surveyor_gui/jquery.validate.js +1188 -0
  158. data/lib/assets/javascripts/surveyor_gui/surveyor_add_ons.js +10 -0
  159. data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +1417 -0
  160. data/lib/assets/stylesheets/.gitkeep +0 -0
  161. data/lib/assets/stylesheets/surveyor_gui/jquery.rating.css +12 -0
  162. data/lib/assets/stylesheets/surveyor_gui/surveyor_add_ons.css +3 -0
  163. data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +650 -0
  164. data/lib/enumerable_extenders.rb +31 -0
  165. data/lib/generators/surveyor_gui/install_generator.rb +57 -0
  166. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_add_ons.js +2 -0
  167. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_gui_all.js +24 -0
  168. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_add_ons.css.sass +1 -0
  169. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_gui_all.css.sass +8 -0
  170. data/lib/generators/surveyor_gui/templates/app/helpers/surveyor_helper.rb +4 -0
  171. data/lib/generators/surveyor_gui/templates/app/models/response_set_user.rb +13 -0
  172. data/lib/generators/surveyor_gui/templates/app/views/layouts/surveyor_gui_default.html.erb +16 -0
  173. data/lib/generators/surveyor_gui/templates/config/initializers/simple_form.rb +140 -0
  174. data/lib/generators/surveyor_gui/templates/config/locales/en.yml +5 -0
  175. data/lib/surveyor_gui.rb +17 -0
  176. data/lib/surveyor_gui/engine.rb +30 -0
  177. data/lib/surveyor_gui/helpers/surveyor_helper_methods.rb +19 -0
  178. data/lib/surveyor_gui/models/answer_methods.rb +24 -0
  179. data/lib/surveyor_gui/models/column_methods.rb +43 -0
  180. data/lib/surveyor_gui/models/dependency_condition_methods.rb +53 -0
  181. data/lib/surveyor_gui/models/dependency_methods.rb +83 -0
  182. data/lib/surveyor_gui/models/question_and_group_shared_methods.rb +11 -0
  183. data/lib/surveyor_gui/models/question_group_methods.rb +55 -0
  184. data/lib/surveyor_gui/models/question_methods.rb +435 -0
  185. data/lib/surveyor_gui/models/question_type_methods.rb +493 -0
  186. data/lib/surveyor_gui/models/response_methods.rb +67 -0
  187. data/lib/surveyor_gui/models/response_set_methods.rb +54 -0
  188. data/lib/surveyor_gui/models/row_methods.rb +11 -0
  189. data/lib/surveyor_gui/models/survey_methods.rb +32 -0
  190. data/lib/surveyor_gui/models/survey_section_methods.rb +32 -0
  191. data/lib/surveyor_gui/surveyforms_controller_methods.rb +258 -0
  192. data/lib/surveyor_gui/version.rb +3 -0
  193. data/lib/tasks/.gitkeep +0 -0
  194. data/lib/tasks/surveyor_gui_tasks.rake +4 -0
  195. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  196. data/spec/controllers/surveyforms_controller_spec.rb +361 -0
  197. data/spec/controllers/surveyor_controller_spec.rb +303 -0
  198. data/spec/factories.rb +181 -0
  199. data/spec/features/create_survey_spec.rb +418 -0
  200. data/spec/features/dependencies_spec.rb +61 -0
  201. data/spec/features/rearrange_survey_spec.rb +118 -0
  202. data/spec/features/ui_spec.rb +469 -0
  203. data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
  204. data/spec/fixtures/chinese_survey.rb +14 -0
  205. data/spec/fixtures/everything.rb +215 -0
  206. data/spec/fixtures/favorites-ish.rb +22 -0
  207. data/spec/fixtures/favorites.rb +22 -0
  208. data/spec/fixtures/feelings.rb +38 -0
  209. data/spec/fixtures/lifestyle.rb +55 -0
  210. data/spec/fixtures/numbers.rb +21 -0
  211. data/spec/fixtures/redcap_new_headers.csv +1 -0
  212. data/spec/fixtures/redcap_siblings.csv +1 -0
  213. data/spec/fixtures/redcap_whitespace.csv +1 -0
  214. data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
  215. data/spec/helpers/surveyor_helper_spec.rb +116 -0
  216. data/spec/lib/common_spec.rb +37 -0
  217. data/spec/lib/parser_spec.rb +393 -0
  218. data/spec/lib/rake_kitchen_sink.rb +42 -0
  219. data/spec/lib/redcap_parser_spec.rb +129 -0
  220. data/spec/lib/unparser_spec.rb +126 -0
  221. data/spec/models/answer_spec.rb +144 -0
  222. data/spec/models/dependency_condition_spec.rb +428 -0
  223. data/spec/models/dependency_spec.rb +90 -0
  224. data/spec/models/question_group_spec.rb +66 -0
  225. data/spec/models/question_spec.rb +176 -0
  226. data/spec/models/response_set_spec.rb +452 -0
  227. data/spec/models/response_spec.rb +208 -0
  228. data/spec/models/survey_section_spec.rb +58 -0
  229. data/spec/models/survey_spec.rb +155 -0
  230. data/spec/models/surveyor_gui/question_spec.rb +60 -0
  231. data/spec/models/surveyor_gui/question_type_spec.rb +268 -0
  232. data/spec/models/validation_condition_spec.rb +98 -0
  233. data/spec/models/validation_spec.rb +64 -0
  234. data/spec/spec.opts +4 -0
  235. data/spec/spec_helper.rb +119 -0
  236. data/spec/support/scenario_outline_helper.rb +39 -0
  237. data/spec/support/shared.rb +10 -0
  238. data/spec/support/surveyforms_creation_helpers.rb +312 -0
  239. data/spec/support/surveyforms_rearrangement_helpers.rb +170 -0
  240. data/spec/support/surveyor_api_helpers.rb +15 -0
  241. data/spec/support/surveyor_ui_helpers.rb +108 -0
  242. data/spec/support/wait_for_ajax.rb +11 -0
  243. data/spec/views/questions/edit.html.erb_spec.rb +73 -0
  244. data/spec/views/surveyforms/edit.html.erb_spec.rb +126 -0
  245. data/surveyor_gui.gemspec +52 -0
  246. data/test/dummy/README.rdoc +261 -0
  247. data/test/dummy/Rakefile +7 -0
  248. data/test/dummy/app/assets/javascripts/application.js +15 -0
  249. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  250. data/test/dummy/app/controllers/application_controller.rb +3 -0
  251. data/test/dummy/app/helpers/application_helper.rb +2 -0
  252. data/test/dummy/app/mailers/.gitkeep +0 -0
  253. data/test/dummy/app/models/.gitkeep +0 -0
  254. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  255. data/test/dummy/config.ru +4 -0
  256. data/test/dummy/config/application.rb +59 -0
  257. data/test/dummy/config/boot.rb +10 -0
  258. data/test/dummy/config/database.yml +25 -0
  259. data/test/dummy/config/environment.rb +5 -0
  260. data/test/dummy/config/environments/development.rb +37 -0
  261. data/test/dummy/config/environments/production.rb +67 -0
  262. data/test/dummy/config/environments/test.rb +37 -0
  263. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  264. data/test/dummy/config/initializers/inflections.rb +15 -0
  265. data/test/dummy/config/initializers/mime_types.rb +5 -0
  266. data/test/dummy/config/initializers/secret_token.rb +7 -0
  267. data/test/dummy/config/initializers/session_store.rb +8 -0
  268. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  269. data/test/dummy/config/locales/en.yml +5 -0
  270. data/test/dummy/config/routes.rb +58 -0
  271. data/test/dummy/lib/assets/.gitkeep +0 -0
  272. data/test/dummy/log/.gitkeep +0 -0
  273. data/test/dummy/public/404.html +26 -0
  274. data/test/dummy/public/422.html +26 -0
  275. data/test/dummy/public/500.html +25 -0
  276. data/test/dummy/public/favicon.ico +0 -0
  277. data/test/dummy/script/rails +6 -0
  278. data/test/surveyor-gui_test.rb +7 -0
  279. data/test/test_helper.rb +15 -0
  280. data/vendor/assets/stylesheets/.gitkeep +0 -0
  281. data/vendor/assets/stylesheets/custom.sass +5 -0
  282. data/vendor/plugins/.gitkeep +0 -0
  283. metadata +664 -0
@@ -0,0 +1,3 @@
1
+ <div class="question_group_element">
2
+ <%= render "question_field", f: f %>
3
+ </div>
@@ -0,0 +1,6 @@
1
+ <!-- Tack a number onto questions, e.g. "3) What is your name?" but don't do it for labels -->
2
+ <% if question_type.id != :label -%>
3
+ <span class="questions">
4
+ <%= (@question_no.to_s+ ') ' + text.to_s)%>
5
+ </span>
6
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <!-- this code makes it possible to call this part of the view from either an ajax call
2
+ or a reference from the survey_sections.html.erb -->
3
+ <% if local_assigns[:f] -%>
4
+ <%= render_questions_and_groups_helper q, s -%>
5
+ <% else -%>
6
+ <%= simple_fields_for 'surveyform', @question.survey_section.survey do |sf| %>
7
+ <%= sf.simple_fields_for :survey_sections do |ss| %>
8
+ <% end %>
9
+ <%= sf.simple_fields_for :survey_sections, @question.survey_section do |ss| %>
10
+ <%= ss.simple_fields_for :questions, @question do |q| %>
11
+ <%= render_questions_and_groups_helper q, ss -%>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end -%>
@@ -0,0 +1,109 @@
1
+ <% @question_no = @question_no + 1 if f.object.id && f.object.question_type_id != :label -%>
2
+ <%= div_for(f.object) do %>
3
+ <fieldset class="
4
+ fields
5
+ questions
6
+ <%= f.object.is_mandatory ? 'mandatory_questions' : 'optional_questions' %>
7
+ <%= !@survey_locked && (f.object.modifiable) ? '' : 'not_modifiable' %>"
8
+ >
9
+ <div class="inner_question">
10
+ <!-- if dependencies, notify the user with a highlighted message at the top of the question -->
11
+ <% if f.object.dependent? -%>
12
+ <span class="question_logic_notifier">
13
+ <!-- list_dependencies tells the user which other questions determine whether this one is displayed -->
14
+ <%= list_dependencies(f.object) if f.object.dependency %>.<br/>
15
+ </span>
16
+ <% end -%>
17
+
18
+ <!-- display the button bar unless a user has already submitted responses, thus locking the survey, or -->
19
+ <!-- the survey is explicitly marked not modifiable (e.g., an administrator locks it). -->
20
+ <% if !@survey_locked && (f.object.modifiable?) -%>
21
+ <span class="fl ui-icon ui-icon-arrowthick-2-n-s"></span>
22
+
23
+ <span class="question_button_bar">
24
+
25
+ <button type="button" id="edit_question"
26
+ data-replace_question_url="<%=url_for(:action => 'replace_question',
27
+ id: f.object.survey_section.survey.id,
28
+ question_id: f.object.id)%>"
29
+ data-edit_question_url="<%=edit_question_url(f.object.id)%>"
30
+ data-question_id="<%= f.object.id.to_s %>"
31
+ >Edit Question</button>
32
+
33
+ <button type="button" id="cut_question"
34
+ data-cut_question_surveyform_url="<%=cut_question_surveyform_url(
35
+ id: f.object.survey_section.survey.id,
36
+ question_id: f.object.id)%>"
37
+ data-question_already_cut="<%= session[:cut_question] %>"
38
+ >Cut Question</button>
39
+
40
+ <button type="button" id="delete_question"
41
+ data-question_url="<%=question_url(f.object.id)%>"
42
+ data-replace_form_surveyform_url="<%= replace_form_surveyform_url(
43
+ id: f.object.survey_section.survey.id,
44
+ survey_section_id: f.object.survey_section_id) %>"
45
+ >Delete Question</button>
46
+
47
+ <span style="float:right;">
48
+
49
+ <% if f.object.dependent? -%>
50
+
51
+ <button type="button" id="delete_logic"
52
+ data-replace_question_url="<%=url_for(:action => 'replace_question', :question_id => f.object.id)%>"
53
+ data-dependency_url="<%= dependency_url(f.object.id) %>"
54
+ data-question_id="<%= f.object.id.to_s %>"
55
+ >Delete Logic</button>
56
+
57
+
58
+ <button type="button" id="edit_logic"
59
+ data-replace_question_url="<%=url_for(:action => 'replace_question', :question_id => f.object.id)%>"
60
+ data-edit_dependency_url="<%= edit_dependency_url(f.object.id) %>"
61
+ data-question_id="<%= f.object.id.to_s %>"
62
+ >Edit Logic</button>
63
+
64
+ <% else -%>
65
+ <button type="button" id="add_logic"
66
+ data-replace_question_url="<%=url_for(:action => 'replace_question',
67
+ id: f.object.survey_section.survey.id,
68
+ question_id: f.object.id)%>"
69
+ data-new_dependency_url="<%= new_dependency_url(:id=>f.object.id) %>"
70
+ data-question_id="<%= f.object.id.to_s %>"
71
+ >Add Logic</button>
72
+ <% end %>
73
+
74
+ </span>
75
+ </span>
76
+
77
+ <% end %>
78
+ <br />
79
+ <br />
80
+ <%= render "question_name_and_number", question_type: f.object.question_type, text: f.object.text %>
81
+ <br />
82
+ <%= render "question_field", f: f %>
83
+ </div>
84
+ </fieldset>
85
+
86
+ <% if !@survey_locked && (f.object.modifiable?) -%>
87
+
88
+ <div class="question_buttons_bottom">
89
+
90
+ <button type="button" id="add_question" class="cut"
91
+ data-insert_new_question_url="<%=insert_new_question_surveyform_url(id: f.object.survey_section.survey.id, ) %>"
92
+ data-new_question_url="<%=new_question_url%>"
93
+ data-prev_question_id="<%= f.object.id.to_s %>"
94
+ >Add Question</button>
95
+
96
+ <% if session[:cut_question] -%>
97
+
98
+ <button type="button" id="paste_question"
99
+ data-paste_question_surveyform_url="<%= paste_question_surveyform_url(
100
+ id: f.object.survey_section.survey.id,
101
+ question_id: f.object.id) %>"
102
+ >Paste Question</button>
103
+
104
+ <% end %>
105
+
106
+ </div>
107
+
108
+ <% end %>
109
+ <% end %>
@@ -0,0 +1,138 @@
1
+ <%= simple_fields_for 'surveyform', @surveyform || @survey_section.survey do |f| %>
2
+ <%= f.simple_fields_for :survey_sections, @survey_section do |s| %>
3
+
4
+ <% if s.object.id -%>
5
+ <%= div_for(s.object) do %>
6
+
7
+ <h2 style='position:relative;'>
8
+
9
+ <span class="fl ui-icon ui-icon-arrowthick-2-n-s"></span>&nbsp;
10
+
11
+ <%= s.object.title %>
12
+
13
+ <div class="section_top_button_bar">
14
+
15
+ <% if !@survey_locked && (s.object.modifiable?) %>
16
+
17
+ <button type="button" id="edit_section_title"
18
+ data-replace_survey_section_url="<%=url_for(
19
+ action: 'replace_survey_section',
20
+ survey_section_id: s.object.id,
21
+ id: f.object.id)%>"
22
+ data-edit_survey_section_url="<%=edit_survey_section_url(s.object.id)%>"
23
+ data-survey_section_id="<%=s.object.id%>"
24
+ >Edit Section Title</button>
25
+
26
+ <% if session[:cut_section] -%>
27
+
28
+ <button type="button" id="paste_section"
29
+ data-paste_section_surveyform_url="<%= paste_section_surveyform_url(survey_section_id: s.object.id, position: 'over') %>"
30
+ >Paste Section</button>
31
+
32
+ <% else -%>
33
+
34
+ <button type="button" id="cut_section"
35
+ data-cut_section_surveyform_url="<%=cut_section_surveyform_url(
36
+ id: f.object.id,
37
+ survey_section_id: s.object.id)%>"
38
+ data-survey_section_id="<%=s.object.id%>"
39
+ data-section_already_cut="<%= session[:cut_section] %>"
40
+ >Cut Section</button>
41
+
42
+ <% end -%>
43
+
44
+ <button type="button" id="delete_section"
45
+ data-survey_section_id="<%=s.object.id%>"
46
+ data-survey_section_url="<%= survey_section_url(s.object.id)%>"
47
+ >Delete Section</button>
48
+
49
+ <% end -%>
50
+
51
+ </div>
52
+
53
+ </h2>
54
+
55
+ <fieldset style="background:white">
56
+ <div class="fields surveysection">
57
+ <%= s.hidden_field :id %>
58
+ <%= s.hidden_field :modifiable %>
59
+
60
+ <% if !@survey_locked && (s.object.modifiable?) -%>
61
+
62
+ <div class="question_buttons_top">
63
+
64
+ <button type="button" id="add_question" class="cut"
65
+ data-insert_new_question_url="<%=insert_new_question_surveyform_url(f.object.id)%>"
66
+ data-new_question_url="<%=new_question_url%>"
67
+ >Add Question</button>
68
+
69
+ <% if session[:cut_question] -%>
70
+
71
+ <button type="button" id="paste_question"
72
+ data-paste_question_surveyform_url="<%= paste_question_surveyform_url(
73
+ id: f.object.id,
74
+ survey_section_id: s.object.id) %>"
75
+ >Paste Question</button>
76
+
77
+ <% end %>
78
+
79
+ </div>
80
+
81
+ <% end %>
82
+
83
+ <div class="sortable_questions" id="sortable_question<%= s.object.id.to_s %>">
84
+ <%= s.simple_fields_for :questions do |q| %>
85
+ <%= render_questions_and_groups_helper q, s %>
86
+ <% end %>
87
+ </div>
88
+
89
+ <% if !@survey_locked && s.object.modifiable %>
90
+
91
+ <div class="button_bar_outer">
92
+ <div class="section_button_bar_bottom_inner">
93
+
94
+ <button type="button" id="add_section"
95
+ data-new_survey_section_url="<%=new_survey_section_url%>"
96
+ data-insert_survey_section_url="<%= url_for(:action => 'insert_survey_section',:id => f.object.id) %>"
97
+ data-survey_section_id="<%= s.object.id.to_s %>"
98
+ data-survey_id="<%= s.object.survey.id.to_s %>"
99
+ >Add Section</button>
100
+
101
+ <% if session[:cut_section] -%>
102
+
103
+ <button type="button" id="paste_section"
104
+ data-paste_section_surveyform_url="<%= paste_section_surveyform_url(:survey_section_id => s.object.id) %>"
105
+ >Paste Section</button>
106
+
107
+ <% end -%>
108
+
109
+ </div>
110
+ </div>
111
+
112
+ <% end -%>
113
+
114
+ </div>
115
+ </fieldset>
116
+ <% end %>
117
+ <% else -%>
118
+ <%= s.hidden_field :id %>
119
+ <%= s.hidden_field :title %>
120
+ <%= s.hidden_field :display_order %>
121
+ <%= s.hidden_field :modifiable %>
122
+ <%= s.simple_fields_for :questions do |q| %>
123
+ <%= q.hidden_field :id %>
124
+ <%= q.hidden_field :text %>
125
+ <%= q.hidden_field :display_order %>
126
+ <%= q.hidden_field :pick %>
127
+ <%= q.hidden_field :display_type %>
128
+ <%= q.hidden_field :question_group_id %>
129
+ <%= q.hidden_field :modifiable %>
130
+ <%= q.simple_fields_for :answers do |a| %>
131
+ <%= a.hidden_field :text %>
132
+ <%= a.hidden_field :response_class %>
133
+ <%= a.hidden_field :display_order %>
134
+ <% end %>
135
+ <% end %>
136
+ <% end %>
137
+ <% end %>
138
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ <div class="column3">
2
+ <div class="shadebox round">
3
+ <div id="survey">
4
+ <h1 class="round-top"><%= @title %></h1>
5
+ <%= simple_form_for @surveyform, :url => create_cloned_surveyform_path do |f| %>
6
+ <%= f.error_messages %>
7
+ <%= f.hidden_field :id %>
8
+ <%= f.input :title, :label => "New Title",:hint => 'Name this survey, questionnaire, or form', :input_html=>{:style=>'width:25em;'}, :label_html=>{:style=>'width:6em;'}%>
9
+ <%= f.button :submit, @title %>
10
+ <% end %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,5 @@
1
+ <%= render 'form' %>
2
+ <p class="floatdown">
3
+ <%= link_to "Show", @surveyform %> |
4
+ <%= link_to "View All", surveyforms_path %>
5
+ </p>
@@ -0,0 +1,40 @@
1
+ <div class="column2">
2
+ <div class="shadebox round">
3
+ <div id="survey">
4
+ <h1 class="round-top"><%= @title %></h1>
5
+ <%= form_tag surveyforms_path, :method => 'get' do %>
6
+ <p>
7
+ <%= text_field_tag :search, params[:search] %>
8
+ <%= submit_tag "Search", :name => nil %>
9
+ </p>
10
+ <% end %>
11
+ <%= will_paginate %>
12
+ <br />
13
+ <table>
14
+ <tr>
15
+ <th>Title</th>
16
+ <th>Version</th>
17
+ <th>Actions</th>
18
+ </tr>
19
+ <% for survey in @surveyforms %>
20
+ <tr>
21
+ <td><%= survey.title %></td>
22
+ <td><%= survey.survey_version %></td>
23
+ <td><%= link_to "Show", survey %>&nbsp
24
+ <%= link_to "Edit", edit_surveyform_path(survey) %>&nbsp
25
+ <%= link_to "Clone", clone_survey_surveyform_path(survey) %>&nbsp
26
+ <%= link_to "Destroy", survey, data: { confirm: 'Are you sure?' }, :method => :delete %>&nbsp;
27
+ <%= link_to "Run Report", surveyor_gui_report_path(survey) %> &nbsp;
28
+ <%= link_to "View Responses" , surveyor_gui_responses_path(id: survey) %></td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+ <br />
33
+ <%= will_paginate %>
34
+ <p>
35
+ <%= link_to "New Survey", new_surveyform_path() %>&nbsp
36
+ <%= link_to "Take a Survey", surveyor.available_surveys_path %>&nbsp
37
+ </p>
38
+ </div>
39
+ </div>
40
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,5 @@
1
+ <%= render 'form' %>
2
+ <p class="floatdown">
3
+ <%= link_to "Edit", edit_surveyform_path(@surveyform.id) %>&nbsp |
4
+ <%= link_to "View All", surveyforms_path %>
5
+ </p>
@@ -0,0 +1,21 @@
1
+ - if [:pick_one,:pick_any,:dropdown,:number,:date,:datetime,:time,:stars,:slider,:grid_one, :grid_any, :grid_dropdown].include? q.question_type_id
2
+ %tr{:class => q.surveyresponse_class(@response_sets)}
3
+ %td &nbsp;
4
+ %tr{:class => q.surveyresponse_class(@response_sets)}
5
+ %td
6
+ %td
7
+ %td
8
+ - if q.display_type=='stars'
9
+ - 10.times.each do |index|
10
+ %input{name: "star#{q.id.to_s}", type: "radio", class: "star {split:2}", disabled: "disabled", checked: (index+1)==star_average(@responses,q) ? "checked" : nil}
11
+ - else
12
+ %div{:id => "hi_chart#{q.id}", :style => "height:410px; margin: 0; clear:both; min-width: 800px"}
13
+ = high_chart("hi_chart"+q.id.to_s , @chart[q.id.to_s]) do
14
+ - if q.pick == 'one' && !([:grid_one, :grid_dropdown].include? q.question_type_id)
15
+ = "options.tooltip.formatter = function() {return '<b>'+ this.point.name +'</b>: '+ this.y;}".html_safe
16
+ = "options.plotOptions.pie.dataLabels = {}".html_safe
17
+ = "options.plotOptions.pie.dataLabels.formatter = function() {return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed()+' %';}".html_safe
18
+ - elsif q.question_type_id == :grid_dropdown
19
+ = "options.plotOptions.column.dataLabels.formatter = function() {if(this.y != 0) {return this.y;}}"
20
+ - else
21
+ = "options.tooltip.formatter = function() {return '<b>'+ this.x +'</b>: '+ this.y;}".html_safe
@@ -0,0 +1,42 @@
1
+ = render "graphs", q: question_group.questions.first
2
+ = render "surveyor_gui/shared/new_line"
3
+ %tr
4
+ %td &nbsp;
5
+ %td &nbsp;
6
+ %td
7
+ %table.report_data.report_data_display
8
+ %tr{:style => "font-weight:bold;"}
9
+ %td User Id
10
+ %td
11
+ - question_group.questions.is_not_comment.first.answers.each do |answer|
12
+ %td
13
+ = answer.text
14
+ - @response_sets.each do |response_set|
15
+ - question_group.questions.is_not_comment.each_with_index do |question, index|
16
+ %tr{class: index==0 ? "first_row" : nil}
17
+ %td
18
+ %span.user_id
19
+ = response_set.report_user_name
20
+ %td
21
+ = question.text
22
+ - question.answers.each do |answer|
23
+ %td
24
+ - if Response.where(response_set_id: response_set.id, question_id: question.id, answer_id: answer.id).count > 0
25
+ .ui-icon.ui-icon-check
26
+ = render "surveyor_gui/shared/grid_comments", question_group: question_group
27
+ = render "surveyor_gui/shared/new_line"
28
+ %table.report_data_functions
29
+ %tr
30
+ %td{:style => "font-weight:bold;"}
31
+ &nbsp;
32
+ - question_group.questions.first.answers.each do |answer|
33
+ %td{:style => "font-weight:bold;"}
34
+ = answer.text
35
+ - question_group.questions.each do |q|
36
+ %tr
37
+ %td
38
+ = q.text
39
+ - q.answers.each do |answer|
40
+ %td.table_number
41
+ = @responses.where(question_id: q.id, answer_id: answer.id).count
42
+ = render "surveyor_gui/shared/new_line"
@@ -0,0 +1,56 @@
1
+ - question_group.questions.each do |q|
2
+ = render "graphs", q: q
3
+ = render "surveyor_gui/shared/new_line"
4
+ %table.report_data.report_data_display
5
+ %tr{:style => "font-weight:bold;"}
6
+ %td &nbsp;
7
+ %td &nbsp;
8
+ %td User Id
9
+ %td
10
+ - question_group.columns.each do |column|
11
+ %td
12
+ = column.text
13
+ - @response_sets.each do |response_set|
14
+ - question_group.questions.is_not_comment.each_with_index do |question, index|
15
+ %tr{class: index==0 ? "first_row" : nil}
16
+ %td &nbsp;
17
+ %td &nbsp;
18
+ %td
19
+ %span.user_id
20
+ = response_set.report_user_name
21
+ %td
22
+ = question.text
23
+ - question_group.columns.each do |column|
24
+ %td
25
+ -if (response = Response.where(response_set_id: response_set.id, question_id: question.id, column_id: column.id).first)
26
+ = response.answer.text
27
+ = render "surveyor_gui/shared/grid_comments", question_group: question_group
28
+ = render "surveyor_gui/shared/new_line"
29
+ %table.report_data_functions
30
+ %tr
31
+ %td &nbsp;
32
+ %td &nbsp;
33
+ %td{:style => "font-weight:bold;"}
34
+ &nbsp;
35
+ - question_group.columns.each do |column|
36
+ %td{style: "font-weight:bold; text-align: center;", colspan: "#{column.answers.count/question_group.questions.count}"}
37
+ = column.text
38
+ %tr
39
+ %td &nbsp;
40
+ %td &nbsp;
41
+ %td
42
+ - question_group.columns.each do |column|
43
+ - column.answers.map{|a| a.text}.uniq.each do |answer|
44
+ %td
45
+ = answer
46
+ - question_group.questions.is_not_comment.each do |q|
47
+ %tr
48
+ %td &nbsp;
49
+ %td &nbsp;
50
+ %td
51
+ = q.text
52
+ - question_group.columns.each do |column|
53
+ - Answer.where(question_id: q.id, column_id: column.id).each do |a|
54
+ %td.table_number
55
+ = @responses.where(question_id: q.id, column_id: column.id, answer_id: a.id).count
56
+ = render "surveyor_gui/shared/new_line"