upgrade_surveyor_gui 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/.travis.yml +17 -0
  4. data/CHANGELOG.md +46 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE +21 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +244 -0
  9. data/Rakefile +66 -0
  10. data/app/controllers/surveyor_controller.rb +89 -0
  11. data/app/controllers/surveyor_gui/answers_controller.rb +3 -0
  12. data/app/controllers/surveyor_gui/application_controller.rb +3 -0
  13. data/app/controllers/surveyor_gui/dependencys_controller.rb +286 -0
  14. data/app/controllers/surveyor_gui/question_groups_controller.rb +90 -0
  15. data/app/controllers/surveyor_gui/questions_controller.rb +187 -0
  16. data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
  17. data/app/controllers/surveyor_gui/responses_controller.rb +41 -0
  18. data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
  19. data/app/controllers/surveyor_gui/survey_sections_controller.rb +80 -0
  20. data/app/controllers/surveyor_gui/surveyforms_controller.rb +4 -0
  21. data/app/facades/report_formatter.rb +46 -0
  22. data/app/facades/report_preview_wrapper.rb +11 -0
  23. data/app/facades/report_response_generator.rb +147 -0
  24. data/app/helpers/surveyor_gui/application_helper.rb +2 -0
  25. data/app/helpers/surveyor_gui/dependencys_helper.rb +5 -0
  26. data/app/helpers/surveyor_gui/question_groups_helper.rb +3 -0
  27. data/app/helpers/surveyor_gui/questions_helper.rb +22 -0
  28. data/app/helpers/surveyor_gui/reports_helper.rb +19 -0
  29. data/app/helpers/surveyor_gui/surveyforms_helper.rb +164 -0
  30. data/app/helpers/surveyor_helper.rb +4 -0
  31. data/app/inputs/currency_input.rb +5 -0
  32. data/app/inputs/date_picker_input.rb +7 -0
  33. data/app/inputs/datetime_picker_input.rb +5 -0
  34. data/app/inputs/percent_input.rb +5 -0
  35. data/app/inputs/time_picker_input.rb +5 -0
  36. data/app/mailers/.gitkeep +0 -0
  37. data/app/models/.gitkeep +0 -0
  38. data/app/models/answer.rb +4 -0
  39. data/app/models/column.rb +3 -0
  40. data/app/models/dependency.rb +4 -0
  41. data/app/models/dependency_condition.rb +4 -0
  42. data/app/models/permitted_params_decorator.rb +80 -0
  43. data/app/models/question.rb +4 -0
  44. data/app/models/question_group.rb +4 -0
  45. data/app/models/question_group_tracker.rb +19 -0
  46. data/app/models/question_type.rb +7 -0
  47. data/app/models/response.rb +4 -0
  48. data/app/models/response_set.rb +4 -0
  49. data/app/models/row.rb +3 -0
  50. data/app/models/survey.rb +4 -0
  51. data/app/models/survey_section.rb +4 -0
  52. data/app/models/surveyform.rb +103 -0
  53. data/app/uploaders/blob_uploader.rb +48 -0
  54. data/app/views/layouts/surveyor_gui/application.html.erb +14 -0
  55. data/app/views/layouts/surveyor_gui/surveyor_gui_blank.html.erb +13 -0
  56. data/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
  57. data/app/views/layouts/surveyor_gui/surveyor_modified.html.erb +14 -0
  58. data/app/views/partials/_answer.html.haml +33 -0
  59. data/app/views/partials/_question.html.haml +33 -0
  60. data/app/views/partials/_question_group.html.haml +73 -0
  61. data/app/views/partials/_section.html.haml +13 -0
  62. data/app/views/surveyor/edit.html.haml +21 -0
  63. data/app/views/surveyor_gui/dependencys/_column.html.erb +1 -0
  64. data/app/views/surveyor_gui/dependencys/_dependency.html.erb +22 -0
  65. data/app/views/surveyor_gui/dependencys/_dependency_condition_fields.html.erb +48 -0
  66. data/app/views/surveyor_gui/dependencys/_form.html.erb +20 -0
  67. data/app/views/surveyor_gui/dependencys/blank.html.erb +0 -0
  68. data/app/views/surveyor_gui/dependencys/edit.html.erb +1 -0
  69. data/app/views/surveyor_gui/dependencys/new.html.erb +1 -0
  70. data/app/views/surveyor_gui/partials/_url_helpers.html.erb +5 -0
  71. data/app/views/surveyor_gui/question_groups/_form.html.erb +57 -0
  72. data/app/views/surveyor_gui/question_groups/_group_inline_field.html.erb +21 -0
  73. data/app/views/surveyor_gui/question_groups/_group_inline_fields.html.erb +25 -0
  74. data/app/views/surveyor_gui/question_groups/blank.html.erb +0 -0
  75. data/app/views/surveyor_gui/question_groups/edit.html.erb +1 -0
  76. data/app/views/surveyor_gui/question_groups/new.html.erb +1 -0
  77. data/app/views/surveyor_gui/questions/_answer_fields.html.erb +23 -0
  78. data/app/views/surveyor_gui/questions/_answer_options.html.erb +28 -0
  79. data/app/views/surveyor_gui/questions/_form.html.erb +66 -0
  80. data/app/views/surveyor_gui/questions/_grid_dropdown_columns.html.erb +10 -0
  81. data/app/views/surveyor_gui/questions/_grid_dropdown_fields.html.erb +42 -0
  82. data/app/views/surveyor_gui/questions/_grid_fields.html.erb +9 -0
  83. data/app/views/surveyor_gui/questions/_no_picks.html.erb +29 -0
  84. data/app/views/surveyor_gui/questions/_pick.html +21 -0
  85. data/app/views/surveyor_gui/questions/_picks.html.erb +12 -0
  86. data/app/views/surveyor_gui/questions/blank.html.erb +0 -0
  87. data/app/views/surveyor_gui/questions/edit.html.erb +1 -0
  88. data/app/views/surveyor_gui/questions/new.html.erb +1 -0
  89. data/app/views/surveyor_gui/reports/_graphs.html.haml +21 -0
  90. data/app/views/surveyor_gui/reports/_grid.html.haml +42 -0
  91. data/app/views/surveyor_gui/reports/_grid_dropdown.html.haml +56 -0
  92. data/app/views/surveyor_gui/reports/_repeater.html.haml +27 -0
  93. data/app/views/surveyor_gui/reports/_show_report.html.haml +33 -0
  94. data/app/views/surveyor_gui/reports/_single_question.html.haml +70 -0
  95. data/app/views/surveyor_gui/reports/show.html.erb +14 -0
  96. data/app/views/surveyor_gui/responses/_grid.html.haml +20 -0
  97. data/app/views/surveyor_gui/responses/_grid_dropdown.html.haml +20 -0
  98. data/app/views/surveyor_gui/responses/_repeater.html.haml +22 -0
  99. data/app/views/surveyor_gui/responses/_survey_results.html.haml +40 -0
  100. data/app/views/surveyor_gui/responses/index.html.haml +24 -0
  101. data/app/views/surveyor_gui/responses/show.html.haml +42 -0
  102. data/app/views/surveyor_gui/shared/_grid_comments.html.haml +10 -0
  103. data/app/views/surveyor_gui/shared/_new_line.html.haml +2 -0
  104. data/app/views/surveyor_gui/shared/_pick_comments.html.haml +15 -0
  105. data/app/views/surveyor_gui/shared/_question_number.html.haml +11 -0
  106. data/app/views/surveyor_gui/shared/_report_data.html.haml +27 -0
  107. data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
  108. data/app/views/surveyor_gui/survey_sections/_form.html.erb +13 -0
  109. data/app/views/surveyor_gui/survey_sections/blank.html.erb +0 -0
  110. data/app/views/surveyor_gui/survey_sections/edit.html.erb +1 -0
  111. data/app/views/surveyor_gui/survey_sections/new.html.erb +1 -0
  112. data/app/views/surveyor_gui/surveyforms/_form.html.erb +50 -0
  113. data/app/views/surveyor_gui/surveyforms/_question_field.html.erb +148 -0
  114. data/app/views/surveyor_gui/surveyforms/_question_group.html.erb +116 -0
  115. data/app/views/surveyor_gui/surveyforms/_question_group_fields.html.erb +3 -0
  116. data/app/views/surveyor_gui/surveyforms/_question_name_and_number.html.erb +6 -0
  117. data/app/views/surveyor_gui/surveyforms/_question_section.html.erb +15 -0
  118. data/app/views/surveyor_gui/surveyforms/_question_wrapper.html.erb +108 -0
  119. data/app/views/surveyor_gui/surveyforms/_survey_section_fields.html.erb +137 -0
  120. data/app/views/surveyor_gui/surveyforms/clone_survey.html.erb +13 -0
  121. data/app/views/surveyor_gui/surveyforms/edit.html.erb +5 -0
  122. data/app/views/surveyor_gui/surveyforms/index.html.erb +40 -0
  123. data/app/views/surveyor_gui/surveyforms/new.html.erb +1 -0
  124. data/app/views/surveyor_gui/surveyforms/show.html.erb +5 -0
  125. data/config/environment.rb +0 -0
  126. data/config/routes.rb +71 -0
  127. data/config.ru +4 -0
  128. data/db/migrate/20140307204049_add_template_to_surveys.rb +5 -0
  129. data/db/migrate/20140307235607_add_test_data_to_response_sets.rb +5 -0
  130. data/db/migrate/20140308171947_add_original_choice_to_answers.rb +5 -0
  131. data/db/migrate/20140308172118_add_blob_to_responses.rb +5 -0
  132. data/db/migrate/20140308172417_add_modifiable_to_survey_section.rb +5 -0
  133. data/db/migrate/20140308174532_add_modifiable_to_question.rb +5 -0
  134. data/db/migrate/20140308175305_add_dynamically_generate_to_questions.rb +5 -0
  135. data/db/migrate/20140311032923_add_dummy_blob_to_questions.rb +5 -0
  136. data/db/migrate/20140311160609_add_dynamic_source_to_questions.rb +5 -0
  137. data/db/migrate/20140311161714_add_report_code_to_questions.rb +5 -0
  138. data/db/migrate/20140530181134_add_is_comment_to_questions.rb +5 -0
  139. data/db/migrate/20140531012006_add_is_comment_to_answers.rb +5 -0
  140. data/db/migrate/20140531225529_create_rows.rb +9 -0
  141. data/db/migrate/20140601011151_create_columns.rb +11 -0
  142. data/db/migrate/20140602030330_add_column_id_to_answers.rb +5 -0
  143. data/db/migrate/20140603155606_add_column_id_to_responses.rb +5 -0
  144. data/db/migrate/20140606023527_add_column_id_to_dependency_conditions.rb +5 -0
  145. data/db/migrate/20140815165307_add_user_id_to_survey.rb +5 -0
  146. data/lib/assets/.gitkeep +0 -0
  147. data/lib/assets/images/addicon.png +0 -0
  148. data/lib/assets/images/datepicker.gif +0 -0
  149. data/lib/assets/images/delete.gif +0 -0
  150. data/lib/assets/images/delete.png +0 -0
  151. data/lib/assets/images/images/border.png +0 -0
  152. data/lib/assets/images/images/controls.png +0 -0
  153. data/lib/assets/images/images/loading.gif +0 -0
  154. data/lib/assets/images/images/loading_background.png +0 -0
  155. data/lib/assets/images/images/overlay.png +0 -0
  156. data/lib/assets/images/rails.png +0 -0
  157. data/lib/assets/images/star.gif +0 -0
  158. data/lib/assets/javascripts/.gitkeep +0 -0
  159. data/lib/assets/javascripts/surveyor_gui/jquery.MetaData.js +121 -0
  160. data/lib/assets/javascripts/surveyor_gui/jquery.blockUI.js +619 -0
  161. data/lib/assets/javascripts/surveyor_gui/jquery.rating.js +377 -0
  162. data/lib/assets/javascripts/surveyor_gui/jquery.validate.js +1188 -0
  163. data/lib/assets/javascripts/surveyor_gui/surveyor_add_ons.js +10 -0
  164. data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +1428 -0
  165. data/lib/assets/stylesheets/.gitkeep +0 -0
  166. data/lib/assets/stylesheets/surveyor_gui/jquery.rating.css +12 -0
  167. data/lib/assets/stylesheets/surveyor_gui/surveyor_add_ons.css +3 -0
  168. data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +652 -0
  169. data/lib/enumerable_extenders.rb +31 -0
  170. data/lib/generators/surveyor_gui/install_generator.rb +57 -0
  171. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_add_ons.js +2 -0
  172. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_gui_all.js +24 -0
  173. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_add_ons.css.sass +1 -0
  174. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_gui_all.css.sass +8 -0
  175. data/lib/generators/surveyor_gui/templates/app/helpers/surveyor_helper.rb +4 -0
  176. data/lib/generators/surveyor_gui/templates/app/models/response_set_user.rb +13 -0
  177. data/lib/generators/surveyor_gui/templates/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
  178. data/lib/generators/surveyor_gui/templates/config/initializers/simple_form.rb +140 -0
  179. data/lib/generators/surveyor_gui/templates/config/locales/en.yml +5 -0
  180. data/lib/surveyor_gui/engine.rb +31 -0
  181. data/lib/surveyor_gui/helpers/surveyor_helper_methods.rb +19 -0
  182. data/lib/surveyor_gui/models/answer_methods.rb +24 -0
  183. data/lib/surveyor_gui/models/column_methods.rb +43 -0
  184. data/lib/surveyor_gui/models/dependency_condition_methods.rb +53 -0
  185. data/lib/surveyor_gui/models/dependency_methods.rb +83 -0
  186. data/lib/surveyor_gui/models/question_and_group_shared_methods.rb +11 -0
  187. data/lib/surveyor_gui/models/question_group_methods.rb +55 -0
  188. data/lib/surveyor_gui/models/question_methods.rb +435 -0
  189. data/lib/surveyor_gui/models/question_type_methods.rb +493 -0
  190. data/lib/surveyor_gui/models/response_methods.rb +71 -0
  191. data/lib/surveyor_gui/models/response_set_methods.rb +56 -0
  192. data/lib/surveyor_gui/models/row_methods.rb +11 -0
  193. data/lib/surveyor_gui/models/survey_methods.rb +32 -0
  194. data/lib/surveyor_gui/models/survey_section_methods.rb +32 -0
  195. data/lib/surveyor_gui/surveyforms_controller_methods.rb +258 -0
  196. data/lib/surveyor_gui/version.rb +3 -0
  197. data/lib/surveyor_gui.rb +17 -0
  198. data/lib/tasks/.gitkeep +0 -0
  199. data/lib/tasks/surveyor_gui_tasks.rake +4 -0
  200. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  201. data/spec/controllers/surveyforms_controller_spec.rb +362 -0
  202. data/spec/controllers/surveyor_controller_spec.rb +303 -0
  203. data/spec/factories.rb +181 -0
  204. data/spec/features/create_survey_spec.rb +417 -0
  205. data/spec/features/dependencies_spec.rb +65 -0
  206. data/spec/features/make_and_take_spec.rb +187 -0
  207. data/spec/features/rearrange_survey_spec.rb +118 -0
  208. data/spec/features/ui_spec.rb +469 -0
  209. data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
  210. data/spec/fixtures/chinese_survey.rb +14 -0
  211. data/spec/fixtures/everything.rb +215 -0
  212. data/spec/fixtures/favorites-ish.rb +22 -0
  213. data/spec/fixtures/favorites.rb +22 -0
  214. data/spec/fixtures/feelings.rb +38 -0
  215. data/spec/fixtures/lifestyle.rb +55 -0
  216. data/spec/fixtures/numbers.rb +21 -0
  217. data/spec/fixtures/redcap_new_headers.csv +1 -0
  218. data/spec/fixtures/redcap_siblings.csv +1 -0
  219. data/spec/fixtures/redcap_whitespace.csv +1 -0
  220. data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
  221. data/spec/helpers/surveyor_helper_spec.rb +116 -0
  222. data/spec/lib/common_spec.rb +37 -0
  223. data/spec/lib/parser_spec.rb +393 -0
  224. data/spec/lib/rake_kitchen_sink.rb +42 -0
  225. data/spec/lib/redcap_parser_spec.rb +129 -0
  226. data/spec/lib/unparser_spec.rb +126 -0
  227. data/spec/models/answer_spec.rb +144 -0
  228. data/spec/models/dependency_condition_spec.rb +428 -0
  229. data/spec/models/dependency_spec.rb +90 -0
  230. data/spec/models/question_group_spec.rb +66 -0
  231. data/spec/models/question_spec.rb +176 -0
  232. data/spec/models/response_set_spec.rb +452 -0
  233. data/spec/models/response_spec.rb +208 -0
  234. data/spec/models/survey_section_spec.rb +58 -0
  235. data/spec/models/survey_spec.rb +155 -0
  236. data/spec/models/surveyor_gui/question_spec.rb +60 -0
  237. data/spec/models/surveyor_gui/question_type_spec.rb +268 -0
  238. data/spec/models/validation_condition_spec.rb +98 -0
  239. data/spec/models/validation_spec.rb +64 -0
  240. data/spec/spec.opts +4 -0
  241. data/spec/spec_helper.rb +119 -0
  242. data/spec/support/scenario_outline_helper.rb +39 -0
  243. data/spec/support/shared.rb +10 -0
  244. data/spec/support/surveyforms_creation_helpers.rb +313 -0
  245. data/spec/support/surveyforms_rearrangement_helpers.rb +170 -0
  246. data/spec/support/surveyor_api_helpers.rb +15 -0
  247. data/spec/support/surveyor_ui_helpers.rb +108 -0
  248. data/spec/support/wait_for_ajax.rb +11 -0
  249. data/spec/views/questions/edit.html.erb_spec.rb +74 -0
  250. data/spec/views/surveyforms/edit.html.erb_spec.rb +126 -0
  251. data/surveyor_gui.gemspec +52 -0
  252. data/test/dummy/README.rdoc +261 -0
  253. data/test/dummy/Rakefile +7 -0
  254. data/test/dummy/app/assets/javascripts/application.js +15 -0
  255. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  256. data/test/dummy/app/controllers/application_controller.rb +3 -0
  257. data/test/dummy/app/helpers/application_helper.rb +2 -0
  258. data/test/dummy/app/mailers/.gitkeep +0 -0
  259. data/test/dummy/app/models/.gitkeep +0 -0
  260. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  261. data/test/dummy/config/application.rb +59 -0
  262. data/test/dummy/config/boot.rb +10 -0
  263. data/test/dummy/config/database.yml +25 -0
  264. data/test/dummy/config/environment.rb +5 -0
  265. data/test/dummy/config/environments/development.rb +37 -0
  266. data/test/dummy/config/environments/production.rb +67 -0
  267. data/test/dummy/config/environments/test.rb +37 -0
  268. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  269. data/test/dummy/config/initializers/inflections.rb +15 -0
  270. data/test/dummy/config/initializers/mime_types.rb +5 -0
  271. data/test/dummy/config/initializers/secret_token.rb +7 -0
  272. data/test/dummy/config/initializers/session_store.rb +8 -0
  273. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  274. data/test/dummy/config/locales/en.yml +5 -0
  275. data/test/dummy/config/routes.rb +58 -0
  276. data/test/dummy/config.ru +4 -0
  277. data/test/dummy/lib/assets/.gitkeep +0 -0
  278. data/test/dummy/log/.gitkeep +0 -0
  279. data/test/dummy/public/404.html +26 -0
  280. data/test/dummy/public/422.html +26 -0
  281. data/test/dummy/public/500.html +25 -0
  282. data/test/dummy/public/favicon.ico +0 -0
  283. data/test/dummy/script/rails +6 -0
  284. data/test/surveyor-gui_test.rb +7 -0
  285. data/test/test_helper.rb +15 -0
  286. data/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +0 -0
  287. data/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +0 -0
  288. data/vendor/assets/stylesheets/.gitkeep +0 -0
  289. data/vendor/assets/stylesheets/custom.sass +5 -0
  290. data/vendor/plugins/.gitkeep +0 -0
  291. metadata +600 -0
