surveillance 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +42 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/surveillance.js +6 -0
  6. data/app/assets/javascripts/surveillance/admin.coffee +4 -0
  7. data/app/assets/javascripts/surveillance/admin/matrix-questions.coffee +18 -0
  8. data/app/assets/javascripts/surveillance/application.js +17 -0
  9. data/app/assets/javascripts/surveillance/collections/branch_rule_collection.coffee +2 -0
  10. data/app/assets/javascripts/surveillance/form.coffee +7 -0
  11. data/app/assets/javascripts/surveillance/manifest.coffee +7 -0
  12. data/app/assets/javascripts/surveillance/models/branch_rule.coffee +21 -0
  13. data/app/assets/javascripts/surveillance/models/question.coffee +19 -0
  14. data/app/assets/javascripts/surveillance/models/questions/choosable_question.coffee +15 -0
  15. data/app/assets/javascripts/surveillance/models/questions/matrix.coffee +19 -0
  16. data/app/assets/javascripts/surveillance/models/questions/matrix_question.coffee +7 -0
  17. data/app/assets/javascripts/surveillance/models/questions/number.coffee +17 -0
  18. data/app/assets/javascripts/surveillance/vendor/backbone.min.js +1 -0
  19. data/app/assets/javascripts/surveillance/vendor/bootstrap.js +2118 -0
  20. data/app/assets/javascripts/surveillance/vendor/jquery-ui-sortable.js +2256 -0
  21. data/app/assets/javascripts/surveillance/vendor/jquery.scrollto.js +210 -0
  22. data/app/assets/javascripts/surveillance/vendor/underscore.min.js +5 -0
  23. data/app/assets/javascripts/surveillance/views/attempt_view.coffee +74 -0
  24. data/app/assets/javascripts/surveillance/views/question_view.coffee +53 -0
  25. data/app/assets/javascripts/surveillance/views/questions/choice_view.coffee +52 -0
  26. data/app/assets/javascripts/surveillance/views/questions/matrix_question_view.coffee +26 -0
  27. data/app/assets/javascripts/surveillance/views/questions/matrix_view.coffee +21 -0
  28. data/app/assets/javascripts/surveillance/views/questions/number_view.coffee +19 -0
  29. data/app/assets/javascripts/surveillance/views/questions/order.coffee +9 -0
  30. data/app/assets/javascripts/surveillance/views/questions/select_matrix_view.coffee +31 -0
  31. data/app/assets/javascripts/surveillance/views/section_view.coffee +54 -0
  32. data/app/assets/stylesheets/surveillance/admin.sass +1 -0
  33. data/app/assets/stylesheets/surveillance/application.css +14 -0
  34. data/app/assets/stylesheets/surveillance/fonts/glyphicons-halflings-regular.eot +0 -0
  35. data/app/assets/stylesheets/surveillance/fonts/glyphicons-halflings-regular.svg +229 -0
  36. data/app/assets/stylesheets/surveillance/fonts/glyphicons-halflings-regular.ttf +0 -0
  37. data/app/assets/stylesheets/surveillance/fonts/glyphicons-halflings-regular.woff +0 -0
  38. data/app/assets/stylesheets/surveillance/overrides.sass +2 -0
  39. data/app/assets/stylesheets/surveillance/vendor/bootstrap.css +6175 -0
  40. data/app/controllers/concerns/surveillance/attempts_management_concern.rb +51 -0
  41. data/app/controllers/concerns/surveillance/base_controller_concern.rb +37 -0
  42. data/app/controllers/surveillance/admin/attempts_controller.rb +38 -0
  43. data/app/controllers/surveillance/admin/base_controller.rb +15 -0
  44. data/app/controllers/surveillance/admin/exports_controller.rb +24 -0
  45. data/app/controllers/surveillance/admin/options_controller.rb +44 -0
  46. data/app/controllers/surveillance/admin/questions_controller.rb +59 -0
  47. data/app/controllers/surveillance/admin/sections_controller.rb +46 -0
  48. data/app/controllers/surveillance/admin/surveys_controller.rb +43 -0
  49. data/app/controllers/surveillance/application_controller.rb +7 -0
  50. data/app/controllers/surveillance/response/attempts_controller.rb +50 -0
  51. data/app/controllers/surveillance/response/base_controller.rb +38 -0
  52. data/app/controllers/surveillance/response/partial_attempts_controller.rb +15 -0
  53. data/app/controllers/surveillance/surveys_controller.rb +6 -0
  54. data/app/helpers/surveillance/admin/exports_helper.rb +37 -0
  55. data/app/helpers/surveillance/application_helper.rb +84 -0
  56. data/app/models/surveillance/answer.rb +56 -0
  57. data/app/models/surveillance/answer_content.rb +7 -0
  58. data/app/models/surveillance/attempt.rb +146 -0
  59. data/app/models/surveillance/branch_rule.rb +52 -0
  60. data/app/models/surveillance/field_setting.rb +6 -0
  61. data/app/models/surveillance/option.rb +18 -0
  62. data/app/models/surveillance/question.rb +50 -0
  63. data/app/models/surveillance/section.rb +16 -0
  64. data/app/models/surveillance/survey.rb +38 -0
  65. data/app/views/layouts/surveillance/application.html.haml +11 -0
  66. data/app/views/surveillance/admin/attempts/index.html.haml +47 -0
  67. data/app/views/surveillance/admin/attempts/list.html.haml +11 -0
  68. data/app/views/surveillance/admin/attempts/overview.html.haml +6 -0
  69. data/app/views/surveillance/admin/attempts/show.html.haml +62 -0
  70. data/app/views/surveillance/admin/exports/show.rxls +39 -0
  71. data/app/views/surveillance/admin/options/_field.html.haml +11 -0
  72. data/app/views/surveillance/admin/options/_form.html.haml +8 -0
  73. data/app/views/surveillance/admin/options/_list.html.haml +10 -0
  74. data/app/views/surveillance/admin/options/_option.html.haml +13 -0
  75. data/app/views/surveillance/admin/options/edit.html.haml +7 -0
  76. data/app/views/surveillance/admin/options/new.html.haml +7 -0
  77. data/app/views/surveillance/admin/questions/_form.html.haml +35 -0
  78. data/app/views/surveillance/admin/questions/_list.html.haml +17 -0
  79. data/app/views/surveillance/admin/questions/_question.html.haml +27 -0
  80. data/app/views/surveillance/admin/questions/edit.html.haml +7 -0
  81. data/app/views/surveillance/admin/questions/new.html.haml +4 -0
  82. data/app/views/surveillance/admin/sections/_form.html.haml +16 -0
  83. data/app/views/surveillance/admin/sections/_list.html.haml +13 -0
  84. data/app/views/surveillance/admin/sections/_section.html.haml +16 -0
  85. data/app/views/surveillance/admin/sections/edit.html.haml +7 -0
  86. data/app/views/surveillance/admin/sections/new.html.haml +4 -0
  87. data/app/views/surveillance/admin/surveys/_form.html.haml +22 -0
  88. data/app/views/surveillance/admin/surveys/_list.html.haml +13 -0
  89. data/app/views/surveillance/admin/surveys/_survey.html.haml +32 -0
  90. data/app/views/surveillance/admin/surveys/edit.html.haml +7 -0
  91. data/app/views/surveillance/admin/surveys/index.html.haml +1 -0
  92. data/app/views/surveillance/admin/surveys/new.html.haml +4 -0
  93. data/app/views/surveillance/field/date/_form.html.haml +5 -0
  94. data/app/views/surveillance/field/date/_overview.html.haml +2 -0
  95. data/app/views/surveillance/field/date/_show.html.haml +10 -0
  96. data/app/views/surveillance/field/matrix/_form.html.haml +40 -0
  97. data/app/views/surveillance/field/matrix/_overview.html.haml +19 -0
  98. data/app/views/surveillance/field/matrix/_questions_fields.html.haml +11 -0
  99. data/app/views/surveillance/field/matrix/_settings.html.haml +18 -0
  100. data/app/views/surveillance/field/matrix/_show.html.haml +22 -0
  101. data/app/views/surveillance/field/multiple_choices/_form.html.haml +18 -0
  102. data/app/views/surveillance/field/multiple_choices/_settings.html.haml +21 -0
  103. data/app/views/surveillance/field/multiple_choices/_show.html.haml +21 -0
  104. data/app/views/surveillance/field/multiple_choices_matrix/_form.html.haml +33 -0
  105. data/app/views/surveillance/field/multiple_choices_matrix/_show.html.haml +1 -0
  106. data/app/views/surveillance/field/number/_form.html.haml +5 -0
  107. data/app/views/surveillance/field/number/_overview.html.haml +2 -0
  108. data/app/views/surveillance/field/number/_settings.html.haml +2 -0
  109. data/app/views/surveillance/field/number/_show.html.haml +10 -0
  110. data/app/views/surveillance/field/order/_form.html.haml +17 -0
  111. data/app/views/surveillance/field/order/_overview.html.haml +22 -0
  112. data/app/views/surveillance/field/order/_settings.html.haml +11 -0
  113. data/app/views/surveillance/field/order/_show.html.haml +8 -0
  114. data/app/views/surveillance/field/select_matrix/_form.html.haml +17 -0
  115. data/app/views/surveillance/field/shared/_rules_form.html.haml +30 -0
  116. data/app/views/surveillance/field/shared/settings/_boolean.html.haml +9 -0
  117. data/app/views/surveillance/field/shared/settings/_number.html.haml +5 -0
  118. data/app/views/surveillance/field/single_choice/_form.html.haml +16 -0
  119. data/app/views/surveillance/field/single_choice/_overview.html.haml +14 -0
  120. data/app/views/surveillance/field/single_choice/_settings.html.haml +2 -0
  121. data/app/views/surveillance/field/single_choice/_show.html.haml +21 -0
  122. data/app/views/surveillance/field/single_select/_form.html.haml +4 -0
  123. data/app/views/surveillance/field/single_select/_overview.html.haml +14 -0
  124. data/app/views/surveillance/field/single_select/_show.html.haml +13 -0
  125. data/app/views/surveillance/field/text/_form.html.haml +5 -0
  126. data/app/views/surveillance/field/text/_overview.html.haml +2 -0
  127. data/app/views/surveillance/field/text/_show.html.haml +10 -0
  128. data/app/views/surveillance/field/text_area/_form.html.haml +5 -0
  129. data/app/views/surveillance/field/text_area/_overview.html.haml +1 -0
  130. data/app/views/surveillance/field/text_area/_show.html.haml +10 -0
  131. data/app/views/surveillance/response/attempts/complete.html.haml +11 -0
  132. data/app/views/surveillance/response/attempts/edit.html.haml +15 -0
  133. data/app/views/surveillance/sections/_section.html.haml +24 -0
  134. data/app/views/surveillance/surveys/_survey.html.haml +4 -0
  135. data/app/views/surveillance/surveys/index.html.haml +8 -0
  136. data/app/views/surveillance/surveys/show.html.haml +15 -0
  137. data/config/locales/surveillance.fr.yml +165 -0
  138. data/config/routes.rb +30 -0
  139. data/db/migrate/20130626115136_create_surveillance_surveys.rb +13 -0
  140. data/db/migrate/20130626115805_create_surveillance_sections.rb +12 -0
  141. data/db/migrate/20130626130351_create_surveillance_questions.rb +14 -0
  142. data/db/migrate/20130702111125_create_surveillance_options.rb +11 -0
  143. data/db/migrate/20130703113456_create_surveillance_attempts.rb +11 -0
  144. data/db/migrate/20130703115649_create_surveillance_answers.rb +11 -0
  145. data/db/migrate/20130703115723_create_surveillance_answer_contents.rb +10 -0
  146. data/db/migrate/20130710151627_create_surveillance_field_settings.rb +11 -0
  147. data/db/migrate/20130711100032_create_surveillance_answers_options_join_table.rb +7 -0
  148. data/db/migrate/20130729143002_create_surveillance_branch_rules.rb +14 -0
  149. data/db/migrate/20140212153506_add_state_to_surveillance_attempts.rb +6 -0
  150. data/db/migrate/20140213101147_add_access_token_to_surveillance_attempts.rb +5 -0
  151. data/db/migrate/20140213133036_add_partial_to_surveillance_questions.rb +5 -0
  152. data/lib/generators/surveillance/install/install_generator.rb +34 -0
  153. data/lib/generators/surveillance/install/templates/initializer.rb +51 -0
  154. data/lib/surveillance.rb +61 -0
  155. data/lib/surveillance/branch_action.rb +5 -0
  156. data/lib/surveillance/branch_condition.rb +5 -0
  157. data/lib/surveillance/engine.rb +13 -0
  158. data/lib/surveillance/field.rb +58 -0
  159. data/lib/surveillance/field/base.rb +149 -0
  160. data/lib/surveillance/field/date.rb +17 -0
  161. data/lib/surveillance/field/matrix.rb +66 -0
  162. data/lib/surveillance/field/matrix_question.rb +13 -0
  163. data/lib/surveillance/field/multiple_choices.rb +29 -0
  164. data/lib/surveillance/field/multiple_choices_matrix.rb +13 -0
  165. data/lib/surveillance/field/number.rb +34 -0
  166. data/lib/surveillance/field/order.rb +40 -0
  167. data/lib/surveillance/field/order_question.rb +22 -0
  168. data/lib/surveillance/field/other_choice.rb +28 -0
  169. data/lib/surveillance/field/select_matrix.rb +13 -0
  170. data/lib/surveillance/field/single_choice.rb +36 -0
  171. data/lib/surveillance/field/single_select.rb +31 -0
  172. data/lib/surveillance/field/text.rb +13 -0
  173. data/lib/surveillance/field/text_area.rb +6 -0
  174. data/lib/surveillance/partials_collection.rb +7 -0
  175. data/lib/surveillance/setting.rb +24 -0
  176. data/lib/surveillance/settings_collection.rb +17 -0
  177. data/lib/surveillance/validators.rb +7 -0
  178. data/lib/surveillance/validators/answer_validator.rb +9 -0
  179. data/lib/surveillance/version.rb +3 -0
  180. data/lib/tasks/surveillance_tasks.rake +4 -0
  181. data/spec/dummy/README.rdoc +28 -0
  182. data/spec/dummy/Rakefile +6 -0
  183. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  184. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  185. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  186. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  187. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  188. data/spec/dummy/bin/bundle +3 -0
  189. data/spec/dummy/bin/rails +4 -0
  190. data/spec/dummy/bin/rake +4 -0
  191. data/spec/dummy/config.ru +4 -0
  192. data/spec/dummy/config/application.rb +28 -0
  193. data/spec/dummy/config/boot.rb +5 -0
  194. data/spec/dummy/config/database.yml +25 -0
  195. data/spec/dummy/config/environment.rb +5 -0
  196. data/spec/dummy/config/environments/development.rb +29 -0
  197. data/spec/dummy/config/environments/production.rb +80 -0
  198. data/spec/dummy/config/environments/test.rb +36 -0
  199. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  200. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  201. data/spec/dummy/config/initializers/inflections.rb +16 -0
  202. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  203. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  204. data/spec/dummy/config/initializers/session_store.rb +3 -0
  205. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  206. data/spec/dummy/config/locales/en.yml +23 -0
  207. data/spec/dummy/config/locales/rails.fr.yml +226 -0
  208. data/spec/dummy/config/routes.rb +3 -0
  209. data/spec/dummy/db/development.sqlite3 +0 -0
  210. data/spec/dummy/db/migrate/20140113224541_create_surveillance_surveys.surveillance.rb +14 -0
  211. data/spec/dummy/db/migrate/20140113224542_create_surveillance_sections.surveillance.rb +13 -0
  212. data/spec/dummy/db/migrate/20140113224543_create_surveillance_questions.surveillance.rb +15 -0
  213. data/spec/dummy/db/migrate/20140113224544_create_surveillance_options.surveillance.rb +12 -0
  214. data/spec/dummy/db/migrate/20140113224545_create_surveillance_attempts.surveillance.rb +12 -0
  215. data/spec/dummy/db/migrate/20140113224546_create_surveillance_answers.surveillance.rb +12 -0
  216. data/spec/dummy/db/migrate/20140113224547_create_surveillance_answer_contents.surveillance.rb +11 -0
  217. data/spec/dummy/db/migrate/20140113224548_create_surveillance_field_settings.surveillance.rb +12 -0
  218. data/spec/dummy/db/migrate/20140113224549_create_surveillance_answers_options_join_table.surveillance.rb +8 -0
  219. data/spec/dummy/db/migrate/20140113224550_create_surveillance_branch_rules.surveillance.rb +15 -0
  220. data/spec/dummy/db/schema.rb +103 -0
  221. data/spec/dummy/log/development.log +38066 -0
  222. data/spec/dummy/public/404.html +58 -0
  223. data/spec/dummy/public/422.html +58 -0
  224. data/spec/dummy/public/500.html +57 -0
  225. data/spec/dummy/public/favicon.ico +0 -0
  226. data/spec/dummy/spec +1 -0
  227. data/spec/dummy/tmp/cache/assets/development/sprockets/0018421aaf29044fbd13363bbdfd8f44 +0 -0
  228. data/spec/dummy/tmp/cache/assets/development/sprockets/017d7a30ec05c0fb0265fb5167c73ee9 +0 -0
  229. data/spec/dummy/tmp/cache/assets/development/sprockets/034b76adeb89d6ca63cd9eea649331f5 +0 -0
  230. data/spec/dummy/tmp/cache/assets/development/sprockets/05de8fbfacab66a0efe4f9790b2ac723 +0 -0
  231. data/spec/dummy/tmp/cache/assets/development/sprockets/0811effcff3b9107d49398bdba7488e5 +0 -0
  232. data/spec/dummy/tmp/cache/assets/development/sprockets/0d45beae32861dc508fc2db09b9d95b3 +0 -0
  233. data/spec/dummy/tmp/cache/assets/development/sprockets/0d4961f3da5a0d5234736a6abbf42226 +0 -0
  234. data/spec/dummy/tmp/cache/assets/development/sprockets/0f491ed240e1a27bbc05e5213afd48bb +0 -0
  235. data/spec/dummy/tmp/cache/assets/development/sprockets/10e2a0dbdbb68c055e8b7ccd6f2906d8 +0 -0
  236. data/spec/dummy/tmp/cache/assets/development/sprockets/1173cdef6c662a55ef590489fe26e8fe +0 -0
  237. data/spec/dummy/tmp/cache/assets/development/sprockets/1b3e93127523ec0f3c93bcd91d4390dc +0 -0
  238. data/spec/dummy/tmp/cache/assets/development/sprockets/1bb56fbf17ccbb14dcbaa4d6d639e620 +0 -0
  239. data/spec/dummy/tmp/cache/assets/development/sprockets/2bd0ba6a1598c9fa67081d8f906db6f8 +0 -0
  240. data/spec/dummy/tmp/cache/assets/development/sprockets/3fbe053f103de46cc1b320f059b99c1f +0 -0
  241. data/spec/dummy/tmp/cache/assets/development/sprockets/4144b095447efb810a548b99e41df9eb +0 -0
  242. data/spec/dummy/tmp/cache/assets/development/sprockets/421d097cb8d88f975d8ccf75c9e5e306 +0 -0
  243. data/spec/dummy/tmp/cache/assets/development/sprockets/474bc1c9055df6cc1cdff58817a6cb41 +0 -0
  244. data/spec/dummy/tmp/cache/assets/development/sprockets/4829d251eeb22cdbd05b27b6ba809538 +0 -0
  245. data/spec/dummy/tmp/cache/assets/development/sprockets/4f584ca3f0c8ec62906e6f03bc5963c2 +0 -0
  246. data/spec/dummy/tmp/cache/assets/development/sprockets/55d647d88e01b91b2a146e7db0481c09 +0 -0
  247. data/spec/dummy/tmp/cache/assets/development/sprockets/62db8b5885b79c5dc0667fab0fbf46bb +0 -0
  248. data/spec/dummy/tmp/cache/assets/development/sprockets/7080a4d265fe784c9704db71f81da832 +0 -0
  249. data/spec/dummy/tmp/cache/assets/development/sprockets/7220af243fd39e3dffd233252e4a8c17 +0 -0
  250. data/spec/dummy/tmp/cache/assets/development/sprockets/7cd0e5bfe12b86ed494d02e8e5b62bbf +0 -0
  251. data/spec/dummy/tmp/cache/assets/development/sprockets/7e37a8ae2a50653b388d57c573d12548 +0 -0
  252. data/spec/dummy/tmp/cache/assets/development/sprockets/8113790dad1da8858c82cfc3eb14ef87 +0 -0
  253. data/spec/dummy/tmp/cache/assets/development/sprockets/83997102fc04f275cd6cd8c1ddb55835 +0 -0
  254. data/spec/dummy/tmp/cache/assets/development/sprockets/8a7b047a16adbc640e03eaabe4a4fe93 +0 -0
  255. data/spec/dummy/tmp/cache/assets/development/sprockets/90b48fb4bfa22ddcd063734065d27086 +0 -0
  256. data/spec/dummy/tmp/cache/assets/development/sprockets/935886b24c90d344752d2a80e3657801 +0 -0
  257. data/spec/dummy/tmp/cache/assets/development/sprockets/9606a6d70af63ce3fea26ded0a69d5c2 +0 -0
  258. data/spec/dummy/tmp/cache/assets/development/sprockets/97db73fdf0bbab24fb92892c61ec7a9b +0 -0
  259. data/spec/dummy/tmp/cache/assets/development/sprockets/a23bb60554e715c228ae3cdfb5d81807 +0 -0
  260. data/spec/dummy/tmp/cache/assets/development/sprockets/ad17e102b9f9288a9e919b0b0a2ab05b +0 -0
  261. data/spec/dummy/tmp/cache/assets/development/sprockets/c26ae1f6640b52c232bd392a6e2f7110 +0 -0
  262. data/spec/dummy/tmp/cache/assets/development/sprockets/c6cb3deca0f08bd9569d00fca09272da +0 -0
  263. data/spec/dummy/tmp/cache/assets/development/sprockets/d39b4eebbd0042342e10497a34fd6378 +0 -0
  264. data/spec/dummy/tmp/cache/assets/development/sprockets/d5ee573b2abdcdc245a830bde2dd76f3 +0 -0
  265. data/spec/dummy/tmp/cache/assets/development/sprockets/d6487e59842ff206d84f6de5e3a7400c +0 -0
  266. data/spec/dummy/tmp/cache/assets/development/sprockets/dafa124ddd0e828d7c5c0a5c4db455ba +0 -0
  267. data/spec/dummy/tmp/cache/assets/development/sprockets/e5bbd03518f9abc3e9bc1373c74fd3f1 +0 -0
  268. data/spec/dummy/tmp/cache/assets/development/sprockets/ed5aa255edff522c2e36e6f0151ff747 +0 -0
  269. data/spec/dummy/tmp/cache/assets/development/sprockets/ee263a426f6530013f86aa860448fa91 +0 -0
  270. data/spec/dummy/tmp/cache/assets/development/sprockets/efa0c4d855d425fdf4b63ab26c45e94c +0 -0
  271. data/spec/dummy/tmp/cache/assets/development/sprockets/f2881259fd5bad1c0a5b1ab5dff97c47 +0 -0
  272. data/spec/dummy/tmp/cache/assets/development/sprockets/f34108e540cff2fbc32036da452ca6ae +0 -0
  273. data/spec/dummy/tmp/cache/assets/development/sprockets/f7e7e00ef8efc13c6a2628e453344440 +0 -0
  274. data/spec/dummy/tmp/cache/assets/development/sprockets/f9a44009076e46b0f35af5e7031a1871 +0 -0
  275. data/spec/spec_helper.rb +87 -0
  276. metadata +598 -0
