activeadmin-selleo-cms 0.0.44 → 0.0.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/app/admin/activeadmin_selleo_cms/form.rb +31 -0
  2. data/app/admin/activeadmin_selleo_cms/form_question.rb +53 -0
  3. data/app/assets/javascripts/active_admin.js +1 -2
  4. data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +20 -1
  5. data/app/assets/javascripts/activeadmin-selleo-cms/forms.js +4 -0
  6. data/app/assets/javascripts/activeadmin-selleo-cms/forms.storage.js +26 -0
  7. data/app/assets/javascripts/activeadmin-selleo-cms/inline-editing.js +1 -1
  8. data/app/assets/javascripts/activeadmin-selleo-cms/jquery.browser.js +43 -0
  9. data/app/assets/javascripts/activeadmin-selleo-cms/jquery.printElement.js +170 -0
  10. data/app/assets/javascripts/activeadmin-selleo-cms/jquery.validate.js +1231 -0
  11. data/app/controllers/forms_controller.rb +32 -0
  12. data/app/mailers/activeadmin_selleo_cms/form_mailer.rb +10 -0
  13. data/app/models/activeadmin_selleo_cms/form.rb +11 -0
  14. data/app/models/activeadmin_selleo_cms/form_question.rb +75 -0
  15. data/app/models/activeadmin_selleo_cms/form_question_option.rb +22 -0
  16. data/app/models/activeadmin_selleo_cms/section.rb +20 -1
  17. data/app/views/activeadmin_selleo_cms/form_mailer/form_submission.html.erb +12 -0
  18. data/app/views/admin/form_questions/_form.html.haml +45 -0
  19. data/app/views/admin/form_questions/create.js.erb +7 -0
  20. data/app/views/admin/form_questions/destroy.js.erb +2 -0
  21. data/app/views/admin/form_questions/update.js.erb +7 -0
  22. data/app/views/admin/forms/_form.html.haml +50 -0
  23. data/app/views/admin/forms/_question.html.haml +8 -0
  24. data/app/views/admin/forms/_question_type.html.haml +6 -0
  25. data/app/views/admin/forms/_questions.html.haml +2 -0
  26. data/app/views/admin/pages/_form.html.haml +5 -2
  27. data/app/views/admin/pages/_translated_fields.html.haml +4 -4
  28. data/app/views/admin/pages/update.js.erb +1 -1
  29. data/app/views/admin/section_translations/_form.html.haml +2 -0
  30. data/app/views/forms/_form.html.erb +29 -0
  31. data/app/views/forms/deliver.html.erb +4 -0
  32. data/app/views/forms/download.pdf.erb +14 -0
  33. data/app/views/pages/show.html.haml +2 -1
  34. data/config/initializers/mime_types.rb +1 -0
  35. data/config/locales/cms.en.yml +1 -0
  36. data/config/routes.rb +7 -0
  37. data/db/migrate/20130625104333_create_activeadmin_selleo_cms_forms.rb +7 -0
  38. data/db/migrate/20130625104427_create_activeadmin_selleo_cms_form_questions.rb +15 -0
  39. data/db/migrate/20130625104459_create_activeadmin_selleo_cms_form_question_options.rb +10 -0
  40. data/lib/activeadmin-selleo-cms/version.rb +1 -1
  41. data/spec/dummy/db/migrate/20130206173233_change_activeadmin_selleo_cms_searches.rb +29 -0
  42. data/spec/dummy/db/migrate/20130207213528_change_activeadmin_selleo_cms_assets.rb +12 -0
  43. data/spec/dummy/db/migrate/20130211151210_create_activeadmin_selleo_cms_related_items.rb +16 -0
  44. data/spec/dummy/db/migrate/20130531154539_add_position_to_assets.rb +9 -0
  45. data/spec/dummy/db/migrate/20130601141800_add_position_to_related_items.rb +9 -0
  46. data/spec/dummy/db/migrate/20130625104333_create_activeadmin_selleo_cms_forms.rb +7 -0
  47. data/spec/dummy/db/migrate/20130625104427_create_activeadmin_selleo_cms_form_questions.rb +15 -0
  48. data/spec/dummy/db/migrate/20130625104459_create_activeadmin_selleo_cms_form_question_options.rb +10 -0
  49. data/spec/dummy/db/schema.rb +45 -4
  50. data/spec/dummy/db/snapshots/test_database.sql +298 -0
  51. data/spec/dummy/log/development.log +1 -0
  52. data/spec/dummy/log/test.log +24524 -0
  53. data/spec/dummy/tmp/cache/assets/C77/340/sprockets%2F06f5481af9739c75a130a117a607f701 +0 -0
  54. data/spec/dummy/tmp/cache/assets/C8B/AF0/sprockets%2F829fd285b34b067b7a65772590b9322f +0 -0
  55. data/spec/dummy/tmp/cache/assets/CA5/480/sprockets%2F662b7f1465cf2231ce74c33a12b49750 +0 -0
  56. data/spec/dummy/tmp/cache/assets/CA7/930/sprockets%2F4160ea0b3fb73ed707d1663757351b91 +0 -0
  57. data/spec/dummy/tmp/cache/assets/CAE/840/sprockets%2F7cbe7330e41e804f2323d41959368bf0 +0 -0
  58. data/spec/dummy/tmp/cache/assets/CD2/9B0/sprockets%2Fcbd8386d355c330321c6091d29fe50a1 +0 -0
  59. data/spec/dummy/tmp/cache/assets/CD4/C50/sprockets%2Fa3fd41a03ba7406d295997bb5223f820 +0 -0
  60. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  61. data/spec/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
  62. data/spec/dummy/tmp/cache/assets/CEB/360/sprockets%2F6beae78de744da1a77728164871177e0 +0 -0
  63. data/spec/dummy/tmp/cache/assets/D1B/ED0/sprockets%2F27587b13b847c685fe516cb0b3a9f7b7 +0 -0
  64. data/spec/dummy/tmp/cache/assets/D20/880/sprockets%2Fc3074825fcb4400fc3312e42a0bce4a4 +0 -0
  65. data/spec/dummy/tmp/cache/assets/D27/750/sprockets%2Fd3dc17d4a8d304b11a443003fc3e8f34 +0 -0
  66. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  67. data/spec/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
  68. data/spec/dummy/tmp/cache/assets/D40/960/sprockets%2F8302b0f1464044ee7cead2ae929b888d +0 -0
  69. data/spec/dummy/tmp/cache/assets/D42/580/sprockets%2F2f962efaf10652ad49924dd754aa14e8 +0 -0
  70. data/spec/dummy/tmp/cache/assets/D44/6E0/sprockets%2F754ecc8c755a2e4064066fdde3b16d93 +0 -0
  71. data/spec/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
  72. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  73. data/spec/dummy/tmp/cache/assets/D50/2E0/sprockets%2Fc214d1c2014b4b02b9bc8949bbb52ba3 +0 -0
  74. data/spec/dummy/tmp/cache/assets/D55/BA0/sprockets%2Fff0987a90494a8eaf8186ced2b5b1598 +0 -0
  75. data/spec/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
  76. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  77. data/spec/dummy/tmp/cache/assets/D67/F70/sprockets%2Ffbf08b2a6103c6f1e6b66c2e7a39b265 +0 -0
  78. data/spec/dummy/tmp/cache/assets/D69/EA0/sprockets%2F7f4b66b3b7213ae1f9acf3b405d5378a +0 -0
  79. data/spec/dummy/tmp/cache/assets/D6C/C30/sprockets%2Fd2f2464120598c8cbdbe2c7c907bf15c +0 -0
  80. data/spec/dummy/tmp/cache/assets/D72/830/sprockets%2F3c584d2138ad334768e75ac7a5ec6baf +0 -0
  81. data/spec/dummy/tmp/cache/assets/D73/720/sprockets%2Fb2b61c47ea6ed4dec438305d887e36c4 +0 -0
  82. data/spec/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
  83. data/spec/dummy/tmp/cache/assets/DBE/250/sprockets%2F708b3d002eb534df6bded3ad61f12ce6 +0 -0
  84. data/spec/dummy/tmp/cache/assets/DDA/DF0/sprockets%2F51bffc0e5dec087e64d1ecb728e9691e +0 -0
  85. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  86. data/spec/dummy/tmp/cache/assets/DDD/CC0/sprockets%2F7db330b00298cfa8e9afcef4929d6f7e +0 -0
  87. data/spec/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
  88. data/spec/dummy/tmp/cache/assets/DE0/9B0/sprockets%2F5a0abb50cbd48f9a10db8c1b42b281eb +0 -0
  89. data/spec/dummy/tmp/cache/assets/DF3/1E0/sprockets%2Faf53b7e5f3b91b6730addb22e1b4e8cc +0 -0
  90. data/spec/dummy/tmp/cache/assets/DFE/550/sprockets%2F9c55bb183d3acabead863e2fdd7a9292 +0 -0
  91. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  92. data/spec/dummy/tmp/cache/assets/E16/490/sprockets%2F12edba3de0bbd243b58b0ffc604df43c +0 -0
  93. data/spec/dummy/tmp/cache/assets/E36/860/sprockets%2F78244ec4bfe8bacf1affa0a39e43f8f8 +0 -0
  94. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_all.css.scssc +0 -0
  95. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_buttons.css.scssc +0 -0
  96. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_gradients.css.scssc +0 -0
  97. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_icons.css.scssc +0 -0
  98. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_reset.css.scssc +0 -0
  99. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_rounded.css.scssc +0 -0
  100. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_sections.css.scssc +0 -0
  101. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_shadows.css.scssc +0 -0
  102. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_typography.scssc +0 -0
  103. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_utilities.scssc +0 -0
  104. data/spec/dummy/tmp/cache/sass/09e583e9f1586e2218afa17943c4e98d5d86c0c6/_variables.css.scssc +0 -0
  105. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_compact.scssc +0 -0
  106. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_flex-grid.scssc +0 -0
  107. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_grid-width.scssc +0 -0
  108. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_linear-gradient.scssc +0 -0
  109. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_modular-scale.scssc +0 -0
  110. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_px-to-em.scssc +0 -0
  111. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_radial-gradient.scssc +0 -0
  112. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_tint-shade.scssc +0 -0
  113. data/spec/dummy/tmp/cache/sass/15da70bc7d0da60bc7a0f58553e8f13c7238b9a6/_transition-property-name.scssc +0 -0
  114. data/spec/dummy/tmp/cache/sass/52912b08735a03631875d00219891a582ac39f91/active_admin.css.scssc +0 -0
  115. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_batch_actions.css.scssc +0 -0
  116. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_blank_slates.scssc +0 -0
  117. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_breadcrumbs.scssc +0 -0
  118. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_buttons.scssc +0 -0
  119. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_columns.scssc +0 -0
  120. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_comments.css.scssc +0 -0
  121. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_date_picker.css.scssc +0 -0
  122. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_dropdown_menu.scssc +0 -0
  123. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_flash_messages.css.scssc +0 -0
  124. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_grid.scssc +0 -0
  125. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_index_list.scssc +0 -0
  126. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_links.scssc +0 -0
  127. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_pagination.scssc +0 -0
  128. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_panels.scssc +0 -0
  129. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_popovers.css.scssc +0 -0
  130. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_scopes.scssc +0 -0
  131. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_status_tags.scssc +0 -0
  132. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_table_tools.css.scssc +0 -0
  133. data/spec/dummy/tmp/cache/sass/58755c7eaf517716926b0807287ef35489683c47/_tables.css.scssc +0 -0
  134. data/spec/dummy/tmp/cache/sass/87d9aadf92f082c849eefdb769b1f3014fbe3d80/_bourbon-deprecated-upcoming.scssc +0 -0
  135. data/spec/dummy/tmp/cache/sass/87d9aadf92f082c849eefdb769b1f3014fbe3d80/_bourbon.scssc +0 -0
  136. data/spec/dummy/tmp/cache/sass/8c9ef3f2c30ba84ed465a051544bf8813f35444d/_footer.scssc +0 -0
  137. data/spec/dummy/tmp/cache/sass/8c9ef3f2c30ba84ed465a051544bf8813f35444d/_main_structure.scssc +0 -0
  138. data/spec/dummy/tmp/cache/sass/8c9ef3f2c30ba84ed465a051544bf8813f35444d/_title_bar.scssc +0 -0
  139. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_animation.scssc +0 -0
  140. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_appearance.scssc +0 -0
  141. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_backface-visibility.scssc +0 -0
  142. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_background-image.scssc +0 -0
  143. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_background.scssc +0 -0
  144. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_border-image.scssc +0 -0
  145. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_border-radius.scssc +0 -0
  146. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_box-sizing.scssc +0 -0
  147. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_columns.scssc +0 -0
  148. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_flex-box.scssc +0 -0
  149. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_font-face.scssc +0 -0
  150. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_hidpi-media-query.scssc +0 -0
  151. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_image-rendering.scssc +0 -0
  152. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_inline-block.scssc +0 -0
  153. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_keyframes.scssc +0 -0
  154. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_linear-gradient.scssc +0 -0
  155. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_perspective.scssc +0 -0
  156. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_placeholder.scssc +0 -0
  157. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_radial-gradient.scssc +0 -0
  158. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_transform.scssc +0 -0
  159. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_transition.scssc +0 -0
  160. data/spec/dummy/tmp/cache/sass/99be3aae4664497e61da2511feebeb7d5faf1139/_user-select.scssc +0 -0
  161. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_deprecated-webkit-gradient.scssc +0 -0
  162. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_gradient-positions-parser.scssc +0 -0
  163. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_linear-positions-parser.scssc +0 -0
  164. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_radial-arg-parser.scssc +0 -0
  165. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_radial-positions-parser.scssc +0 -0
  166. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_render-gradients.scssc +0 -0
  167. data/spec/dummy/tmp/cache/sass/a1e1600793faa04b53e432bebf67bf72909214b5/_shape-size-stripper.scssc +0 -0
  168. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_button.scssc +0 -0
  169. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_clearfix.scssc +0 -0
  170. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_font-family.scssc +0 -0
  171. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_hide-text.scssc +0 -0
  172. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_html5-input-types.scssc +0 -0
  173. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_position.scssc +0 -0
  174. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_prefixer.scssc +0 -0
  175. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_retina-image.scssc +0 -0
  176. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_size.scssc +0 -0
  177. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_timing-functions.scssc +0 -0
  178. data/spec/dummy/tmp/cache/sass/a6f44f7e8dc2f75ba4a2b257f37eeda690933a5f/_triangle.scssc +0 -0
  179. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/_base.css.scssc +0 -0
  180. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/_forms.css.scssc +0 -0
  181. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/_header.css.scssc +0 -0
  182. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/_mixins.css.scssc +0 -0
  183. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/_typography.css.scssc +0 -0
  184. data/spec/dummy/tmp/cache/sass/c48301ebc9d8a1da2083df298428b60619d37c44/print.css.scssc +0 -0
  185. data/spec/dummy/tmp/cache/sass/f5b5749bdb16c7c8c955c12688c619c619fa8448/_dashboard.scssc +0 -0
  186. data/spec/dummy/tmp/cache/sass/f5b5749bdb16c7c8c955c12688c619c619fa8448/_logged_out.scssc +0 -0
  187. data/spec/models/activeadmin_selleo_cms/page_spec.rb +0 -4
  188. metadata +336 -2
