qwester 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +29 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/qwester/application.js +15 -0
  5. data/app/assets/stylesheets/qwester/application.css +13 -0
  6. data/app/controllers/qwester/application_controller.rb +4 -0
  7. data/app/helpers/qwester/application_helper.rb +4 -0
  8. data/app/models/qwester/answer.rb +44 -0
  9. data/app/models/qwester/answer_store.rb +38 -0
  10. data/app/models/qwester/question.rb +36 -0
  11. data/app/models/qwester/questionnaire.rb +77 -0
  12. data/app/models/qwester/questionnaires_question.rb +10 -0
  13. data/app/models/qwester/rule_set.rb +81 -0
  14. data/app/views/layouts/qwester/application.html.erb +14 -0
  15. data/config/routes.rb +2 -0
  16. data/db/migrate/20121008151526_create_questions.rb +13 -0
  17. data/db/migrate/20121008152106_create_answers.rb +9 -0
  18. data/db/migrate/20121008153758_create_rule_sets.rb +15 -0
  19. data/db/migrate/20121009080219_create_questionnaires.rb +14 -0
  20. data/db/migrate/20121009095600_create_answer_stores.rb +13 -0
  21. data/db/migrate/20121009160807_add_questionnaire_id_to_answers.rb +5 -0
  22. data/db/migrate/20121009161206_change_answers_value_to_string.rb +9 -0
  23. data/db/migrate/20121019111051_add_button_image_to_questionnaires.rb +7 -0
  24. data/db/migrate/20121114084347_create_ckeditor_assets.rb +26 -0
  25. data/db/migrate/20121115114408_add_ref_to_questions.rb +5 -0
  26. data/db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb +25 -0
  27. data/db/migrate/20121122130930_add_cope_index_and_position_to_answers.rb +6 -0
  28. data/db/migrate/20121122141628_remove_questionnaire_from_answer.rb +9 -0
  29. data/db/migrate/20121126152146_add_rule_to_rule_sets.rb +5 -0
  30. data/db/migrate/20121203150555_add_multi_answer_to_questions.rb +5 -0
  31. data/db/migrate/20121204082213_create_answer_stores_questionnaires.rb +10 -0
  32. data/db/migrate/20121204100803_add_link_text_to_rule_sets.rb +5 -0
  33. data/lib/active_admin/admin/answers.rb +73 -0
  34. data/lib/active_admin/admin/questionnaires.rb +76 -0
  35. data/lib/active_admin/admin/questions.rb +74 -0
  36. data/lib/active_admin/admin/rule_sets.rb +176 -0
  37. data/lib/qwester/engine.rb +5 -0
  38. data/lib/qwester/version.rb +3 -0
  39. data/lib/qwester.rb +26 -0
  40. data/lib/random_string.rb +20 -0
  41. data/lib/tasks/qwester_tasks.rake +28 -0
  42. data/test/dummy/README.rdoc +261 -0
  43. data/test/dummy/Rakefile +7 -0
  44. data/test/dummy/app/admin/admin_user.rb +21 -0
  45. data/test/dummy/app/admin/dashboard.rb +33 -0
  46. data/test/dummy/app/assets/javascripts/active_admin.js +25 -0
  47. data/test/dummy/app/assets/javascripts/application.js +15 -0
  48. data/test/dummy/app/assets/stylesheets/active_admin.css.scss +92 -0
  49. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  50. data/test/dummy/app/controllers/application_controller.rb +3 -0
  51. data/test/dummy/app/helpers/application_helper.rb +2 -0
  52. data/test/dummy/app/models/admin_user.rb +20 -0
  53. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  54. data/test/dummy/config/application.rb +59 -0
  55. data/test/dummy/config/boot.rb +10 -0
  56. data/test/dummy/config/database.yml +25 -0
  57. data/test/dummy/config/environment.rb +5 -0
  58. data/test/dummy/config/environments/development.rb +37 -0
  59. data/test/dummy/config/environments/production.rb +67 -0
  60. data/test/dummy/config/environments/test.rb +37 -0
  61. data/test/dummy/config/initializers/active_admin.rb +160 -0
  62. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  63. data/test/dummy/config/initializers/devise.rb +240 -0
  64. data/test/dummy/config/initializers/inflections.rb +15 -0
  65. data/test/dummy/config/initializers/mime_types.rb +5 -0
  66. data/test/dummy/config/initializers/qwester.rb +2 -0
  67. data/test/dummy/config/initializers/secret_token.rb +7 -0
  68. data/test/dummy/config/initializers/session_store.rb +8 -0
  69. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  70. data/test/dummy/config/locales/devise.en.yml +60 -0
  71. data/test/dummy/config/locales/en.yml +5 -0
  72. data/test/dummy/config/routes.rb +9 -0
  73. data/test/dummy/config.ru +4 -0
  74. data/test/dummy/db/development.sqlite3 +0 -0
  75. data/test/dummy/db/migrate/20130110115938_devise_create_admin_users.rb +47 -0
  76. data/test/dummy/db/migrate/20130110115940_create_admin_comments.rb +17 -0
  77. data/test/dummy/db/migrate/20130111112924_create_questions.qwester.rb +14 -0
  78. data/test/dummy/db/migrate/20130111112925_create_answers.qwester.rb +10 -0
  79. data/test/dummy/db/migrate/20130111112926_create_rule_sets.qwester.rb +16 -0
  80. data/test/dummy/db/migrate/20130111112927_create_questionnaires.qwester.rb +15 -0
  81. data/test/dummy/db/migrate/20130111112928_create_answer_stores.qwester.rb +14 -0
  82. data/test/dummy/db/migrate/20130111112929_add_questionnaire_id_to_answers.qwester.rb +6 -0
  83. data/test/dummy/db/migrate/20130111112930_change_answers_value_to_string.qwester.rb +10 -0
  84. data/test/dummy/db/migrate/20130111112931_add_button_image_to_questionnaires.qwester.rb +8 -0
  85. data/test/dummy/db/migrate/20130111112932_create_ckeditor_assets.qwester.rb +27 -0
  86. data/test/dummy/db/migrate/20130111112933_add_ref_to_questions.qwester.rb +6 -0
  87. data/test/dummy/db/migrate/20130111112934_add_cope_index_and_position_to_answers.qwester.rb +7 -0
  88. data/test/dummy/db/migrate/20130111112935_remove_questionnaire_from_answer.qwester.rb +10 -0
  89. data/test/dummy/db/migrate/20130111112936_add_rule_to_rule_sets.qwester.rb +6 -0
  90. data/test/dummy/db/migrate/20130111112937_add_multi_answer_to_questions.qwester.rb +6 -0
  91. data/test/dummy/db/migrate/20130111112938_create_answer_stores_questionnaires.qwester.rb +11 -0
  92. data/test/dummy/db/migrate/20130111112939_add_link_text_to_rule_sets.qwester.rb +6 -0
  93. data/test/dummy/db/migrate/20130111121500_add_ids_to_questionnaires_questions.qwester.rb +26 -0
  94. data/test/dummy/db/schema.rb +136 -0
  95. data/test/dummy/db/seeds.rb +15 -0
  96. data/test/dummy/db/test.sqlite3 +0 -0
  97. data/test/dummy/log/development.log +30161 -0
  98. data/test/dummy/log/test.log +27080 -0
  99. data/test/dummy/public/404.html +26 -0
  100. data/test/dummy/public/422.html +26 -0
  101. data/test/dummy/public/500.html +25 -0
  102. data/test/dummy/public/favicon.ico +0 -0
  103. data/test/dummy/public/system/qwester/questionnaires/button_images/000/000/001/link/NewGitGui.png +0 -0
  104. data/test/dummy/public/system/qwester/questionnaires/button_images/000/000/001/original/NewGitGui.png +0 -0
  105. data/test/dummy/public/system/qwester/questionnaires/button_images/000/000/001/thumbnail/NewGitGui.png +0 -0
  106. data/test/dummy/script/rails +6 -0
  107. data/test/dummy/test/fixtures/admin_users.yml +5 -0
  108. data/test/dummy/test/fixtures/qwester/answer_stores.yml +4 -0
  109. data/test/dummy/test/fixtures/qwester/answers.yml +11 -0
  110. data/test/dummy/test/fixtures/qwester/questionnaires.yml +8 -0
  111. data/test/dummy/test/fixtures/qwester/questionnaires_questions.yml +5 -0
  112. data/test/dummy/test/fixtures/qwester/questions.yml +8 -0
  113. data/test/dummy/test/fixtures/qwester/rule_sets.yml +5 -0
  114. data/test/dummy/test/unit/admin_user_test.rb +9 -0
  115. data/test/dummy/tmp/cache/assets/C4C/010/sprockets%2F54b8f935fa0154a496735945134b201c +0 -0
  116. data/test/dummy/tmp/cache/assets/C6B/340/sprockets%2Fac675153e3c112d081881cb5b0193343 +0 -0
  117. data/test/dummy/tmp/cache/assets/C98/130/sprockets%2Fac989787df92df5f053582229580052f +0 -0
  118. data/test/dummy/tmp/cache/assets/C9F/BF0/sprockets%2F74327e193051ca314d7f40d949aa0f01 +0 -0
  119. data/test/dummy/tmp/cache/assets/CB3/400/sprockets%2F0778280cf7cd9842623b4a47c3636eb0 +0 -0
  120. data/test/dummy/tmp/cache/assets/CB3/7B0/sprockets%2F8acda6f91309162736a905e927b791b0 +0 -0
  121. data/test/dummy/tmp/cache/assets/CB7/210/sprockets%2Fd75d7926600f009b7bc12f299575af61 +0 -0
  122. data/test/dummy/tmp/cache/assets/CBE/9C0/sprockets%2F21d85716322c5b339f859cc7d9517b6e +0 -0
  123. data/test/dummy/tmp/cache/assets/CC9/6B0/sprockets%2F3df521832967357b1c7b16678fc8e8f7 +0 -0
  124. data/test/dummy/tmp/cache/assets/CC9/FB0/sprockets%2F255d9f63b60b2f99705d9ece86410996 +0 -0
  125. data/test/dummy/tmp/cache/assets/CD6/AE0/sprockets%2F18183d077906f0468bdaa021e5944daa +0 -0
  126. data/test/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
  127. data/test/dummy/tmp/cache/assets/CE4/280/sprockets%2F99d4bf693c83b5093ab8702160c1d6e5 +0 -0
  128. data/test/dummy/tmp/cache/assets/CF4/190/sprockets%2F15945979ce0f558e72219220cdf8e5ee +0 -0
  129. data/test/dummy/tmp/cache/assets/D16/CB0/sprockets%2Fb0e226708d5f9958bbaf5639fd402e50 +0 -0
  130. data/test/dummy/tmp/cache/assets/D18/9A0/sprockets%2F790d9164fe7b9cb772271a0e2ddf2646 +0 -0
  131. data/test/dummy/tmp/cache/assets/D1C/6A0/sprockets%2F39f774b8adbce198362541931e4e80fc +0 -0
  132. data/test/dummy/tmp/cache/assets/D22/7F0/sprockets%2Fb0746263298bc88dffc3faa791d44786 +0 -0
  133. data/test/dummy/tmp/cache/assets/D25/BA0/sprockets%2F0fa25091225221bc828ca4abb28cb5c8 +0 -0
  134. data/test/dummy/tmp/cache/assets/D33/D50/sprockets%2Ff8d0dac22223755ab4bae6c44180e829 +0 -0
  135. data/test/dummy/tmp/cache/assets/D36/C80/sprockets%2Ff5ef17012cd57c01767028aba0593fcf +0 -0
  136. data/test/dummy/tmp/cache/assets/D37/F40/sprockets%2F34ae0821bc15772a27ca08fc3682fe7d +0 -0
  137. data/test/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
  138. data/test/dummy/tmp/cache/assets/D3E/330/sprockets%2F45f2fada4467c9ac38a41d9463b822c4 +0 -0
  139. data/test/dummy/tmp/cache/assets/D3F/EB0/sprockets%2Fad2888184b513b29cc27bda05be8c396 +0 -0
  140. data/test/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
  141. data/test/dummy/tmp/cache/assets/D4A/310/sprockets%2Fdd19e98ed3ea33cd27397508b0e34e74 +0 -0
  142. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  143. data/test/dummy/tmp/cache/assets/D4F/930/sprockets%2F593ef7a6dd9e164ce9156637a079eba2 +0 -0
  144. data/test/dummy/tmp/cache/assets/D52/2B0/sprockets%2Fcaba6996d3b0ce9425a2d4918e6e8797 +0 -0
  145. data/test/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
  146. data/test/dummy/tmp/cache/assets/D61/190/sprockets%2Faece940f39e2ac68033f05b15fe10c16 +0 -0
  147. data/test/dummy/tmp/cache/assets/D61/6B0/sprockets%2F5f51d0141dcc429477e6169aabb1f2ad +0 -0
  148. data/test/dummy/tmp/cache/assets/D63/760/sprockets%2F03bf27ec3f65ed19bc131123a59b3d6f +0 -0
  149. data/test/dummy/tmp/cache/assets/D64/6D0/sprockets%2Fefc35e335323b974c3e1bbbb13693ea4 +0 -0
  150. data/test/dummy/tmp/cache/assets/D66/3A0/sprockets%2F02491a6027da7d0caa9c2282fd3f7e6f +0 -0
  151. data/test/dummy/tmp/cache/assets/D69/E90/sprockets%2F14aed5aa2792db4162f05688f04dfa5e +0 -0
  152. data/test/dummy/tmp/cache/assets/D6C/5B0/sprockets%2F4cd5cd94a5b8ce62e7635a63df0103e5 +0 -0
  153. data/test/dummy/tmp/cache/assets/D6E/160/sprockets%2F589e06b575fdb89ccc10373f40ba2bf3 +0 -0
  154. data/test/dummy/tmp/cache/assets/D76/CB0/sprockets%2Fbcaf3567253694bc09a79858c7bdad2a +0 -0
  155. data/test/dummy/tmp/cache/assets/D81/D40/sprockets%2Faa5b982ce995ea3c817a93f8c847a52e +0 -0
  156. data/test/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
  157. data/test/dummy/tmp/cache/assets/D9E/BC0/sprockets%2F92b1852c4b3d97cf5a18fb9b171cdc3d +0 -0
  158. data/test/dummy/tmp/cache/assets/DA3/9B0/sprockets%2Fa2bdb6a97d41e3cca6465c59cd5929b5 +0 -0
  159. data/test/dummy/tmp/cache/assets/DA9/B40/sprockets%2Ff028f8a00eb67fbe213ef8fce8c97218 +0 -0
  160. data/test/dummy/tmp/cache/assets/DB3/6A0/sprockets%2F5fbfb11cd54686a98ffe386339a9ddc4 +0 -0
  161. data/test/dummy/tmp/cache/assets/DDA/830/sprockets%2Fde697cb19a97c9cdda00773d54e43ded +0 -0
  162. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  163. data/test/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
  164. data/test/dummy/tmp/cache/assets/DFD/E80/sprockets%2Fb6ba4f337e14c4942a8e68bfaed03bff +0 -0
  165. data/test/dummy/tmp/cache/assets/E03/CE0/sprockets%2Fee7fdb52ea0ff7e5426102ee68beeb47 +0 -0
  166. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  167. data/test/dummy/tmp/cache/assets/E31/7C0/sprockets%2F306cef7b76fd0633afd6eecde15d7ab7 +0 -0
  168. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_all.css.scssc +0 -0
  169. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_buttons.css.scssc +0 -0
  170. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_gradients.css.scssc +0 -0
  171. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_icons.css.scssc +0 -0
  172. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_reset.css.scssc +0 -0
  173. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_rounded.css.scssc +0 -0
  174. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_sections.css.scssc +0 -0
  175. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_shadows.css.scssc +0 -0
  176. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_typography.scssc +0 -0
  177. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_utilities.scssc +0 -0
  178. data/test/dummy/tmp/cache/sass/1b985f49f4ef70efe7765896dd6d11dc84e592e3/_variables.css.scssc +0 -0
  179. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_compact.scssc +0 -0
  180. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_deprecated-webkit-gradient.scssc +0 -0
  181. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_flex-grid.scssc +0 -0
  182. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_grid-width.scssc +0 -0
  183. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_linear-gradient.scssc +0 -0
  184. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_modular-scale.scssc +0 -0
  185. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_radial-gradient.scssc +0 -0
  186. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_render-gradients.scssc +0 -0
  187. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_tint-shade.scssc +0 -0
  188. data/test/dummy/tmp/cache/sass/2355fa6dab0aa429d9df289512dc0da905fd8dbf/_transition-property-name.scssc +0 -0
  189. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_button.scssc +0 -0
  190. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_clearfix.scssc +0 -0
  191. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_font-family.scssc +0 -0
  192. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_hide-text.scssc +0 -0
  193. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_html5-input-types.scssc +0 -0
  194. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_position.scssc +0 -0
  195. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_prefixer.scssc +0 -0
  196. data/test/dummy/tmp/cache/sass/2abdd63474180b8efbb2fe4a96c7d4e58de1b07d/_timing-functions.scssc +0 -0
  197. data/test/dummy/tmp/cache/sass/2fd9c76d84cefb666046113b053d85103e19230b/active_admin.css.scssc +0 -0
  198. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_batch_actions.css.scssc +0 -0
  199. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_blank_slates.scssc +0 -0
  200. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_breadcrumbs.scssc +0 -0
  201. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_buttons.scssc +0 -0
  202. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_columns.scssc +0 -0
  203. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_comments.css.scssc +0 -0
  204. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_date_picker.css.scssc +0 -0
  205. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_dropdown_menu.scssc +0 -0
  206. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_flash_messages.css.scssc +0 -0
  207. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_grid.scssc +0 -0
  208. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_links.scssc +0 -0
  209. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_pagination.scssc +0 -0
  210. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_panels.scssc +0 -0
  211. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_popovers.css.scssc +0 -0
  212. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_scopes.scssc +0 -0
  213. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_status_tags.scssc +0 -0
  214. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_table_tools.css.scssc +0 -0
  215. data/test/dummy/tmp/cache/sass/42367c0b8e97cd09844c3165386e8db541b5d479/_tables.css.scssc +0 -0
  216. data/test/dummy/tmp/cache/sass/6d829b1892146f93bc53d024914f97a49c36b400/_bourbon-deprecated-upcoming.scssc +0 -0
  217. data/test/dummy/tmp/cache/sass/6d829b1892146f93bc53d024914f97a49c36b400/_bourbon.scssc +0 -0
  218. data/test/dummy/tmp/cache/sass/c7c7191f5bd579910d0a21a37cd1dab835baea9d/_dashboard.scssc +0 -0
  219. data/test/dummy/tmp/cache/sass/c7c7191f5bd579910d0a21a37cd1dab835baea9d/_logged_out.scssc +0 -0
  220. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_animation.scssc +0 -0
  221. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_appearance.scssc +0 -0
  222. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_background-image.scssc +0 -0
  223. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_background-size.scssc +0 -0
  224. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_background.scssc +0 -0
  225. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_border-image.scssc +0 -0
  226. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_border-radius.scssc +0 -0
  227. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_box-shadow.scssc +0 -0
  228. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_box-sizing.scssc +0 -0
  229. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_columns.scssc +0 -0
  230. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_flex-box.scssc +0 -0
  231. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_font-face.scssc +0 -0
  232. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_hidpi-media-query.scssc +0 -0
  233. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_image-rendering.scssc +0 -0
  234. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_inline-block.scssc +0 -0
  235. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_linear-gradient.scssc +0 -0
  236. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_perspective.scssc +0 -0
  237. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_radial-gradient.scssc +0 -0
  238. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_transform.scssc +0 -0
  239. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_transition.scssc +0 -0
  240. data/test/dummy/tmp/cache/sass/d58df6bafe26696bc29be9546a2c3f69fc2cbc33/_user-select.scssc +0 -0
  241. data/test/dummy/tmp/cache/sass/d883993f4a35b9fb9fb68f2951234bfae10b809e/_footer.scssc +0 -0
  242. data/test/dummy/tmp/cache/sass/d883993f4a35b9fb9fb68f2951234bfae10b809e/_main_structure.scssc +0 -0
  243. data/test/dummy/tmp/cache/sass/d883993f4a35b9fb9fb68f2951234bfae10b809e/_title_bar.scssc +0 -0
  244. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/_base.css.scssc +0 -0
  245. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/_forms.css.scssc +0 -0
  246. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/_header.css.scssc +0 -0
  247. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/_mixins.css.scssc +0 -0
  248. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/_typography.css.scssc +0 -0
  249. data/test/dummy/tmp/cache/sass/ec74dbbd041d002f29da87d31c42c67a52577d7d/print.css.scssc +0 -0
  250. data/test/integration/navigation_test.rb +10 -0
  251. data/test/test_helper.rb +21 -0
  252. data/test/unit/qwester/answer_store_test.rb +49 -0
  253. data/test/unit/qwester/answer_test.rb +47 -0
  254. data/test/unit/qwester/question_test.rb +42 -0
  255. data/test/unit/qwester/questionnaire_test.rb +18 -0
  256. data/test/unit/qwester/questionnaires_question_test.rb +62 -0
  257. data/test/unit/qwester/rule_set_test.rb +134 -0
  258. data/test/unit/qwester_test.rb +33 -0
  259. metadata +617 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,29 @@