@@ -0,0 +1,7 @@
1
+ %h2
2
+ Édition de la section
3
+ %strong
4
+ = surround '"' do
5
+ = section.title
6
+
7
+ = render partial: 'form', locals: { path: admin_section_path(section) }
@@ -0,0 +1,4 @@
1
+ %h2
2
+ Création d'une section
3
+
4
+ = render partial: 'form', locals: { path: admin_survey_sections_path }
@@ -0,0 +1,22 @@
1
+ .survey-edit
2
+ = simple_form_for survey, url: path, html: { class: "form-horizontal glyph-form"} do |f|
3
+ = f.input :title
4
+ / = f.input :description, as: :rich, input_html: { rows: 5 }
5
+ = f.input :description, input_html: { rows: 5 }
6
+ = f.input :end_date, as: :string, class: "inline", input_html: { class: "date-warpper", value: survey.end_date && l(survey.end_date) }
7
+ = f.input :published
8
+
9
+ / = f.input :last_page_description, as: :rich, input_html: { rows: 5 }
10
+ = f.input :last_page_description, input_html: { rows: 5 }
11
+
12
+ - unless survey.new_record?
13
+ = render partial: "surveillance/admin/sections/list"
14
+
15
+ .form-group.form-actions
16
+ %button.btn.btn-primary{ type: "submit" }
17
+ %i.fa.fa-check
18
+ = survey.new_record? ? "Ajouter" : "Mettre à jour"
19
+
20
+ = link_to admin_surveys_path, class: "btn btn-default" do
21
+ %i.fa.fa-arrow-left
22
+ Retour
@@ -0,0 +1,13 @@
1
+ .project-surveys
2
+ %h2
3
+ Sondages
4
+
5
+ = link_to new_admin_survey_path, class: "btn btn-primary" do
6
+ %i.fa.fa-plus
7
+ Créer un sondage
8
+
9
+ %br
10
+ %br
11
+
12
+ .surveys-list
13
+ = render partial: "survey", collection: surveys
@@ -0,0 +1,32 @@
1
+ .panel.panel-default.list-item.survey-container
2
+ .panel-heading.list-item-inner
3
+ .name.pull-left.padding5
4
+ = survey.title
5
+
6
+ .btn-group.pull-right
7
+
8
+ .btn
9
+ - if survey.published
10
+ .pull-left.label.label-success
11
+ Publié
12
+ - else
13
+ .pull-left.label.label-danger
14
+ Non Publié
15
+
16
+ - if (count = survey.attempts.length) > 0
17
+ = link_to "Voir les #{ count } réponses", admin_survey_attempts_path(survey), class: "btn btn-default"
18
+ - else
19
+ .btn.delete-btn Aucune réponse
20
+
21
+ .btn-group
22
+ %button.btn.btn-default.dropdown-toggle{ type: "button", data: { toggle: "dropdown" } }
23
+ Exporter
24
+ %span.caret
25
+ %ul.dropdown-menu{ role: "menu"}
26
+ %li= link_to "Tous", admin_export_path(survey)
27
+ %li= link_to "Complets", admin_export_path(survey, state: "completed")
28
+
29
+ = link_to "Modifier", edit_admin_survey_path(survey), class: "btn btn-primary"
30
+ = link_to "Supprimer", admin_survey_path(survey), class: "btn btn-danger delete-btn", method: 'delete'
31
+
32
+ .clearfix
@@ -0,0 +1,7 @@
1
+ %h2
2
+ Édition du questionnaire
3
+ %strong
4
+ = surround '"' do
5
+ = survey.title
6
+
7
+ = render partial: 'form', locals: { path: admin_survey_path(survey) }
@@ -0,0 +1 @@
1
+ = render partial: "list"
@@ -0,0 +1,4 @@
1
+ %h2
2
+ Création d'un questionnaire
3
+
4
+ = render partial: 'form', locals: { path: admin_surveys_path }
@@ -0,0 +1,5 @@
1
+ = f.fields_for :answers, (question.field.answer_or_initialize) do |fa|
2
+ = fa.fields_for :content, fa.object.content_or_build do |fc|
3
+ = fc.input :value, as: :date, label: question.title.html_safe, required: question.mandatory, hint: question.description, input_html: { value: fc.object.value }
4
+
5
+ = fa.hidden_field :question_id, value: question.id if fa.object.new_record?
@@ -0,0 +1,2 @@
1
+ %h3= question.title.html_safe
2
+ .answer-count Pas de résultat à afficher pour un champ date
@@ -0,0 +1,10 @@
1
+ .question
2
+ %span.title
3
+ = question.title.html_safe
4
+
5
+ %strong.answer
6
+ - if question.field.answer
7
+ = question.field.answer_string
8
+ - else
9
+ Non répondu
10
+
@@ -0,0 +1,40 @@
1
+ .form-group
2
+ %label.control-label{ required: question.mandatory }
3
+ = "*" if question.mandatory
4
+ = question.title.html_safe
5
+
6
+ - if question.description.presence
7
+ %p.help-block
8
+ = question.description.html_safe
9
+
10
+ .form-controls
11
+ %table.table.table-striped.table-bordered.table-rounded
12
+ %thead
13
+ %tr
14
+ %th
15
+ - question.options.each do |option|
16
+ %th
17
+ = option.title
18
+
19
+ %tbody
20
+ - question.field.ordered_sub_questions.each do |sub_question|
21
+ = f.fields_for :answers, (sub_question.field.answer_or_initialize_for(f.object)) do |fa|
22
+ %tr.form-group{ class: ("error" if fa.object.errors.any?), data: { "sub-question-id" => sub_question.id } }
23
+ %td
24
+ %label.control-label
25
+ = sub_question.title.html_safe
26
+ = fa.hidden_field :question_id, value: sub_question.id if fa.object.new_record?
27
+ - question.options.each do |option|
28
+ %td
29
+ %label
30
+ = fa.radio_button :option_id, option.id
31
+
32
+ - if question.field.display_other_field?(question)
33
+ = f.fields_for :answers, (question.field.answer_or_initialize_for(f.object)) do |fa|
34
+ %tr.form-group
35
+ %td
36
+ = fa.radio_button :option_id, "other", checked: fa.object.other_choosed
37
+ = question.field.settings.other.label
38
+ %td{ colspan: question.questions.length }
39
+ = fa.fields_for :content, fa.object.content_or_build do |fc|
40
+ = fc.input :value, as: :string, label: false
@@ -0,0 +1,19 @@
1
+ %h4= question.title.html_safe
2
+ %table.table.table-striped.table-bordered.table-rounded
3
+ %thead
4
+ %tr
5
+ %th
6
+ - question.options.each do |option|
7
+ %th= option.title
8
+
9
+ %tbody
10
+ - question.questions.each do |sub_question|
11
+ %tr.form-group
12
+ %td
13
+ %label.control-label
14
+ = sub_question.title.html_safe
15
+
16
+ - question.options.each do |option|
17
+ %td
18
+ %label
19
+ = option.answers_for(sub_question).length
@@ -0,0 +1,11 @@
1
+ %fieldset.matrix-question
2
+ .form-group
3
+ .col-sm-12
4
+ .input-group
5
+ = f.text_field :title, class: "form-control"
6
+
7
+ = f.hidden_field :_destroy, data: { destroy: true }
8
+ = link_to "#", class: "btn btn-danger input-group-addon", data: { "destroy-field" => true } do
9
+ %i.fa.fa-times
10
+  
11
+ Supprimer
@@ -0,0 +1,18 @@
1
+ - questions_fields_path = Surveillance::Field::Matrix.questions_fields_path
2
+
3
+ = setting_field_for(question, :other, :boolean, f)
4
+
5
+ = setting_field_for(question, :randomize_sub_questions, :boolean, f)
6
+
7
+ .form-group.matrix-questions{ id: "matrix-questions-#{ f.object.id }", data: { collection: true } }
8
+ .col-sm-12
9
+ %legend
10
+ Questions de la matrice
11
+
12
+ %p.help-block
13
+ Ajoutez ici les sous-questions de la matrice
14
+
15
+ = f.fields_for :questions do |fq|
16
+ = render partial: questions_fields_path, locals: { f: fq } if fq.object
17
+
18
+ = link_to_add_fields "<i class=\"fa fa-plus\"></i>&nbsp;Ajouter une question à la matrice", "#matrix-questions-#{ f.object.id }", builder: f, relation: :questions, partial: questions_fields_path
@@ -0,0 +1,22 @@
1
+ %h4= question.title.html_safe
2
+ %table.table.table-striped.table-bordered.table-rounded
3
+ %thead
4
+ %tr
5
+ %th
6
+ - question.options.each do |option|
7
+ %th
8
+ = option.title
9
+
10
+ %tbody
11
+ - question.questions.each do |sub_question|
12
+ %tr.form-group
13
+ %td
14
+ %label.control-label
15
+ = sub_question.title.html_safe
16
+
17
+ - question.options.each do |option|
18
+ %td
19
+ %label
20
+ - if question.field.attempt
21
+ - answer = question.field.attempt.answers.find { |answer| answer.options.include?(option) && answer.question == sub_question }
22
+ = answer ? "V" : "-"
@@ -0,0 +1,18 @@
1
+ = f.fields_for :answers, question.field.answer_or_initialize do |fa|
2
+ = fa.input :option_ids, label: question.title.html_safe, required: question.mandatory, hint: question.description do
3
+ = fa.collection_check_boxes :option_ids, question.field.ordered_options, :id, :title do |input|
4
+ - input.label class: "check_box" do
5
+ = input.check_box
6
+ = input.text
7
+
8
+ - if question.field.display_other_field?(question)
9
+ = fa.collection_check_boxes :option_ids, [question.field.other_option], :id, :title do |input|
10
+ - input.label class: "check_box" do
11
+ - input.instance_variable_set(:"@value", "other")
12
+ = input.check_box(checked: fa.object.other_choosed)
13
+ = input.text
14
+
15
+ = fa.fields_for :content, fa.object.content_or_build do |fc|
16
+ = fc.input :value, as: :string, label: false
17
+
18
+ = fa.hidden_field :question_id, value: question.id if fa.object.new_record?
@@ -0,0 +1,21 @@
1
+ = f.fields_for :settings, question.settings.find_or_initialize_by(key: "other") do |fo|
2
+ - other = question.field.settings.other
3
+ .form-group
4
+ .form-controls
5
+ %label.checkbox
6
+ = fo.check_box :value
7
+ = other.admin_label
8
+
9
+ = fo.hidden_field :key, value: :other
10
+ = fo.hidden_field :id, value: fo.object.id if fo.object.persisted?
11
+
12
+ = f.fields_for :settings, question.settings.find_or_initialize_by(key: "randomize") do |fr|
13
+ - randomize = question.field.settings.randomize
14
+ .form-group
15
+ .form-controls
16
+ %label.checkbox
17
+ = fr.check_box :value
18
+ = randomize.admin_label
19
+
20
+ = fr.hidden_field :key, value: :randomize
21
+ = fr.hidden_field :id, value: fr.object.id if fr.object.persisted?
@@ -0,0 +1,21 @@
1
+ .question
2
+ %span.title
3
+ = question.title.html_safe
4
+
5
+ %strong.answer
6
+ - if question.field.answer
7
+ - if (has_options = question.field.answer.options.length > 0)
8
+ = question.field.answer.options.map(&:title).join(" / ")
9
+
10
+ - if (content = question.field.answer.content)
11
+ = " / " if has_options
12
+ = question.field.settings.other.label
13
+ \:
14
+ = question.field.answer_string
15
+
16
+ - unless has_options || content
17
+ Non répondu
18
+
19
+ - else
20
+ Non répondu
21
+
@@ -0,0 +1,33 @@
1
+ .form-group
2
+ %label.control-label{ required: question.mandatory }
3
+ = "*" if question.mandatory
4
+ = question.title.html_safe
5
+
6
+ - if question.description.presence
7
+ %p.help-block
8
+ = question.description.html_safe
9
+
10
+ .form-controls
11
+ %table.table.table-striped.table-bordered.table-rounded
12
+ %thead
13
+ %tr
14
+ %th
15
+ - question.options.each do |option|
16
+ %th
17
+ = option.title
18
+
19
+ %tbody
20
+ - question.field.ordered_sub_questions.each do |sub_question|
21
+ = f.fields_for :answers, (sub_question.field.answer_or_initialize_for(f.object)) do |fa|
22
+ %tr.form-group{ class: ("has-error" if fa.object.errors.any?), data: { "sub-question-id" => sub_question.id } }
23
+ %td
24
+ %label.control-label
25
+ = sub_question.title.html_safe
26
+ = fa.hidden_field :question_id, value: sub_question.id if fa.object.new_record?
27
+
28
+ = fa.collection_check_boxes :option_ids, question.options, :id, :title do |input|
29
+ %td.form-controls
30
+ %label
31
+ = input.check_box
32
+
33
+
@@ -0,0 +1 @@
1
+ = render partial: "surveillance/field/matrix/show", locals: { question: question }
@@ -0,0 +1,5 @@
1
+ = f.fields_for :answers, (question.field.answer_or_initialize) do |fa|
2
+ = fa.fields_for :content, fa.object.content_or_build do |fc|
3
+ = fc.input :value, as: :numeric, label: question.title.html_safe, required: question.mandatory, hint: question.description, input_html: { min: question.field.setting_value(:minimum), max: question.field.setting_value(:maximum) }
4
+
5
+ = fa.hidden_field :question_id, value: question.id if fa.object.new_record?
@@ -0,0 +1,2 @@
1
+ %h4= question.title.html_safe
2
+ .answer-count Pas de résultat à afficher pour un champ Nombre
@@ -0,0 +1,2 @@
1
+ = setting_field_for(question, :minimum, :number, f)
2
+ = setting_field_for(question, :maximum, :number, f)
@@ -0,0 +1,10 @@
1
+ .question
2
+ %span.title
3
+ = question.title.html_safe
4
+
5
+ %strong.answer
6
+ - if question.field.answer
7
+ = question.field.answer_string
8
+ - else
9
+ Non répondu
10
+
@@ -0,0 +1,17 @@
1
+ .form-group
2
+ %label.control-label{ required: question.mandatory }
3
+ = "*" if question.mandatory
4
+ = question.title.html_safe
5
+
6
+ .survey-order-field
7
+ - question.questions.each_with_index do |sub_question, index|
8
+ = f.fields_for :answers, (sub_question.field.answer_or_initialize_for(f.object)) do |fa|
9
+ .panel.panel-default.orderable-item
10
+ .panel-heading
11
+ .pull-left.fa.fa-arrows
12
+
13
+ = sub_question.title.html_safe
14
+ = fa.hidden_field :question_id, value: sub_question.id if fa.object.new_record?
15
+ = fa.fields_for :content, Surveillance::AnswerContent.new do |fc|
16
+ = fc.hidden_field :value, value: index, class: "sub-question-input"
17
+
@@ -0,0 +1,22 @@
1
+ %h4= question.title.html_safe
2
+ %table.table.table-striped.table-bordered.table-rounded
3
+ %thead
4
+ %tr
5
+ %th
6
+ - question.questions.each_with_index do |_, index|
7
+ %th= "Position #{ index + 1 }"
8
+
9
+ %tbody
10
+ - question.questions.each_with_index do |sub_question|
11
+ %tr.form-group
12
+ %td
13
+ %label.control-label
14
+ = sub_question.title.html_safe
15
+
16
+ - sub_question.field.answers.each do |answers_count|
17
+ %td
18
+ %label
19
+ = answers_count || 0
20
+
21
+
22
+
@@ -0,0 +1,11 @@
1
+ - questions_fields_path = Surveillance::Field::Matrix.questions_fields_path
2
+
3
+ .matrix-questions{ id: "matrix-questions-#{ f.object.id }", data: { collection: true } }
4
+
5
+ %h2
6
+ Questions
7
+
8
+ = f.fields_for :questions do |fq|
9
+ = render partial: questions_fields_path, locals: { f: fq } if fq.object
10
+
11
+ = link_to_add_fields "Ajouter une réponse à ordonner", "#matrix-questions-#{ f.object.id }", builder: f, relation: :questions, partial: questions_fields_path
@@ -0,0 +1,8 @@
1
+ .form-group
2
+ %label.control-label{ required: question.mandatory }
3
+ = "*" if question.mandatory
4
+ = question.title.html_safe
5
+
6
+ %ul
7
+ - question.field.ordered_answers.each_with_index do |question, index|
8
+ %li= "#{ index + 1 } : #{ question.title.html_safe }"
@@ -0,0 +1,17 @@
1
+ .form-group
2
+ %label.control-label{ required: question.mandatory }
3
+ = "*" if question.mandatory
4
+ = question.title.html_safe
5
+
6
+ .form-controls
7
+ %table.table.table-striped.table-bordered.table-rounded
8
+ %tbody
9
+ - question.questions.each do |sub_question|
10
+ = f.fields_for :answers, (sub_question.field.answer_or_initialize_for(f.object)) do |fa|
11
+ %tr.form-group{ class: ("error" if fa.object.errors.any?), data: { "sub-question-id" => sub_question.id } }
12
+ %td
13
+ %label.control-label
14
+ = sub_question.title.html_safe
15
+ = fa.hidden_field :question_id, value: sub_question.id if fa.object.new_record?
16
+ %td
17
+ = fa.input_field :option_id, collection: question.options, multiple: false, required: question.mandatory