@@ -0,0 +1,116 @@
1
+ <% @question_no = @question_no + 1 if f.object.id && f.object.question_type != '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.question_group.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.question_group) if f.object.question_group.dependent? %>.<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="<%=surveyor_gui.replace_question_surveyform_path(
27
+ id: f.object.survey_section.survey.id,
28
+ question_id: f.object.id)%>"
29
+ data-edit_question_url="<%= (f.object.part_of_group? && f.object.question_group.display_type != 'grid') ? surveyor_gui.edit_question_group_url(f.object.question_group.id) : surveyor_gui.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="<%=surveyor_gui.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="<%=surveyor_gui.question_url(f.object.id)%>"
42
+ data-replace_form_surveyform_url="<%= surveyor_gui.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.question_group.dependent? -%>
50
+
51
+ <button type="button" id="delete_logic"
52
+ data-replace_question_url="<%=surveyor_gui.replace_question_surveyform_path(:question_id => f.object.id)%>"
53
+ data-dependency_url="<%= surveyor_gui.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="<%=surveyor_gui.replace_question_surveyform_path(:question_id => f.object.id)%>"
60
+ data-edit_dependency_url="<%= surveyor_gui.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="<%=surveyor_gui.replace_question_surveyform_path(
67
+ id: f.object.survey_section.survey.id,
68
+ question_id: f.object.id)%>"
69
+ data-new_dependency_url="<%= surveyor_gui.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.question_group.text %>
81
+ <br />
82
+ <div class="question_group <%= question_group_class(f.object) %> <%= f.object.repeater? ? "repeater" : nil %>">
83
+ <div class="question_group_header">
84
+ <span class="question_group_heading">&nbsp;</span>
85
+ <%= question_group_heading(f) %>
86
+ </div>
87
+ <%= render_one_group ss -%>
88
+ </div>
89
+
90
+ </div>
91
+ </fieldset>
92
+
93
+ <% if !@survey_locked && (f.object.modifiable?) -%>
94
+
95
+ <div class="question_buttons_bottom">
96
+
97
+ <button type="button" id="add_question" class="cut"
98
+ data-insert_new_question_url="<%=surveyor_gui.insert_new_question_surveyform_url(id: f.object.survey_section.survey.id, ) %>"
99
+ data-new_question_url="<%=surveyor_gui.new_question_url%>"
100
+ data-prev_question_id="<%= f.object.id.to_s %>"
101
+ >Add Question</button>
102
+
103
+ <% if session[:cut_question] -%>
104
+
105
+ <button type="button" id="paste_question"
106
+ data-paste_question_surveyform_url="<%= surveyor_gui.paste_question_surveyform_url(
107
+ id: f.object.survey_section.survey.id,
108
+ question_id: f.object.id) %>"
109
+ >Paste Question</button>
110
+
111
+ <% end %>
112
+
113
+ </div>
114
+
115
+ <% end %>
116
+ <% end %>
@@ -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,108 @@
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="<%=surveyor_gui.replace_question_surveyform_path(id: f.object.survey_section.survey.id,
27
+ question_id: f.object.id)%>"
28
+ data-edit_question_url="<%=surveyor_gui.edit_question_url(f.object.id)%>"
29
+ data-question_id="<%= f.object.id.to_s %>"
30
+ >Edit Question</button>
31
+
32
+ <button type="button" id="cut_question"
33
+ data-cut_question_surveyform_url="<%=surveyor_gui.cut_question_surveyform_url(
34
+ id: f.object.survey_section.survey.id,
35
+ question_id: f.object.id)%>"
36
+ data-question_already_cut="<%= session[:cut_question] %>"
37
+ >Cut Question</button>
38
+
39
+ <button type="button" id="delete_question"
40
+ data-question_url="<%=surveyor_gui.question_url(f.object.id)%>"
41
+ data-replace_form_surveyform_url="<%= surveyor_gui.replace_form_surveyform_url(
42
+ id: f.object.survey_section.survey.id,
43
+ survey_section_id: f.object.survey_section_id) %>"
44
+ >Delete Question</button>
45
+
46
+ <span style="float:right;">
47
+
48
+ <% if f.object.dependent? -%>
49
+
50
+ <button type="button" id="delete_logic"
51
+ data-replace_question_url="<%=surveyor_gui.replace_question_surveyform_path(:question_id => f.object.id)%>"
52
+ data-dependency_url="<%= surveyor_gui.dependency_url(f.object.id) %>"
53
+ data-question_id="<%= f.object.id.to_s %>"
54
+ >Delete Logic</button>
55
+
56
+
57
+ <button type="button" id="edit_logic"
58
+ data-replace_question_url="<%=surveyor_gui.replace_question_surveyform_path(:question_id => f.object.id)%>"
59
+ data-edit_dependency_url="<%= surveyor_gui.edit_dependency_url(f.object.id) %>"
60
+ data-question_id="<%= f.object.id.to_s %>"
61
+ >Edit Logic</button>
62
+
63
+ <% else -%>
64
+ <button type="button" id="add_logic"
65
+ data-replace_question_url="<%=surveyor_gui.replace_question_surveyform_path(
66
+ id: f.object.survey_section.survey.id,
67
+ question_id: f.object.id)%>"
68
+ data-new_dependency_url="<%= surveyor_gui.new_dependency_url(:id=>f.object.id) %>"
69
+ data-question_id="<%= f.object.id.to_s %>"
70
+ >Add Logic</button>
71
+ <% end %>
72
+
73
+ </span>
74
+ </span>
75
+
76
+ <% end %>
77
+ <br />
78
+ <br />
79
+ <%= render "question_name_and_number", question_type: f.object.question_type, text: f.object.text %>
80
+ <br />
81
+ <%= render "question_field", f: f %>
82
+ </div>
83
+ </fieldset>
84
+
85
+ <% if !@survey_locked && (f.object.modifiable?) -%>
86
+
87
+ <div class="question_buttons_bottom">
88
+
89
+ <button type="button" id="add_question" class="cut"
90
+ data-insert_new_question_url="<%=surveyor_gui.insert_new_question_surveyform_url(id: f.object.survey_section.survey.id, ) %>"
91
+ data-new_question_url="<%=surveyor_gui.new_question_url%>"
92
+ data-prev_question_id="<%= f.object.id.to_s %>"
93
+ >Add Question</button>
94
+
95
+ <% if session[:cut_question] -%>
96
+
97
+ <button type="button" id="paste_question"
98
+ data-paste_question_surveyform_url="<%= surveyor_gui.paste_question_surveyform_url(
99
+ id: f.object.survey_section.survey.id,
100
+ question_id: f.object.id) %>"
101
+ >Paste Question</button>
102
+
103
+ <% end %>
104
+
105
+ </div>
106
+
107
+ <% end %>
108
+ <% end %>
@@ -0,0 +1,137 @@
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="<%=surveyor_gui.replace_survey_section_surveyform_path(
19
+ survey_section_id: s.object.id,
20
+ id: f.object.id)%>"
21
+ data-edit_survey_section_url="<%=surveyor_gui.edit_survey_section_url(s.object.id)%>"
22
+ data-survey_section_id="<%=s.object.id%>"
23
+ >Edit Section Title</button>
24
+
25
+ <% if session[:cut_section] -%>
26
+
27
+ <button type="button" id="paste_section"
28
+ data-paste_section_surveyform_url="<%= surveyor_gui.paste_section_surveyform_url(survey_section_id: s.object.id, position: 'over') %>"
29
+ >Paste Section</button>
30
+
31
+ <% else -%>
32
+
33
+ <button type="button" id="cut_section"
34
+ data-cut_section_surveyform_url="<%=surveyor_gui.cut_section_surveyform_url(
35
+ id: f.object.id,
36
+ survey_section_id: s.object.id)%>"
37
+ data-survey_section_id="<%=s.object.id%>"
38
+ data-section_already_cut="<%= session[:cut_section] %>"
39
+ >Cut Section</button>
40
+
41
+ <% end -%>
42
+
43
+ <button type="button" id="delete_section"
44
+ data-survey_section_id="<%=s.object.id%>"
45
+ data-survey_section_url="<%= surveyor_gui.survey_section_url(s.object.id)%>"
46
+ >Delete Section</button>
47
+
48
+ <% end -%>
49
+
50
+ </div>
51
+
52
+ </h2>
53
+
54
+ <fieldset style="background:white">
55
+ <div class="fields surveysection">
56
+ <%= s.hidden_field :id %>
57
+ <%= s.hidden_field :modifiable %>
58
+
59
+ <% if !@survey_locked && (s.object.modifiable?) -%>
60
+
61
+ <div class="question_buttons_top">
62
+
63
+ <button type="button" id="add_question" class="cut"
64
+ data-insert_new_question_url="<%=surveyor_gui.insert_new_question_surveyform_url(f.object.id)%>"
65
+ data-new_question_url="<%=surveyor_gui.new_question_url%>"
66
+ >Add Question</button>
67
+
68
+ <% if session[:cut_question] -%>
69
+
70
+ <button type="button" id="paste_question"
71
+ data-paste_question_surveyform_url="<%= surveyor_gui.paste_question_surveyform_url(
72
+ id: f.object.id,
73
+ survey_section_id: s.object.id) %>"
74
+ >Paste Question</button>
75
+
76
+ <% end %>
77
+
78
+ </div>
79
+
80
+ <% end %>
81
+
82
+ <div class="sortable_questions" id="sortable_question<%= s.object.id.to_s %>">
83
+ <%= s.simple_fields_for :questions do |q| %>
84
+ <%= render_questions_and_groups_helper q, s %>
85
+ <% end %>
86
+ </div>
87
+
88
+ <% if !@survey_locked && s.object.modifiable %>
89
+
90
+ <div class="button_bar_outer">
91
+ <div class="section_button_bar_bottom_inner">
92
+
93
+ <button type="button" id="add_section"
94
+ data-new_survey_section_url="<%=surveyor_gui.new_survey_section_url%>"
95
+ data-insert_survey_section_url="<%= surveyor_gui.insert_survey_section_surveyform_path(:action => 'insert_survey_section',:id => f.object.id) %>"
96
+ data-survey_section_id="<%= s.object.id.to_s %>"
97
+ data-survey_id="<%= s.object.survey.id.to_s %>"
98
+ >Add Section</button>
99
+
100
+ <% if session[:cut_section] -%>
101
+
102
+ <button type="button" id="paste_section"
103
+ data-paste_section_surveyform_url="<%= surveyor_gui.paste_section_surveyform_url(:survey_section_id => s.object.id) %>"
104
+ >Paste Section</button>
105
+
106
+ <% end -%>
107
+
108
+ </div>
109
+ </div>
110
+
111
+ <% end -%>
112
+
113
+ </div>
114
+ </fieldset>
115
+ <% end %>
116
+ <% else -%>
117
+ <%= s.hidden_field :id %>
118
+ <%= s.hidden_field :title %>
119
+ <%= s.hidden_field :display_order %>
120
+ <%= s.hidden_field :modifiable %>
121
+ <%= s.simple_fields_for :questions do |q| %>
122
+ <%= q.hidden_field :id %>
123
+ <%= q.hidden_field :text %>
124
+ <%= q.hidden_field :display_order %>
125
+ <%= q.hidden_field :pick %>
126
+ <%= q.hidden_field :display_type %>
127
+ <%= q.hidden_field :question_group_id %>
128
+ <%= q.hidden_field :modifiable %>
129
+ <%= q.simple_fields_for :answers do |a| %>
130
+ <%= a.hidden_field :text %>
131
+ <%= a.hidden_field :response_class %>
132
+ <%= a.hidden_field :display_order %>
133
+ <% end %>
134
+ <% end %>
135
+ <% end %>
136
+ <% end %>
137
+ <% 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", surveyor_gui.surveyform_path(@surveyform) %> |
4
+ <%= link_to "View All", surveyor_gui.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", report_path(survey) %> &nbsp;
28
+ <%= link_to "View Responses" , 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>