1
+ = Qwester
2
+
3
+
4
+
5
+ == Integration with ActiveAdmin
6
+
7
+ Qwester contains a set of ActiveAdmin registration files, that allow Qwester
8
+ models to be managed from within the parent app's active_admin space. Of course
9
+ ActiveAdmin needs to be installed and working in the parent rails application
10
+
11
+ To use the Qwester ActiveAdmin registration files, add this to the active_admin
12
+ initializer in your application.
13
+
14
+ config.load_paths << Qwester.active_admin_load_path
15
+
16
+ See test/dummy/config/initializers/active_admin.rb for an example
17
+
18
+ Links to the admin pages for Qwester models will appear in a 'Qwester' sub-menu.
19
+ If you wish to change the name of the menu parent group, add this to an
20
+ initializer:
21
+
22
+ Qwester.active_admin_menu = 'menu name'
23
+
24
+ Alternatively, if you want the Qwester models not to be grouped add this to an
25
+ initializer:
26
+
27
+ Qwester.active_admin_menu = 'none'
28
+
29
+ See test/dummy/config/initializers/qwester.rb for an example
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Qwester'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module Qwester
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Qwester
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,44 @@
1
+ module Qwester
2
+ class Answer < ActiveRecord::Base
3
+ attr_accessible :value, :question_id, :position, :cope_index
4
+
5
+ DEFAULT_VALUE = 'Not applicable'
6
+ STANDARD_VALUES = ['Yes', 'No', DEFAULT_VALUE]
7
+
8
+ has_and_belongs_to_many(
9
+ :rule_sets,
10
+ :join_table => :qwester_answers_rule_sets
11
+ )
12
+
13
+ has_and_belongs_to_many(
14
+ :answer_stores,
15
+ :join_table => :qwester_answer_stores_answers
16
+ )
17
+
18
+ belongs_to :question
19
+
20
+ acts_as_list :scope => :question
21
+
22
+ validates :value, :presence => true
23
+
24
+ def self.find_first_or_create(attributes)
25
+ where(attributes).first || create(attributes)
26
+ end
27
+
28
+ def self.standard_values
29
+ STANDARD_VALUES
30
+ end
31
+
32
+ def self.default_value
33
+ DEFAULT_VALUE
34
+ end
35
+
36
+ def self.rule_label_prefix
37
+ @rule_label_prefix ||= 'a'
38
+ end
39
+
40
+ def rule_label
41
+ "#{self.class.rule_label_prefix}#{self.id}"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,38 @@
1
+ module Qwester
2
+ class AnswerStore < ActiveRecord::Base
3
+
4
+ has_and_belongs_to_many(
5
+ :answers,
6
+ :join_table => :qwester_answer_stores_answers,
7
+ :uniq => true
8
+ )
9
+ has_and_belongs_to_many(
10
+ :questionnaires,
11
+ :join_table => :qwester_answer_stores_questionnaires,
12
+ :uniq => true
13
+ )
14
+
15
+ before_save :generate_session_id
16
+
17
+ def cope_index_sum
18
+ answers.sum(:cope_index)
19
+ end
20
+
21
+ def reset
22
+ answers.clear
23
+ questionnaires.clear
24
+ end
25
+
26
+ def to_param
27
+ session_id
28
+ end
29
+
30
+ private
31
+
32
+ def generate_session_id
33
+ if !self.session_id or self.session_id.empty?
34
+ self.session_id = RandomString.new(15)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ module Qwester
2
+ class Question < ActiveRecord::Base
3
+ attr_accessible :title, :description, :ref, :answers_attributes, :multi_answer
4
+
5
+ has_many(
6
+ :answers,
7
+ :order => 'position',
8
+ :dependent => :destroy
9
+ )
10
+ accepts_nested_attributes_for :answers
11
+
12
+ has_many :questionnaires_questions
13
+
14
+ has_many(
15
+ :questionnaires,
16
+ :through => :questionnaires_questions,
17
+ :uniq => true
18
+ )
19
+
20
+ validates :title, :presence => true
21
+
22
+ def build_standard_answers
23
+ created_answers = Array.new
24
+ Answer.standard_values.each_with_index do |value, index|
25
+ answer = answers.find_or_initialize_by_value(value)
26
+ answer.position = index + 1
27
+ created_answers << answer
28
+ end
29
+ return created_answers
30
+ end
31
+
32
+ def create_standard_answers
33
+ build_standard_answers.each(&:save)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,77 @@
1
+ module Qwester
2
+ class Questionnaire < ActiveRecord::Base
3
+ attr_accessible :title, :description, :button_image, :question_ids
4
+
5
+ has_many(
6
+ :questionnaires_questions,
7
+ :order => 'position'
8
+ )
9
+
10
+ has_many(
11
+ :questions,
12
+ :uniq => true,
13
+ :through => :questionnaires_questions,
14
+ :order => 'position'
15
+ )
16
+
17
+ has_many(
18
+ :answers,
19
+ :through => :questions,
20
+ :uniq => true
21
+ )
22
+ accepts_nested_attributes_for :answers
23
+
24
+ has_attached_file(
25
+ :button_image,
26
+ :styles => {
27
+ :link => '150x125>',
28
+ :thumbnail => '50x50>'
29
+ }
30
+ )
31
+
32
+ has_and_belongs_to_many :answer_stores, :uniq => true
33
+
34
+ validates :title, :presence => true
35
+
36
+ private
37
+ def method_missing(symbol, *args, &block)
38
+ if acts_as_list_method?(symbol)
39
+ pass_method_to_questionnaires_question(symbol, args.first)
40
+ else
41
+ super
42
+ end
43
+ end
44
+
45
+ # Allows acts_as_list methods to be used within the questionnaire.
46
+ # If questions were the act_as_list object, you could do things like this
47
+ #
48
+ # questionnaire.questions.last.move_higher
49
+ #
50
+ # However, as questions are used on multiple questionnaires and they
51
+ # need to be independently sortable within each questionnaire, it is the
52
+ # through table model QuestionnairesQuestion that acts_as_list. To change
53
+ # position the change must be made in the context of the questionnaire.
54
+ # pass_method_to_questionnaires_question in combination with method_missing,
55
+ # allows you to pass to a questionnaire the acts_as_list method together with
56
+ # the question it needs to effect. The equivalent move_higher call then becomes:
57
+ #
58
+ # questionnaire.move_higher(questionnaire.questions.last)
59
+ #
60
+ # You can also do:
61
+ #
62
+ # questionnaire.move_to_top(question)
63
+ # questionnaire.last?(question)
64
+ #
65
+ def pass_method_to_questionnaires_question(symbol, question)
66
+ raise "A Question is needed to identify QuestionnairesQuestion" unless question.kind_of? Question
67
+ questionnaires_question = questionnaires_questions.where(:question_id => question.id).first
68
+ questionnaires_question.send(symbol) if questionnaires_question
69
+ end
70
+
71
+ def acts_as_list_method?(symbol)
72
+ ActiveRecord::Acts::List::InstanceMethods.instance_methods.include?(symbol.to_sym)
73
+ end
74
+
75
+
76
+ end
77
+ end
@@ -0,0 +1,10 @@
1
+ module Qwester
2
+ class QuestionnairesQuestion < ActiveRecord::Base
3
+ attr_accessible :position
4
+
5
+ belongs_to :questionnaire
6
+ belongs_to :question
7
+
8
+ acts_as_list :scope => :questionnaire
9
+ end
10
+ end
@@ -0,0 +1,81 @@
1
+ require 'array_logic'
2
+ module Qwester
3
+ class RuleSet < ActiveRecord::Base
4
+ attr_accessible :title, :description, :answers, :url, :rule, :answer_ids, :link_text, :warning_id
5
+
6
+ before_save :keep_answers_in_step_with_rule
7
+
8
+ DEFAULT_RULE_JOIN = 'or'
9
+ ANSWERS_LIMIT = 10
10
+
11
+ has_and_belongs_to_many(
12
+ :answers,
13
+ :uniq => true,
14
+ :join_table => :qwester_answers_rule_sets
15
+ )
16
+ accepts_nested_attributes_for :answers
17
+
18
+ has_many(
19
+ :questions,
20
+ :through => :answers
21
+ )
22
+
23
+ validate :check_rule_is_valid
24
+
25
+ validates :title, :presence => true
26
+ validates :url, :presence => true
27
+
28
+
29
+ def self.matching(answers)
30
+ all.collect{|rule_set| rule_set if rule_set.match(answers)}.compact
31
+ end
32
+
33
+ def match(answers_to_check = nil)
34
+ return unless answers_to_check and !answers_to_check.empty?
35
+ generate_default_rule && save
36
+ logic.match(answers_to_check)
37
+ end
38
+
39
+ def logic
40
+ @logic || get_logic
41
+ end
42
+
43
+ def matching_answer_sets
44
+ @matching_answer_sets ||= logic.matching_combinations
45
+ end
46
+
47
+ def blocking_answer_sets
48
+ @blocking_answer_set ||= logic.blocking_combinations
49
+ end
50
+
51
+ def default_rule
52
+ answers.collect(&:rule_label).join(" #{DEFAULT_RULE_JOIN} ")
53
+ end
54
+
55
+ private
56
+ def get_logic
57
+ @logic = ArrayLogic::Rule.new rule
58
+ end
59
+
60
+ def generate_default_rule
61
+ if (!self.rule or self.rule.empty?) and answers.length > 0
62
+ self.rule = default_rule
63
+ end
64
+ end
65
+
66
+ def keep_answers_in_step_with_rule
67
+ generate_default_rule
68
+ self.answers = get_logic.object_ids_used.collect{|id| Answer.find(id)}
69
+ end
70
+
71
+ def check_rule_is_valid
72
+ if rule.present?
73
+ begin
74
+ logic.send :check_rule
75
+ rescue => e
76
+ errors.add(:rule, "error: #{e.message}")
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Qwester</title>
5
+ <%= stylesheet_link_tag "qwester/application", :media => "all" %>
6
+ <%= javascript_include_tag "qwester/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Qwester::Engine.routes.draw do
2
+ end
@@ -0,0 +1,13 @@
1
+ class CreateQuestions < ActiveRecord::Migration
2
+ def change
3
+ create_table :qwester_questions do |t|
4
+ t.string :title
5
+ t.text :description
6
+ t.integer :parent_id
7
+ t.integer :lft
8
+ t.integer :rgt
9
+ t.integer :depth
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class CreateAnswers < ActiveRecord::Migration
2
+ def change
3
+ create_table :qwester_answers do |t|
4
+ t.integer :question_id
5
+ t.boolean :value
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class CreateRuleSets < ActiveRecord::Migration
2
+ def change
3
+ create_table :qwester_rule_sets do |t|
4
+ t.string :title
5
+ t.string :description
6
+ t.string :url
7
+ t.timestamps
8
+ end
9
+
10
+ create_table :qwester_answers_rule_sets, :id => false do |t|
11
+ t.integer :answer_id
12
+ t.integer :rule_set_id
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class CreateQuestionnaires < ActiveRecord::Migration
2
+ def change
3
+ create_table :qwester_questionnaires do |t|
4
+ t.string :title
5
+ t.text :description
6
+ t.timestamps
7
+ end
8
+
9
+ create_table :qwester_questionnaires_questions, :id => false do |t|
10
+ t.integer :questionnaire_id
11
+ t.integer :question_id
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAnswerStores < ActiveRecord::Migration
2
+ def change
3
+ create_table :qwester_answer_stores do |t|
4
+ t.string :session_id
5
+ t.timestamps
6
+ end
7
+
8
+ create_table :qwester_answer_stores_answers, :id => false do |t|
9
+ t.integer :answer_id
10
+ t.integer :answer_store_id
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddQuestionnaireIdToAnswers < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_answers, :questionnaire_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class ChangeAnswersValueToString < ActiveRecord::Migration
2
+ def up
3
+ change_column(:qwester_answers, :value, :string)
4
+ end
5
+
6
+ def down
7
+ change_column(:qwester_answers, :value, :boolean)
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'paperclip'
2
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.send :include, Paperclip::Schema::Statements
3
+ class AddButtonImageToQuestionnaires < ActiveRecord::Migration
4
+ def change
5
+ add_attachment :qwester_questionnaires, :button_image
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ class CreateCkeditorAssets < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :qwester_ckeditor_assets do |t|
4
+ t.string :data_file_name, :null => false
5
+ t.string :data_content_type
6
+ t.integer :data_file_size
7
+
8
+ t.integer :assetable_id
9
+ t.string :assetable_type, :limit => 30
10
+ t.string :type, :limit => 30
11
+
12
+ # Uncomment it to save images dimensions, if your need it
13
+ t.integer :width
14
+ t.integer :height
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index "qwester_ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "qwester_idx_ckeditor_assetable_type"
20
+ add_index "qwester_ckeditor_assets", ["assetable_type", "assetable_id"], :name => "qwester_idx_ckeditor_assetable"
21
+ end
22
+
23
+ def self.down
24
+ drop_table :qwester_ckeditor_assets
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ class AddRefToQuestions < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_questions, :ref, :string
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ class AddIdsToQuestionnairesQuestions < ActiveRecord::Migration
2
+ def up
3
+ add_column qq_table, :id, :primary_key
4
+ add_column qq_table, :position, :integer
5
+ add_column qq_table, :created_at, :datetime
6
+ add_column qq_table, :updated_at, :datetime
7
+
8
+ execute "UPDATE #{qq_table} SET created_at = #{Time.now.to_s(:db)}, updated_at = #{Time.now.to_s(:db)};"
9
+
10
+ puts "=============================================="
11
+ puts "Now run 'rake qwester:reset_positions RAILS_ENV=#{Rails.env}' to set the positions"
12
+ puts "=============================================="
13
+ end
14
+
15
+ def down
16
+ remove_column qq_table, :id
17
+ remove_column qq_table, :position
18
+ remove_column qq_table, :created_at
19
+ remove_column qq_table, :updated_at
20
+ end
21
+
22
+ def qq_table
23
+ :qwester_questionnaires_questions
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ class AddCopeIndexAndPositionToAnswers < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_answers, :position, :integer
4
+ add_column :qwester_answers, :cope_index, :integer, :default => 0
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ class RemoveQuestionnaireFromAnswer < ActiveRecord::Migration
2
+ def up
3
+ remove_column :qwester_answers, :questionnaire_id
4
+ end
5
+
6
+ def down
7
+ add_column :qwester_answers, :questionnaire_id, :integer
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddRuleToRuleSets < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_rule_sets, :rule, :text
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddMultiAnswerToQuestions < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_questions, :multi_answer, :boolean
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAnswerStoresQuestionnaires < ActiveRecord::Migration
2
+ def change
3
+
4
+ create_table :qwester_answer_stores_questionnaires, :id => false do |t|
5
+ t.integer :questionnaire_id
6
+ t.integer :answer_store_id
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddLinkTextToRuleSets < ActiveRecord::Migration
2
+ def change
3
+ add_column :qwester_rule_sets, :link_text, :string
4
+ end
5
+ end