@@ -0,0 +1,32 @@
1
+ class FormsController < ApplicationController
2
+ respond_to :html, :pdf
3
+
4
+ before_filter do
5
+ @form = ActiveadminSelleoCms::Form.find(params[:id])
6
+ end
7
+
8
+ def download
9
+ respond_to do |format|
10
+ format.pdf do
11
+ render :pdf => @form.title.parameterize
12
+ end
13
+ end
14
+ end
15
+
16
+ def deliver
17
+ respond_to do |format|
18
+ format.html do
19
+ pdf = WickedPdf.new.pdf_from_string(
20
+ render_to_string('download.pdf.erb')
21
+ )
22
+ pdf_path = File.join(ActiveadminSelleoCms::Form::PDF_PATH, "#{@form.title.parameterize}-#{Time.now.to_s.parameterize}.pdf")
23
+ File.open(pdf_path, 'wb') do |file|
24
+ file << pdf
25
+ end
26
+ ActiveadminSelleoCms::FormMailer.form_submission(pdf_path).deliver
27
+ flash[:notice] = "Your form has been sent. Thank you."
28
+ end
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,10 @@
1
+ module ActiveadminSelleoCms
2
+ class FormMailer < ActionMailer::Base
3
+ default from: "web-form@jips.org"
4
+
5
+ def form_submission(form_filename)
6
+ attachments[form_filename] = File.read(form_filename)
7
+ mail(to: 'aossowski@gmail.com', subject: "New form submission")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module ActiveadminSelleoCms
2
+ class Form < ActiveRecord::Base
3
+ PDF_PATH = Rails.root.join('public','system','pdf')
4
+
5
+ has_many :questions, class_name: "FormQuestion", :order => "position"
6
+
7
+ validates :title, presence: true
8
+
9
+ attr_protected :id
10
+ end
11
+ end
@@ -0,0 +1,75 @@
1
+ module ActiveadminSelleoCms
2
+ class FormQuestion < ActiveRecord::Base
3
+
4
+ TYPE_TEXT = 0
5
+ TYPE_SELECT = 1
6
+ TYPE_FILE = 2
7
+ TYPES = [TYPE_TEXT, TYPE_SELECT, TYPE_FILE]
8
+ TYPE_NAMES = ["text question", "select question", "file upload"]
9
+
10
+ belongs_to :form
11
+ has_many :options, class_name: "FormQuestionOption", :order => "position"
12
+
13
+ acts_as_list :scope => :form_id
14
+
15
+ attr_accessor :order
16
+ attr_accessible :title, :question_type, :position, :is_required, :is_multi, :has_other_option, :options_attributes, :order
17
+ accepts_nested_attributes_for :options, allow_destroy: true
18
+
19
+ validates :title, presence: true, uniqueness: {scope: :form_id}
20
+
21
+ class << self
22
+
23
+ def for_select
24
+ TYPES.map { |type| [question_type_dictionary(type), type] }
25
+ end
26
+
27
+ def question_type_dictionary(int)
28
+ ["text question", "select question", "file upload"][int]
29
+ end
30
+
31
+ end
32
+
33
+ def is_type?(type)
34
+ "ActiveadminSelleoCms::FormQuestion::TYPE_#{type.upcase}".constantize == question_type
35
+ end
36
+
37
+ def set_options_order
38
+ unless order.nil?
39
+ order.split(",").each_with_index do |temp_id, index|
40
+ options.each do |o|
41
+ o.update_attribute(:position, index+1) if temp_id == o.temp_id
42
+ end
43
+ end
44
+ order = nil
45
+ self.save
46
+ end
47
+ end
48
+
49
+ def input_type
50
+ if question_type == TYPE_TEXT and is_multi
51
+ :text_area_tag
52
+ elsif question_type == TYPE_TEXT
53
+ :text_field_tag
54
+ elsif question_type == TYPE_SELECT and is_multi
55
+ :check_box_tag
56
+ elsif question_type == TYPE_SELECT
57
+ :radio_button_tag
58
+ elsif question_type == TYPE_FILE
59
+ :file_field_tag
60
+ end
61
+ end
62
+
63
+ def collection
64
+ if question_type == TYPE_SELECT
65
+ {
66
+ collection: options.map{ |o| [o.title, o.id, o.options] }
67
+ }
68
+ else
69
+ {}
70
+ end
71
+ end
72
+
73
+ end
74
+
75
+ end
@@ -0,0 +1,22 @@
1
+ module ActiveadminSelleoCms
2
+ class FormQuestionOption < ActiveRecord::Base
3
+
4
+ belongs_to :question, class_name: "FormQuestion", foreign_key: :form_question_id
5
+
6
+ validates :title, presence: true, uniqueness: { scope: :form_question_id }
7
+
8
+ attr_accessor :temp_id
9
+ attr_accessible :title, :temp_id
10
+
11
+ def options
12
+ if question.question_type == FormQuestion::TYPE_SELECT and question.is_required
13
+ {
14
+ required: true
15
+ }
16
+ else
17
+ {}
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -52,11 +52,30 @@ module ActiveadminSelleoCms
52
52
  current_translation.related_items
