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,10 @@
1
+ <%= c.hidden_field :id %>
2
+ <%= c.hidden_field :question_group_id %>
3
+ <div class="column-box">
4
+ <h3>Column #<%= 1 + c.index %> heading</h3>
5
+ <%= c.input :text, as: :string, label: false, placeholder: "column #{1+c.index}" %><br/>
6
+ <h3>Column #<%=1 + c.index %> choices</h3><br/>
7
+ <%= c.input :answers_textbox, :as => :text,
8
+ :wrapper_html => {:class=>'answers_collection'}, :label => false %>
9
+ </div>
10
+
@@ -0,0 +1,42 @@
1
+ <%= simple_fields_for 'question', @questions do |f| %>
2
+ Number of columns:
3
+ <%= f.input :dropdown_column_count, :collection =>
4
+ 10.times.map{|i| [(i+1).to_s + " column".pluralize(i+1), i+1]},
5
+ :as => :select, :label => false,
6
+ :include_blank => false, :wrapper_html=>{:class => 'shrink_slider'}
7
+ %>
8
+ <%= f.simple_fields_for :question_group, @question_group do |qg| %>
9
+ <%= qg.hidden_field :id %>
10
+ Columns: <span class="grid_textbox_hint">Columns: enter the choices for each column option on a separate line under "Column Options"</span><br/>
11
+ <div class="grid_dropdown_columns">
12
+ <span class="spacer">&nbsp;</span>
13
+ <%= qg.simple_fields_for :columns do |c| %>
14
+ <%= render "grid_dropdown_columns", c: c %>
15
+ <% end -%>
16
+ </div>
17
+ <% end -%>
18
+ <div class="rows">
19
+ Rows: <span class="grid_textbox_hint">add each row as a new line</span><br/>
20
+ <%= f.input :grid_rows_textbox, :as => :text,
21
+ :wrapper_html => {:class=>'answers_collection'}, :label => false %>
22
+ </div>
23
+
24
+ <br/><br/><br/>
25
+ <%= f.input :other_text,
26
+ label: "add a choice for",
27
+ hint: "user determines choice",
28
+ placeholder: "Other",
29
+ as: :string,
30
+ wrapper_html: {class: 'other_text fl'}
31
+ %>:
32
+ <%= f.input_field :other, label: false, as: :boolean %>
33
+ <br/><br/><br/>
34
+ <%= f.input :comments_text,
35
+ label: "at the bottom of questions, add",
36
+ hint: "box for notes/comments",
37
+ placeholder: "Comments",
38
+ as: :string,
39
+ wrapper_html: {class: 'comments_text fl'}
40
+ %>:
41
+ <%= f.input_field :comments, label: false, as: :boolean %>
42
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <%= simple_fields_for 'question', @questions do |f| %>
2
+ Columns: <span class="grid_textbox_hint">add each column as a new line</span><br/>
3
+ <%= f.input :grid_columns_textbox, :as => :text, :wrapper_html => {:class=>'answers_collection'}, :label => false %>
4
+ <br/><br/>
5
+ Rows: <span class="grid_textbox_hint">add each row as a new line</span><br/>
6
+ <%= f.input :grid_rows_textbox, :as => :text, :wrapper_html => {:class=>'answers_collection'}, :label => false %>
7
+
8
+ <%= render "answer_options", f: f %>
9
+ <% end -%>
@@ -0,0 +1,29 @@
1
+ <%= simple_fields_for 'question', @questions do |f| %>
2
+ <table class="number_hints">
3
+ <tr>
4
+ <td>Number Prefix</td><td>Number Suffix</td>
5
+ </tr>
6
+ <td>
7
+ <%= f.input :prefix, :label => false %>
8
+ </td>
9
+ <td>
10
+ <%= f.input :suffix, :label => false %>
11
+ <td>
12
+ <tr>
13
+ </table>
14
+ <%= f.simple_fields_for :answers, @questions.answers.first do |a| %>
15
+ <%= a.hidden_field :text %>
16
+ <% end -%>
17
+ <% end -%>
18
+ <br>
19
+ <span style='font-weight:normal;'>
20
+ Hint: affects how the number will be shown.<br/>
21
+ E.g. the number 60 could be shown as follows:<br/><br />
22
+ <table id="number_hint" style="margin-left:2em;">
23
+ <tr><td>Number Suffix</td><td>Number Prefix</td><td>Shown as</td>
24
+ <tr><td>$</td><td>USD</td><td>$60 USD</td>
25
+ <tr><td></td><td>Months</td><td>60 Months</td></tr>
26
+ <tr><td></td><td>Inches</td><td>60 Inches</td></tr>
27
+ </table>
28
+ </span>
29
+ <br />
@@ -0,0 +1,21 @@
1
+ <%= simple_fields_for 'Question', @question do |f| %>
2
+ <span class='fl'>
3
+ Generate list from a database field?
4
+ </span>
5
+ <%= f.input :dynamically_generate, :as => :radio_buttons, :label => false, :wrapper_html=>{:class=>'fl notfirst'}, :input_html=>{:class=>'fl notfirst'} %><br /><br />
6
+ <div id="dynamic_source">
7
+ Specify statement used to generate list:<br />
8
+ <%= f.input :dynamic_source, :label=>false %>
9
+ </div>
10
+ <div id="fixed_source">
11
+ <strong>Possible Answers:</strong>
12
+ <div id='sortable_answers'>
13
+ <%= f.simple_fields_for @answers do |a| %>
14
+ <%= render 'answer_fields', :a => a %>
15
+ <% end %>
16
+ <p class="floatdown2">
17
+ Add Possible Answer<%= link_to_add_fields "Add Answer", @questions.id, f, :answers, 'a' %>
18
+ </p>
19
+ </div>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <!--<span class='fl'>
2
+ Generate list from a database field?
3
+ </span>
4
+ <%= f.input :dynamically_generate, :as => :radio_buttons, :label => false, :wrapper_html=>{:class=>'fl notfirst'}, :input_html=>{:class=>'fl notfirst'} %><br /><br />
5
+ <div id="dynamic_source">
6
+ Specify statement used to generate list:<br />
7
+ <%= f.input :dynamic_source, :label=>false %>
8
+ </div>
9
+ -->
10
+ <div id="fixed_source">
11
+ <div id='sortable_answers'></div>
12
+ </div>
File without changes
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,13 @@
1
+ <div class="shadebox round">
2
+ <h1 class="round-top"><%= @title %></h1>
3
+ <%= simple_form_for @survey_section do |f| %>
4
+ <% @survey_section.errors.full_messages.each do |msg| %>
5
+ <p><%= msg %></p>
6
+ <% end %>
7
+ <%= f.hidden_field :survey_id %>
8
+ <%= f.hidden_field :modifiable %>
9
+ <%= f.hidden_field :display_order %>
10
+ <%= f.input :title , :input_html=>{:size=>'35'}%>
11
+ <%= f.button :submit, 'Save Changes', :id=>'survey_section_submit' %>
12
+ <% end %>
13
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,50 @@
1
+ <div id="box" class="boxshadow round">
2
+ <div class="column3">
3
+ <input id='pass_cbox_data' type="hidden">
4
+ <div class="shadebox round">
5
+ <div id="survey">
6
+ <h1 class="round-top">
7
+ <%= @title %>
8
+ <% if @surveyform.id -%>
9
+ <input class="preview-button" onclick="preview_cbox('<%= surveyor_gui_survey_url(@surveyform.id) %>',
10
+ <%= @surveyform.id %>);" type="button" value="Preview Survey" />
11
+ <input class="preview-button" onclick="preview_cbox('<%= preview_surveyor_gui_response_url(@surveyform.id) %>',
12
+ <%= @surveyform.id %>);" type="button" value="Preview Response" />
13
+ <input class="preview-button" onclick="preview_cbox('<%= preview_surveyor_gui_report_url(@surveyform.id) %>',
14
+ <%= @surveyform.id %>);" type="button" value="Preview Report" />
15
+ <% end %>
16
+ </h1>
17
+ <%= simple_form_for @surveyform, :url => "/surveyforms/"+@surveyform.id.to_s do |f| %>
18
+ <%= f.error_messages %>
19
+ <br/>
20
+ <%= f.hidden_field :id %>
21
+ <%= f.label :title, :required => false, :style => 'font-size: 150%;' %>
22
+ <%= f.input :title, :input_html => { :size => '35', :style=>'margin-top: 0.5%; font-size: 110%; float:left;'}, :required=>false , :label=>false%>
23
+ <%= f.input :template, :disabled=>@survey_locked, :label => false, :input_html=>{:style=>"float:right;"} %>
24
+ <span style='position:relative; float: right;'>Template?&nbsp;
25
+
26
+ </span><br/><br />
27
+ <div class="sortable_sections" data-survey_locked=<%= @survey_locked %>>
28
+ <%= render "survey_section_fields", :s => builder , :f => f %>
29
+ </div>
30
+ <% if @survey_locked%>
31
+ <p><button class="go_back" type="button">Go Back</button></p>
32
+ <% else -%>
33
+ <p><%= f.button :submit, 'Save Changes' %></p>
34
+ <% end -%>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <script type="text/javascript">
42
+ function preview_cbox(url, id) {
43
+ $.colorbox({width:"90%",
44
+ height:"90%",
45
+ scrolling:true,
46
+ iframe:true,
47
+ href: url + '?suppress_header=true&survey_id='+ id,
48
+ opacity:.3});
49
+ }
50
+ </script>
@@ -0,0 +1,148 @@
1
+ <%= f.hidden_field :id %>
2
+ <%= f.hidden_field :display_order %>
3
+ <%= f.hidden_field :modifiable %>
4
+
5
+ <%= row_label_if_question_group f.object %>
6
+
7
+ <% question_type = f.object.question_type_id
8
+ case question_type
9
+ when :slider -%>
10
+ <div class="slider">
11
+ <!-- The slider uses the Jquery UISlider plugin (http://www.filamentgroup.com/lab/update_jquery_ui_16_slider_from_a_select_element/) -->
12
+ <!-- Look in application.js for the hook - it selects all input select elements with "uislider" as the class -->
13
+ <%= f.input :dummy_answer, :collection => f.object.answers.map{|a| a.text}, :as => :select, :label => false,
14
+ :input_html => {:class => "uislider"}, :include_blank => false, :wrapper_html=>{:class => 'shrink_slider'} %>
15
+ </slider>
16
+ <% when :stars -%>
17
+ <%= f.input :dummy_answer, label: false, :collection => [[nil,1],[nil,2],[nil,3],[nil,4],[nil,5]],
18
+ :as => :radio_buttons, :input_html=>{:class=>'star'}, :wrapper_html=>{:class=>'star'} %>
19
+
20
+ <% when :pick_one -%>
21
+
22
+ <% f.object.answers.each do |answer| -%>
23
+ <% if answer.is_comment==true -%>
24
+ <span class="other comments_text">
25
+ <%= f.input :dummy_answer, :as=>:string, label: answer.text %>
26
+ </span>
27
+ <% else -%>
28
+ <%= f.input_field :dummy_answer, label: (f.object.repeater? ? answer.text : false), collection: [answer.text], collection: [answer.text], :as => :radio_buttons%>
29
+ <% if answer.response_class == "string" %>
30
+ <span class="other">
31
+ <%= f.input_field :dummy_answer, :as=>:string, :label=> false%>
32
+ </span>
33
+ <% end -%>
34
+ <% end -%>
35
+ <% end -%>
36
+
37
+ <% when :grid_one -%>
38
+
39
+ <% f.object.answers.each do |answer| -%>
40
+ <%= f.input_field :dummy_answer, label: false, collection: [answer.text], :as => :radio_buttons %>
41
+ <% if answer.response_class == "string" %>
42
+ <span class="other">
43
+ <%= f.input_field :dummy_answer, :as=>:string, :label=>false%>
44
+ </span>
45
+ <% end -%>
46
+ <% end -%>
47
+
48
+ <% when :dropdown -%>
49
+
50
+ <%= f.input :dummy_answer, label: false, :collection => f.object.answers.collect(&:text), :as => :select %>
51
+
52
+
53
+ <% when :grid_dropdown -%>
54
+ <% f.object.question_group.columns.each do |column| %>
55
+ <%= f.input :dummy_answer, label: false,
56
+ :collection => f.object.answers.where('column_id=?',column.id).collect(&:text),
57
+ :as => :select, :wrapper_html=>{:class=>'grid_dropdown_cell'} %>
58
+ <% end -%>
59
+
60
+ <% when :pick_any %>
61
+ <% f.object.answers.each do |answer| -%>
62
+ <% if answer.is_comment==true -%>
63
+ <span class="other comments_text">
64
+ <%= f.input :dummy_answer, :as=>:string, label: answer.text %>
65
+ </span>
66
+ <% else -%>
67
+ <%= f.input_field :dummy_answer_array, label: (f.object.repeater? ? answer.text : false), collection: [answer.text], :as => :check_boxes %>
68
+ <% if answer.response_class == "string" %>
69
+ <span class="other">
70
+ <%= f.input_field :dummy_answer, :as=>:string, :label=> false%>
71
+ </span>
72
+ <% end -%>
73
+ <% end -%>
74
+ <% end -%>
75
+
76
+ <% when :grid_any %>
77
+
78
+ <% if f.object.dynamically_generate==false -%>
79
+ <br />
80
+ <span style="font-weight:normal;font-style:italic" class="field_indent">content retrieved from the application will go here.</span>
81
+ <br />
82
+ <% else -%>
83
+ <% f.object.answers.each do |answer| -%>
84
+ <%= f.input_field :dummy_answer_array, label: false, collection: [answer.text], :as => :check_boxes %>
85
+ <% if answer.response_class == "string" %>
86
+ <span class="other">
87
+ <%= f.input_field :dummy_answer, :as=>:string, :label=>false%>
88
+ </span>
89
+ <% end -%>
90
+ <% end -%>
91
+
92
+ <% end %>
93
+
94
+ <% when :label -%>
95
+ <span style="margin-left: 4.5em;">
96
+ <%= f.object.text %>
97
+ </span>
98
+
99
+ <% when :string -%>
100
+ <%= f.input :dummy_answer, :as=>:string, :label=>false, :input_html=>{:rows=>"1"}%>
101
+
102
+ <% when :box -%>
103
+
104
+ <%= f.input :dummy_answer, :as=>:text, :label=>false, :input_html=>{ :rows=>"3"}%>
105
+
106
+ <% when :number -%>
107
+ <!-- Prefix -->
108
+ <span class="fl prefix">
109
+ <% if f.object.answers.first.text.include?('|') %>
110
+ <%= f.object.answers.first.text.split('|')[0] %>&nbsp;
111
+ <% end %>
112
+ </span>
113
+
114
+ <!-- Number -->
115
+ <%= f.input :dummy_answer, :as=>:string, :label=>false, :input_html=>{:size=>"10"}, :wrapper_html=>{:class=>'fl notfirst number'} %>
116
+
117
+ <!-- Suffix -->
118
+ <span class="suffix fl">
119
+ &nbsp;
120
+ <%= f.object.answers.first.text.split('|')[1] %>
121
+ </span>
122
+ <% when :date -%>
123
+ <%= f.input :dummy_answer, :as=>:date_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
124
+ :hint => 'mm/dd/yy', :hint_html=>{:style=>'margin-left:5em;'} %>
125
+
126
+ <% when :datetime -%>
127
+ <%= f.input :dummy_answer, :as=>:datetime_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
128
+ :hint => 'mm/dd/yy hh:mm', :hint_html=>{:style=>'margin-left:5em;'} %>
129
+
130
+ <% when :time -%>
131
+ <%= f.input :dummy_answer, :as=>:time_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
132
+ :hint => 'hh:mm', :hint_html=>{:style=>'margin-left:5em;'} %>
133
+ <% when :file -%>
134
+ <%= f.input :dummy_blob, :as => :file, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"} %>
135
+
136
+ <% else -%>
137
+ <br/>
138
+ <br />
139
+ <%= f.input :dummy_answer, :label=>false, :input_html=>{:style=>"margin-left: 4.5em;"}%>
140
+ <% end -%>
141
+
142
+ <% if !f.object.modifiable? -%>
143
+ <br />
144
+ <span class='field_indent'>
145
+ Report Code: <%= f.object.report_code %>
146
+ </span>
147
+ <br />
148
+ <% end %>
@@ -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="<%=url_for(:action => 'replace_question',
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') ? edit_question_group_url(f.object.question_group.id) : 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.question_group.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.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="<%=insert_new_question_surveyform_url(id: f.object.survey_section.survey.id, ) %>"
99
+ data-new_question_url="<%=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="<%= 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 %>