53
53
  end
54
54
 
55
+ def render(editing=false)
56
+ doc = Nokogiri::HTML(body.to_s)
57
+
58
+ unless editing
59
+ av = ActionView::Base.new
60
+ av.instance_eval do
61
+ def protect_against_forgery?
62
+ false
63
+ end
64
+ end
65
+
66
+ doc.css('form[data-form-id]').each do |form|
67
+ form.replace av.render(:file => File.join(ActiveadminSelleoCms::Engine.root, 'app/views/forms/_form'), :layout => nil, :locals => { :form => Form.find(form.attributes["data-form-id"].to_s) })
68
+ end
69
+ end
70
+
71
+ doc.to_s.html_safe
72
+ end
73
+
55
74
  def to_s
56
75
  section_definition = sectionable.layout.find_section(name) if sectionable and sectionable.respond_to? :layout
57
76
  if section_definition
58
77
  if section_definition.text?
59
- body.to_s.html_safe
78
+ render_body
60
79
  elsif section_definition.image?
61
80
  image ? image.url : ""
62
81
  end
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
5
+ </head>
6
+ <body>
7
+ <h3>New form has been submitted.</h3>
8
+ <p>
9
+ Please see the attachmed file.
10
+ </p>
11
+ </body>
12
+ </html>
@@ -0,0 +1,45 @@
1
+ = semantic_nested_form_for [:admin, @form, @form_question], url: (@form_question.new_record? ? admin_form_form_questions_path(@form.id) : admin_form_form_question_path(@form.id, @form_question.id)), remote: true, html: {id: "form_question_form"} do |form|
2
+ = form.inputs "Options" do
3
+ = form.input :title
4
+ = form.input :is_required
5
+ - unless @form_question.is_type?('file')
6
+ = form.input :is_multi
7
+ = form.input :question_type, as: :hidden
8
+ - if @form_question.is_type?('select')
9
+ = form.input :has_other_option
10
+ = form.input :order, as: :hidden
11
+
12
+ - if @form_question.is_type?('select')
13
+ = form.inputs "Add options" do
14
+ %div#options
15
+ = form.fields_for :options do |ff|
16
+ %div.sortable-option
17
+ %ol
18
+ = ff.input :temp_id, as: :hidden, value: ff.object.id ? ff.object.id : "empty"
19
+ = ff.input :title
20
+ = ff.link_to_remove "Remove"
21
+
22
+ = form.link_to_add "Add an option", :options, data: { target: "#options" }
23
+
24
+ = form.actions do
25
+ %li.action.input_action
26
+ = link_to_function "Submit", "submit_form_question_form()"
27
+ %li.cancel
28
+ = link_to_function "Cancel", "$('#question_container').dialog('close');$('ol.form_questions_container li.draggable_question_type.form_question').remove();"
29
+
30
+ :javascript
31
+
32
+ $(document).on('nested:fieldAdded', function(event){
33
+ event.field.find('input[type="hidden"][value="empty"]').val(new Date().getTime())
34
+ })
35
+
36
+ function submit_form_question_form(){
37
+ $('#form_question_order').val($.map($('input[type="hidden"][id$="temp_id"]'), function(obj){return $(obj).val()}))
38
+ $('#form_question_form').submit();
39
+ }
40
+
41
+ $(function(){
42
+ $("#options").sortable({
43
+ items: ".sortable-option"
44
+ }).disableSelection();
45
+ });
@@ -0,0 +1,7 @@
1
+ <% if @form_question.save %>
2
+ $('#question_container').dialog('close');
3
+ $('ol.form_questions_container li.draggable_question_type.form_question').replaceWith("<%= escape_javascript(render(partial: "admin/forms/question", locals: { question: @form_question})) %>");
4
+ <% @form_question.set_options_order %>
5
+ <% else %>
6
+ $('#question_container').html('<%= escape_javascript(render(partial: 'form')) %>');
7
+ <% end %>
@@ -0,0 +1,2 @@
1
+ $('ol.form_questions_container li[data-id="<%= @form_question.id %>"]').remove();
2
+ <% @form_question.destroy %>
@@ -0,0 +1,7 @@
1
+ <% if @form_question.save %>
2
+ $('#question_container').dialog('close');
3
+ $('ol.form_questions_container li[data-id="<%= @form_question.id %>"]').replaceWith("<%= escape_javascript(render(partial: "admin/forms/question", locals: { question: @form_question})) %>");
4
+ <% @form_question.set_options_order %>
5
+ <% else %>
6
+ $('#question_container').html('<%= escape_javascript(render(partial: 'form')) %>');
7
+ <% end %>
@@ -0,0 +1,50 @@
1
+ = semantic_form_for [:admin, @form], url: admin_form_path(@form) do |form|
2
+ = form.inputs "General options" do
3
+ = form.input :title
4
+
5
+ %ol.draggable_questions_container
6
+ - ActiveadminSelleoCms::FormQuestion::TYPES.each do |qtype|
7
+ = render partial: "question_type", locals: { qtype: qtype }
8
+
9
+ %ol.form_questions_container.sortable
10
+ = render partial: "questions", locals: { questions: @form.questions }
11
+
12
+ = form.actions class: "actions clear" do
13
+ = form.action :submit
14
+ %li.cancel
15
+ = link_to I18n.t('active_admin.cancel'), admin_forms_path
16
+
17
+ #question_container
18
+
19
+ :javascript
20
+ $(function(){
21
+ $("ol.form_questions_container").sortable({
22
+ update: function(event, ui) {
23
+ sort();
24
+ },
25
+
26
+ receive:function (event, ui) {
27
+ $('#question_container').load("#{new_admin_form_form_question_url(@form)}?question_type="+$(ui.helper).attr("data-qtype")).dialog({modal:true, closeOnEscape: false});
28
+ }
29
+ }).disableSelection();
30
+
31
+ $("li.draggable_question_type").draggable({
32
+ connectToSortable:"ol.form_questions_container",
33
+ helper:"clone",
34
+ revert:"invalid",
35
+ opacity:.8
36
+ });
37
+ });
38
+
39
+ function sort(){
40
+ $.ajax({url: "#{sort_admin_form_form_questions_url(@form)}?ids="+$.map($('ol.form_questions_container li'),function(obj){return $(obj).attr('data-id')})});
41
+ }
42
+
43
+ function removeQuestion(id){
44
+ if(confirm("Are you sure?"))
45
+ $.ajax({url: "/admin/forms/#{@form.id}/form_questions/" + id, type: "DELETE"});
46
+ }
47
+
48
+ function editQuestion(id){
49
+ $('#question_container').load("/admin/forms/#{@form.id}/form_questions/" + id + "/edit").dialog({modal:true, closeOnEscape: false});
50
+ }
@@ -0,0 +1,8 @@
1
+ %li{:class => "draggable_question form_question", "data-id" => question.id, "data-qtype" => question.question_type}
2
+ .labels.bt.bt_grey.bt_icon
3
+ %span
4
+ = image_tag("admin/question_#{question.question_type}.png")
5
+ = truncate(question.title, :length => 120)
6
+ .bt_group.cf
7
+ = link_to_function image_tag("admin/edit.png"), "editQuestion(#{question.id})", :title => "Edit question"
8
+ = link_to_function image_tag("admin/remove.png"), "removeQuestion(#{question.id})", :title => "Remove question"
@@ -0,0 +1,6 @@
1
+ %li.draggable_question_type.form_question{"data-id" => "null", "data-qtype" => qtype}
2
+ .bt.bt_grey.bt_icon
3
+ %span/
4
+ %p
5
+ = image_tag("admin/question_#{qtype}.png")
6
+ = ActiveadminSelleoCms::FormQuestion.question_type_dictionary(qtype)
@@ -0,0 +1,2 @@
1
+ - questions.each do |question|
2
+ = render partial: "question", locals: { question: question }
@@ -8,7 +8,7 @@
8
8
  - @section_forms = []
9
9
  -#= @page.errors.full_messages
10
10
 
11
- = form.inputs general_options(@page), id: 'id-general-options' do
11
+ = form.inputs "General options", id: 'id-general-options' do
12
12
  - unless @inline
13
13
  = form.input :layout_name, collection: ActiveadminSelleoCms::Layout.all.sort, include_blank: false, hint: "The form will reload on change"
14
14
  = form.input :parent_id, as: :select, collection: nested_set_options(ActiveadminSelleoCms::Page, @page) {|i| "#{'-' * i.level} #{i.title}" }
@@ -49,7 +49,10 @@
49
49
  = form.actions do
50
50
  = form.action :submit
51
51
  %li.cancel
52
- = link_to I18n.t('active_admin.cancel'), admin_pages_path
52
+ - if @inline
53
+ = link_to_function I18n.t('active_admin.cancel'), "$('#file-manager').dialog('close');"
54
+ - else
55
+ = link_to I18n.t('active_admin.cancel'), admin_pages_path
53
56
 
54
57
  %div#file-manager
55
58
 
@@ -28,25 +28,25 @@
28
28
  - unless @page.new_record?
29
29
  - if section.attachments?
30
30
  %li.input
31
- %ol{ :style => "padding-left: 275px;" }
31
+ %ol
32
32
  %li= button_to_function t("active_admin.cms.manage_attachments"), "fileManager('#{edit_admin_section_translation_path(section_form_translated.object.id)}')", style: "padding: 5px;"
33
33
 
34
34
  - if section.image?
35
35
  %li.input
36
36
  %label Image
37
- %ol{ :style => "padding-left: 275px;" }
37
+ %ol
38
38
  %li= button_to_function t("active_admin.cms.file_manager.edit_image"), "fileManager('#{section_form_translated.object.image ? edit_admin_image_path(section_form_translated.object.image.id) : new_admin_image_path(image: { assetable_type: section_form_translated.object.class.name, assetable_id: section_form_translated.object.id })}')", style: "padding: 5px;"
39
39
 
40
40
  - if section.images?
41
41
  %li.input
42
42
  %label Attachments
43
- %ol{ :style => "padding-left: 275px;" }
43
+ %ol
44
44
  %li= button_to_function t("active_admin.cms.manage_images"), "fileManager('#{edit_admin_section_translation_path(section_form_translated.object.id)}')", style: "padding: 5px;"
45
45
 
46
46
  - if section.attachment?
47
47
  %li.input
48
48
  %label Attachment
49
- %ol{ :style => "padding-left: 275px;" }
49
+ %ol
50
50
  %li= button_to_function t("active_admin.cms.file_manager.edit_attachment"), "fileManager('#{section_form_translated.object.attachment ? edit_admin_attachment_path(section_form_translated.object.attachment.id): new_admin_attachment_path(image: { assetable_type: section_form_translated.object.class.name, assetable_id: section_form_translated.object.id }) }')", style: "padding: 5px;"
51
51
 
52
52
  - if section.related?
@@ -1 +1 @@
1
- alert('<%= params[:page] %>');
1
+ $('form#edit_page_<%= @page.id%>').effect('highlight');
@@ -20,6 +20,8 @@
20
20
  - elsif resource.activeadmin_selleo_cms_section.related?
21
21
  = render partial: '/admin/related_items/related_item', collection: resource.related_items
22
22
 
23
+ = link_to_function I18n.t('active_admincms..close'), "$('#file-manager').dialog('close');"
24
+
23
25
  :javascript
24
26
  $('ol#assets').sortable({
25
27
  stop: function(event, ui) {
@@ -0,0 +1,29 @@
1
+ <%= form_tag '/forms', multipart: true, id: dom_id(form) do %>
2
+ <% form.questions.each do |question| %>
3
+ <%= label_tag dom_id(question), question.title %>
4
+ <% if [:check_box_tag].include? question.input_type %>
5
+ <% question.options.each do |option| %>
6
+ <%= send(question.input_type, "#{dom_id(question)}[]", option.id, false, required: question.is_required, id: dom_id(option)) %>
7
+ <%= label_tag dom_id(option), option.title %>
8
+ <% end %>
9
+ <% elsif [:radio_button_tag].include? question.input_type %>
10
+ <% question.options.each do |option| %>
11
+ <%= send(question.input_type, dom_id(question), option.id, false, required: question.is_required, id: dom_id(option)) %>
12
+ <%= label_tag dom_id(option), option.title %>
13
+ <% end %>
14
+ <% else %>
15
+ <%= send(question.input_type, dom_id(question), "", required: question.is_required) %>
16
+ <% end %>
17
+ <%= text_field_tag "#{dom_id(question)}_other" if question.has_other_option %>
18
+ <% end %>
19
+ <% end %>
20
+
21
+ <%= button_to_function "Print", "$('##{dom_id(form)}').printElement({printMode:'popup'});" %>
22
+ <%= button_to_function "Download", "$('##{dom_id(form)}').attr('action', '/forms/#{form.id}/download.pdf').submit();" %>
23
+ <%= button_to_function "Send to JIPS", "$('##{dom_id(form)}').attr('action', '/forms/#{form.id}/deliver').submit();" %>
24
+
25
+ <script>
26
+ $(function(){
27
+ setupCmsForm('<%= dom_id(form) %>');
28
+ });
29
+ </script>