lcms-engine 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +25 -0
  3. data/.eslintignore +2 -1
  4. data/.eslintrc +23 -73
  5. data/.nvmrc +1 -1
  6. data/.overcommit.yml +8 -2
  7. data/.prettierrc +7 -0
  8. data/.rubocop.yml +5 -2
  9. data/.ruby-version +1 -1
  10. data/.stylelintignore +9 -0
  11. data/.stylelintrc +8 -0
  12. data/CHANGELOG.md +36 -2
  13. data/Dockerfile +3 -3
  14. data/Gemfile.lock +344 -297
  15. data/README.md +20 -18
  16. data/app/assets/config/lcms_engine_manifest.js +4 -2
  17. data/app/assets/javascripts/lcms/engine/admin/{application.js → lcms_engine_application.js} +1 -3
  18. data/app/assets/javascripts/lcms/engine/initializers/foundation.js +1 -1
  19. data/app/assets/javascripts/lcms/engine/{application.js → lcms_engine_application.js} +0 -0
  20. data/app/assets/stylesheets/lcms/engine/admin/collections.scss +2 -1
  21. data/app/assets/stylesheets/lcms/engine/admin/components.scss +60 -19
  22. data/app/assets/stylesheets/lcms/engine/admin/curriculums.scss +12 -10
  23. data/app/assets/stylesheets/lcms/engine/admin/lessons.scss +21 -15
  24. data/app/assets/stylesheets/lcms/engine/admin/materials.scss +25 -17
  25. data/app/assets/stylesheets/lcms/engine/admin/resources.scss +8 -7
  26. data/app/assets/stylesheets/lcms/engine/admin/standards.scss +4 -1
  27. data/app/assets/stylesheets/lcms/engine/admin/users.scss +1 -1
  28. data/app/assets/stylesheets/lcms/engine/base/_colors.scss +8 -10
  29. data/app/assets/stylesheets/lcms/engine/base/_ld-colors.scss +10 -10
  30. data/app/assets/stylesheets/lcms/engine/components/_assoc-picker.scss +4 -5
  31. data/app/assets/stylesheets/lcms/engine/components/lesson/_activity.scss +6 -2
  32. data/app/assets/stylesheets/lcms/engine/components/lesson/_callout.scss +19 -5
  33. data/app/assets/stylesheets/lcms/engine/components/lesson/_columns.scss +4 -3
  34. data/app/assets/stylesheets/lcms/engine/components/lesson/_curriculum-map.scss +16 -7
  35. data/app/assets/stylesheets/lcms/engine/components/lesson/_def.scss +2 -2
  36. data/app/assets/stylesheets/lcms/engine/components/lesson/_expand.scss +9 -9
  37. data/app/assets/stylesheets/lcms/engine/components/lesson/_foundational-divider.scss +0 -1
  38. data/app/assets/stylesheets/lcms/engine/components/lesson/_group.scss +3 -1
  39. data/app/assets/stylesheets/lcms/engine/components/lesson/_icons.scss +1 -1
  40. data/app/assets/stylesheets/lcms/engine/components/lesson/_image-wrap.scss +2 -2
  41. data/app/assets/stylesheets/lcms/engine/components/lesson/_inset.scss +7 -2
  42. data/app/assets/stylesheets/lcms/engine/components/lesson/_materials.scss +1 -1
  43. data/app/assets/stylesheets/lcms/engine/components/lesson/_multiple-choice.scss +4 -1
  44. data/app/assets/stylesheets/lcms/engine/components/lesson/_override.scss +28 -9
  45. data/app/assets/stylesheets/lcms/engine/components/lesson/_pd.scss +7 -7
  46. data/app/assets/stylesheets/lcms/engine/components/lesson/_pv.scss +5 -4
  47. data/app/assets/stylesheets/lcms/engine/components/lesson/_section.scss +10 -3
  48. data/app/assets/stylesheets/lcms/engine/components/lesson/_selection-control.scss +14 -8
  49. data/app/assets/stylesheets/lcms/engine/components/lesson/_sidebar.scss +25 -10
  50. data/app/assets/stylesheets/lcms/engine/components/lesson/_title.scss +3 -1
  51. data/app/assets/stylesheets/lcms/engine/components/lesson/_unit-map.scss +1 -1
  52. data/app/assets/stylesheets/lcms/engine/components/material/_material.scss +3 -3
  53. data/app/assets/stylesheets/lcms/engine/components/material/_overlay.scss +12 -4
  54. data/app/assets/stylesheets/lcms/engine/components/material/_preview.scss +1 -1
  55. data/app/assets/stylesheets/lcms/engine/components/support/_survey.scss +3 -1
  56. data/app/assets/stylesheets/lcms/engine/layout/_footer.scss +29 -11
  57. data/app/assets/stylesheets/lcms/engine/layout/_header.scss +5 -5
  58. data/app/assets/stylesheets/lcms/engine/layout/_navigation.scss +4 -6
  59. data/app/assets/stylesheets/lcms/engine/layout/_page.scss +2 -2
  60. data/app/assets/stylesheets/lcms/engine/{admin.scss → lcms_engine_admin.scss} +26 -15
  61. data/app/assets/stylesheets/lcms/engine/lcms_engine_application.scss +9 -0
  62. data/app/assets/stylesheets/lcms/engine/pdf.scss +5 -26
  63. data/app/assets/stylesheets/lcms/engine/pdf_plain.scss +5 -23
  64. data/app/assets/stylesheets/lcms/engine/print/_base.scss +41 -12
  65. data/app/assets/stylesheets/lcms/engine/print/_cover.scss +12 -12
  66. data/app/assets/stylesheets/lcms/engine/print/_footer.scss +8 -3
  67. data/app/assets/stylesheets/lcms/engine/print/_gdoc-base.scss +10 -37
  68. data/app/assets/stylesheets/lcms/engine/print/_helpers.scss +5 -2
  69. data/app/assets/stylesheets/lcms/engine/print/_lesson-base.scss +2 -14
  70. data/app/assets/stylesheets/lcms/engine/print/_material-base.scss +1 -3
  71. data/app/assets/stylesheets/lcms/engine/print/_print.scss +15 -8
  72. data/app/assets/stylesheets/lcms/engine/print/_toc.scss +24 -9
  73. data/app/assets/stylesheets/lcms/engine/print/gdoc/_base-typography.scss +24 -6
  74. data/app/assets/stylesheets/lcms/engine/print/gdoc/_base.scss +10 -3
  75. data/app/assets/stylesheets/lcms/engine/print/gdoc/_colors.scss +3 -3
  76. data/app/assets/stylesheets/lcms/engine/print/gdoc/_header.scss +2 -2
  77. data/app/assets/stylesheets/lcms/engine/print/gdoc/_helpers.scss +1 -0
  78. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_activity.scss +1 -1
  79. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_agenda.scss +8 -2
  80. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_callout.scss +16 -6
  81. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_def.scss +1 -1
  82. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_dialogue.scss +3 -1
  83. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_expand.scss +5 -2
  84. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_image-wrap.scss +5 -3
  85. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_image.scss +1 -1
  86. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_optbreak.scss +1 -0
  87. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_section.scss +4 -1
  88. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_smp.scss +1 -0
  89. data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_tables.scss +11 -3
  90. data/app/assets/stylesheets/lcms/engine/print/gdoc/material/_header.scss +5 -2
  91. data/app/assets/stylesheets/lcms/engine/print/lesson/_base-typography.scss +33 -9
  92. data/app/assets/stylesheets/lcms/engine/print/lesson/_group.scss +3 -1
  93. data/app/assets/stylesheets/lcms/engine/print/lesson/_image.scss +3 -1
  94. data/app/assets/stylesheets/lcms/engine/print/lesson/_materials.scss +1 -1
  95. data/app/assets/stylesheets/lcms/engine/print/lesson/_pd.scss +8 -4
  96. data/app/assets/stylesheets/lcms/engine/print/lesson/_section.scss +1 -1
  97. data/app/assets/stylesheets/lcms/engine/print/material/_header.scss +4 -1
  98. data/app/assets/stylesheets/lcms/engine/themes/_material.scss +11 -11
  99. data/app/assets/stylesheets/lcms/engine/utils/_colorcodes.scss +15 -5
  100. data/app/assets/stylesheets/lcms/engine/utils/_functions.scss +1 -1
  101. data/app/assets/stylesheets/lcms/engine/utils/_helpers.scss +23 -11
  102. data/app/assets/stylesheets/lcms/engine/utils/_placeholders.scss +1 -1
  103. data/app/assets/stylesheets/lcms/engine/utils/_variables.scss +11 -11
  104. data/app/assets/stylesheets/lcms/engine/vendors/{mathjax.css → mathjax.scss} +0 -0
  105. data/app/assets/stylesheets/lcms/engine/vendors/react-tagsinput.css +48 -0
  106. data/app/controllers/concerns/lcms/engine/reimportable.rb +1 -1
  107. data/app/controllers/lcms/engine/admin/access_codes_controller.rb +8 -3
  108. data/app/controllers/lcms/engine/admin/admin_controller.rb +5 -39
  109. data/app/controllers/lcms/engine/admin/association_picker_controller.rb +4 -1
  110. data/app/controllers/lcms/engine/admin/batch_reimports_controller.rb +2 -2
  111. data/app/controllers/lcms/engine/admin/curriculums_controller.rb +21 -2
  112. data/app/controllers/lcms/engine/admin/documents_controller.rb +26 -14
  113. data/app/controllers/lcms/engine/admin/materials_controller.rb +23 -13
  114. data/app/controllers/lcms/engine/admin/resource_bulk_edits_controller.rb +2 -2
  115. data/app/controllers/lcms/engine/admin/resources_controller.rb +9 -7
  116. data/app/controllers/lcms/engine/admin/settings_controller.rb +1 -1
  117. data/app/controllers/lcms/engine/admin/standards_controller.rb +2 -2
  118. data/app/controllers/lcms/engine/admin/users_controller.rb +10 -7
  119. data/app/controllers/lcms/engine/application_controller.rb +1 -1
  120. data/app/controllers/lcms/engine/resources_controller.rb +5 -5
  121. data/app/controllers/lcms/engine/welcome_controller.rb +11 -0
  122. data/app/entities/lcms/engine/hierarchical_position.rb +1 -2
  123. data/app/entities/lcms/engine/media_embed.rb +1 -1
  124. data/app/entities/lcms/engine/pagination.rb +14 -10
  125. data/app/entities/lcms/engine/roman_numerals.rb +1 -1
  126. data/app/exceptions/lcms/engine/document_error.rb +8 -0
  127. data/app/exceptions/lcms/engine/material_error.rb +8 -0
  128. data/app/helpers/admin/components_helper.rb +1 -1
  129. data/app/helpers/lcms/engine/path_helper.rb +32 -0
  130. data/app/helpers/lcms/engine/resource_helper.rb +1 -1
  131. data/app/helpers/lcms/engine/view_helper.rb +0 -8
  132. data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +1 -1
  133. data/app/javascript/components/admin/ImportStatus.jsx +88 -58
  134. data/app/javascript/components/admin/Initializer.jsx +33 -35
  135. data/app/javascript/components/admin/MultiSelectedOperation.jsx +43 -19
  136. data/app/javascript/components/admin/association-picker/AssociationPicker.jsx +68 -48
  137. data/app/javascript/components/admin/association-picker/AssociationPickerItem.jsx +18 -7
  138. data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +42 -18
  139. data/app/javascript/components/admin/association-picker/AssociationPickerWindow.jsx +47 -28
  140. data/app/javascript/components/admin/curriculum/CurriculumEditor.jsx +54 -33
  141. data/app/javascript/components/admin/curriculum/DirectoryPicker.jsx +80 -53
  142. data/app/javascript/components/admin/picker/PickerButton.jsx +16 -11
  143. data/app/javascript/components/admin/picker/pickerModal.jsx +6 -6
  144. data/app/javascript/components/admin/picker/pickerWindowWrapper.jsx +61 -40
  145. data/app/javascript/components/admin/resource-picker/ResourcePicker.jsx +54 -40
  146. data/app/javascript/components/admin/resource-picker/ResourcePickerResource.jsx +14 -3
  147. data/app/javascript/components/admin/resource-picker/ResourcePickerWindow.jsx +50 -21
  148. data/app/javascript/components/paginate/PageView.jsx +20 -8
  149. data/app/javascript/components/paginate/PaginationBoxView.jsx +78 -66
  150. data/app/javascript/components/paginate/PaginationListView.jsx +59 -45
  151. data/app/javascript/packs/lcms_engine_admin.js +15 -0
  152. data/app/javascript/packs/{application.js → lcms_engine_application.js} +5 -4
  153. data/app/javascript/packs/server_rendering.js +1 -0
  154. data/app/javascript/vendor/jstree/jstree.min.js +6 -0
  155. data/app/javascript/vendor/jstree/themes/default/32px.png +0 -0
  156. data/app/javascript/vendor/jstree/themes/default/40px.png +0 -0
  157. data/app/javascript/vendor/jstree/themes/default/style.css +1106 -0
  158. data/app/javascript/vendor/jstree/themes/default/style.min.css +1 -0
  159. data/app/javascript/vendor/jstree/themes/default/throbber.gif +0 -0
  160. data/app/javascript/vendor/jstree/themes/default-dark/32px.png +0 -0
  161. data/app/javascript/vendor/jstree/themes/default-dark/40px.png +0 -0
  162. data/app/javascript/vendor/jstree/themes/default-dark/style.css +1150 -0
  163. data/app/javascript/vendor/jstree/themes/default-dark/style.min.css +1 -0
  164. data/app/javascript/vendor/jstree/themes/default-dark/throbber.gif +0 -0
  165. data/app/jobs/lcms/engine/document_generate_job.rb +1 -1
  166. data/app/jobs/lcms/engine/document_generate_pdf_job.rb +5 -5
  167. data/app/jobs/lcms/engine/material_generate_pdf_job.rb +4 -4
  168. data/app/models/concerns/lcms/engine/navigable.rb +6 -10
  169. data/app/models/concerns/lcms/engine/searchable.rb +7 -0
  170. data/app/models/lcms/engine/document.rb +1 -1
  171. data/app/models/lcms/engine/resource.rb +1 -1
  172. data/app/models/lcms/engine/search/repository.rb +1 -1
  173. data/app/presenters/lcms/engine/content_presenter.rb +1 -1
  174. data/app/presenters/lcms/engine/curriculum_presenter.rb +21 -18
  175. data/app/presenters/lcms/engine/document_presenter.rb +3 -1
  176. data/app/presenters/lcms/engine/resource_presenter.rb +6 -3
  177. data/app/queries/lcms/engine/admin_documents_query.rb +1 -1
  178. data/app/queries/lcms/engine/admin_materials_query.rb +11 -2
  179. data/app/queries/lcms/engine/base_query.rb +1 -1
  180. data/app/services/lcms/engine/document_build_service.rb +2 -0
  181. data/app/services/lcms/engine/document_generator.rb +2 -2
  182. data/app/services/lcms/engine/google/drive_service.rb +7 -15
  183. data/app/services/lcms/engine/google/script_service.rb +7 -3
  184. data/app/services/lcms/engine/html_sanitizer.rb +1 -1
  185. data/app/services/lcms/engine/lti_exporter.rb +1 -1
  186. data/app/services/lcms/engine/material_preview_generator.rb +1 -1
  187. data/app/services/lcms/engine/s3_service.rb +14 -2
  188. data/app/tasks/resource_tasks.rb +2 -2
  189. data/app/views/layouts/lcms/engine/admin.html.erb +3 -3
  190. data/app/views/layouts/lcms/engine/application.html.erb +2 -2
  191. data/app/views/layouts/lcms/engine/lti.html.erb +1 -1
  192. data/app/views/lcms/engine/admin/access_codes/_form.html.erb +1 -1
  193. data/app/views/lcms/engine/admin/access_codes/index.html.erb +3 -3
  194. data/app/views/lcms/engine/admin/batch_reimports/_search_form.html.erb +1 -1
  195. data/app/views/lcms/engine/admin/curriculums/edit.html.erb +4 -2
  196. data/app/views/lcms/engine/admin/documents/_reimport.html.erb +1 -1
  197. data/app/views/lcms/engine/admin/documents/_search_form.html.erb +1 -1
  198. data/app/views/lcms/engine/admin/documents/import.html.erb +1 -1
  199. data/app/views/lcms/engine/admin/documents/index.html.erb +5 -3
  200. data/app/views/lcms/engine/admin/documents/new.html.erb +6 -2
  201. data/app/views/lcms/engine/admin/materials/_reimport.html.erb +1 -1
  202. data/app/views/lcms/engine/admin/materials/_search_form.html.erb +1 -1
  203. data/app/views/lcms/engine/admin/materials/import.html.erb +1 -1
  204. data/app/views/lcms/engine/admin/materials/index.html.erb +22 -18
  205. data/app/views/lcms/engine/admin/materials/new.html.erb +5 -1
  206. data/app/views/lcms/engine/admin/resource_bulk_edits/new.html.erb +1 -1
  207. data/app/views/lcms/engine/admin/resources/_fields.html.erb +4 -3
  208. data/app/views/lcms/engine/admin/resources/_form.html.erb +1 -1
  209. data/app/views/lcms/engine/admin/resources/_search_form.html.erb +1 -1
  210. data/app/views/lcms/engine/admin/resources/index.html.erb +7 -5
  211. data/app/views/lcms/engine/admin/shared/_header.html.erb +12 -12
  212. data/app/views/lcms/engine/admin/standards/_form.html.erb +3 -1
  213. data/app/views/lcms/engine/admin/standards/_search_form.html.erb +1 -1
  214. data/app/views/lcms/engine/admin/users/_form.html.erb +1 -1
  215. data/app/views/lcms/engine/admin/users/_search_form.html.erb +1 -1
  216. data/app/views/lcms/engine/admin/users/index.html.erb +6 -6
  217. data/app/views/lcms/engine/pages/not_found.html.erb +5 -0
  218. data/app/views/lcms/engine/resources/generic.html.erb +0 -4
  219. data/app/views/lcms/engine/resources/media.html.erb +0 -4
  220. data/app/views/lcms/engine/resources/show.html.erb +0 -2
  221. data/config/initializers/airbrake.rb +62 -10
  222. data/config/initializers/bitly.rb +1 -1
  223. data/config/initializers/carrier_wave.rb +6 -4
  224. data/config/initializers/ckeditor.rb +6 -0
  225. data/config/initializers/elasticsearch.rb +1 -1
  226. data/config/initializers/resque.rb +2 -2
  227. data/config/locales/admin/en.yml +0 -1
  228. data/config/locales/ui/en.yml +1 -0
  229. data/config/routes.rb +5 -2
  230. data/db/migrate/.keep +0 -0
  231. data/db/schema.rb +279 -311
  232. data/db/seeds.rb +0 -1
  233. data/docker-compose.ror4.yml +32 -0
  234. data/docker-compose.yml +6 -3
  235. data/docs/env-variables.md +40 -40
  236. data/docs/google-cloud-platform-setup.md +45 -17
  237. data/docs/how-to-build-and-publish.md +1 -0
  238. data/lcms-engine.gemspec +21 -15
  239. data/lib/doc_template/document.rb +3 -4
  240. data/lib/doc_template/document_toc.rb +2 -2
  241. data/lib/doc_template/objects/activity_metadata.rb +1 -1
  242. data/lib/doc_template/objects/toc_helpers.rb +4 -4
  243. data/lib/doc_template/objects/toc_metadata.rb +4 -6
  244. data/lib/doc_template/tags/answer_space_tag.rb +1 -1
  245. data/lib/doc_template/tags/base_tag.rb +2 -2
  246. data/lib/doc_template/tags/block_tag.rb +1 -1
  247. data/lib/doc_template/tags/table_tag.rb +1 -1
  248. data/lib/doc_template/template.rb +1 -1
  249. data/lib/doc_template.rb +9 -9
  250. data/lib/document_exporter/gdoc/base.rb +5 -2
  251. data/lib/document_exporter/pdf/base.rb +1 -1
  252. data/lib/document_exporter/pdf/document.rb +2 -2
  253. data/lib/document_exporter/pdf/material.rb +2 -2
  254. data/lib/document_exporter/pdf/student_material.rb +2 -2
  255. data/lib/document_exporter/pdf/teacher_material.rb +2 -2
  256. data/lib/document_renderer/part.rb +1 -3
  257. data/lib/lcms/engine/engine.rb +10 -9
  258. data/lib/lcms/engine/version.rb +1 -1
  259. data/lib/lcms/engine.rb +0 -1
  260. data/lib/lt/lcms/metadata/context.rb +56 -52
  261. data/lib/lt/lcms/metadata/service.rb +3 -2
  262. data/lib/tasks/cloud66.rake +2 -2
  263. data/lib/tasks/document.rake +4 -4
  264. data/lib/tasks/google.rake +29 -14
  265. data/lib/tasks/lcms/engine_tasks.rake +1 -1
  266. data/package.json +31 -10
  267. data/postcss.config.js +12 -0
  268. data/spec/controllers/admin/curriculums_controller_spec.rb +23 -0
  269. data/spec/controllers/admin/documents_controller_spec.rb +22 -2
  270. data/spec/controllers/admin/materials_controller_spec.rb +16 -3
  271. data/spec/controllers/admin/resource_bulk_edit_controller_spec.rb +1 -1
  272. data/spec/controllers/admin/resources_controller_spec.rb +1 -1
  273. data/spec/controllers/admin/settings_controller_spec.rb +1 -1
  274. data/spec/controllers/admin/standards_controller_spec.rb +1 -1
  275. data/spec/controllers/admin/welcome_controller_spec.rb +12 -10
  276. data/spec/controllers/resources_controller_spec.rb +3 -3
  277. data/spec/controllers/welcome_controller_spec.rb +38 -0
  278. data/spec/dummy/.traceroute.yaml +0 -2
  279. data/spec/dummy/bin/webpack +18 -0
  280. data/spec/dummy/bin/webpack-dev-server +18 -0
  281. data/spec/dummy/config/application.rb +1 -1
  282. data/spec/dummy/config/environments/test.rb +1 -1
  283. data/spec/dummy/config/initializers/assets.rb +6 -0
  284. data/spec/dummy/config/lcms-admin.yml +3 -7
  285. data/spec/dummy/config/routes.rb +6 -0
  286. data/spec/dummy/db/schema.rb +5 -5
  287. data/spec/factories/documents.rb +1 -0
  288. data/spec/factories/downloads.rb +1 -1
  289. data/spec/factories/resources.rb +2 -2
  290. data/spec/features/admin/materials/add_material_spec.rb +2 -0
  291. data/spec/features/admin/users_spec.rb +2 -2
  292. data/spec/{controllers/admin/admin_controller_spec.rb → helpers/path_helper_spec.rb} +6 -6
  293. data/spec/lib/doc_template/objects/activity_metadata_spec.rb +1 -1
  294. data/spec/lib/doc_template/objects/agenda_metadata_spec.rb +2 -0
  295. data/spec/lib/doc_template/objects/toc_metadata_spec.rb +1 -1
  296. data/spec/lib/doc_template/tags/page_break_tag_spec.rb +1 -1
  297. data/spec/lib/doc_template/tags/pd_tag_spec.rb +1 -1
  298. data/spec/models/document_spec.rb +1 -1
  299. data/spec/models/standard_spec.rb +2 -0
  300. data/spec/queries/lcms/engine/admin_materials_query_spec.rb +34 -0
  301. data/spec/rails_helper.rb +6 -17
  302. data/spec/services/document_build_service_spec.rb +4 -11
  303. data/spec/services/s3_service_spec.rb +31 -0
  304. data/spec/support/concerns/navigable.rb +2 -0
  305. data/spec/support/routes.rb +4 -0
  306. data/spec/support/shared_examples/content_tag.rb +4 -4
  307. data/templates/routes.rb +0 -1
  308. data/yarn.lock +3412 -2933
  309. metadata +146 -288
  310. data/app/assets/stylesheets/lcms/engine/application.scss +0 -36
  311. data/app/assets/stylesheets/lcms/engine/vendors/jquery.tagsinput.css +0 -1
  312. data/app/exceptions/components_api_error.rb +0 -4
  313. data/app/exceptions/document_error.rb +0 -4
  314. data/app/exceptions/material_error.rb +0 -4
  315. data/app/javascript/packs/admin.js +0 -14
  316. data/app/models/lcms/engine/component.rb +0 -88
  317. data/app/presenters/lcms/engine/social_media_presenter.rb +0 -83
  318. data/app/views/lcms/engine/shared/_social_sharing.html.erb +0 -22
  319. data/db/migrate/20200217160930_change_document_parts_to_polymorphic.rb +0 -36
  320. data/db/migrate/20200218144849_drop_material_parts_table.rb +0 -7
  321. data/db/migrate/20200422130652_add_reimported_at_to_documents.rb +0 -7
  322. data/db/migrate/20200429130353_drop_pages.rb +0 -13
  323. data/db/seeds/pages.seeds.rb +0 -26
  324. data/lib/document_exporter.rb +0 -6
  325. data/lib/lcms/engine/migration.rb +0 -16
  326. data/spec/models/component_spec.rb +0 -60
  327. data/vendor/assets/javascripts/jquery.tagsinput.js +0 -1
@@ -5,17 +5,19 @@ require 'rails_helper'
5
5
  describe Lcms::Engine::Admin::WelcomeController do
6
6
  let(:user) { create :admin }
7
7
 
8
- describe 'requires admin user' do
9
- before { get :index }
10
- it { expect(response).to redirect_to new_user_session_path }
11
- end
12
-
13
- describe 'allow admin' do
14
- before do
15
- sign_in user
16
- get :index
8
+ describe 'GET index' do
9
+ context 'requires admin user' do
10
+ before { get :index }
11
+ it { expect(response).to redirect_to lcms_engine(new_user_session_path) }
17
12
  end
18
13
 
19
- it { expect(response).to be_successful }
14
+ context 'allow admin' do
15
+ before do
16
+ sign_in user
17
+ get :index
18
+ end
19
+
20
+ it { expect(response).to be_successful }
21
+ end
20
22
  end
21
23
  end
@@ -49,19 +49,19 @@ xdescribe Lcms::Engine::ResourcesController do
49
49
  context 'with id' do
50
50
  before { get :show, id: resource.id }
51
51
 
52
- it { expect(response).to redirect_to("/#{resource.slug}") }
52
+ it { expect(response).to redirect_to("/lcms-engine#{resource.slug}") }
53
53
  end
54
54
 
55
55
  context 'grade' do
56
56
  let(:resource) { create(:resource, :grade) }
57
57
  before { get :show, slug: resource.slug }
58
- it { expect(response).to redirect_to explore_curriculum_index_path(p: resource.slug, e: 1) }
58
+ it { expect(response).to redirect_to lcms_engine(explore_curriculum_index_path(p: resource.slug, e: 1)) }
59
59
  end
60
60
 
61
61
  context 'module' do
62
62
  let(:resource) { create(:resource, :module) }
63
63
  before { get :show, slug: resource.slug }
64
- it { expect(response).to redirect_to explore_curriculum_index_path(p: resource.slug, e: 1) }
64
+ it { expect(response).to redirect_to lcms_engine(explore_curriculum_index_path(p: resource.slug, e: 1)) }
65
65
  end
66
66
  end
67
67
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe Lcms::Engine::WelcomeController do
6
+ #
7
+ # In the Host application should be a proxy which will redirect
8
+ # request inside mounted engine
9
+ #
10
+ describe 'GET oauth2callback' do
11
+ let(:code) { Faker::Lorem.words.join }
12
+
13
+ before { request.env['HTTP_REFERER'] = Lcms::Engine::WelcomeController::OAUTH_REFERER }
14
+
15
+ subject { get :oauth2callback, params: { code: code } }
16
+
17
+ it 'skips authorization' do
18
+ subject
19
+ expect(response).to be_successful
20
+ end
21
+
22
+ it 'renders passed in params as JSON' do
23
+ subject
24
+ result = JSON.parse(response.body)
25
+ expect(result['text']).to eq Lcms::Engine::WelcomeController::OAUTH_MESSAGE
26
+ expect(result['code']).to eq code
27
+ end
28
+
29
+ context 'when referer is not a Google service' do
30
+ before { request.env['HTTP_REFERER'] = 'test.com' }
31
+
32
+ it 'returns 404' do
33
+ subject
34
+ expect(response).to have_http_status(404)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -6,11 +6,9 @@ ignore_unreachable_actions:
6
6
  - lcms_engine
7
7
  - rails_info
8
8
  - rails_mailers
9
- - whoami$
10
9
  ignore_unused_routes:
11
10
  - ^lcms/engine/admin/access_codes#edit # accessed via `edit_admin_access_code_path`
12
11
  - ^lcms/engine/admin\/reading_assignment_texts # accessed via `association_picker_field` helper
13
12
  - ^devise
14
13
  - ^lcms/engine/pages#forthcoming # Used by `LinkTag`
15
14
  - ^pdfjs_viewer
16
- - whoami$
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/webpack_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::WebpackRunner.run(ARGV)
18
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/dev_server_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::DevServerRunner.run(ARGV)
18
+ end
@@ -17,7 +17,7 @@ require 'lcms/engine'
17
17
  module Dummy
18
18
  class Application < Rails::Application
19
19
  # Initialize configuration defaults for originally generated Rails version.
20
- config.load_defaults 5.2
20
+ config.load_defaults 6.1
21
21
 
22
22
  # Settings in config/environments/* take precedence over those specified here.
23
23
  # Application configuration can go into files in config/initializers
@@ -7,7 +7,7 @@ Rails.application.configure do
7
7
  # test suite. You never need to work with it otherwise. Remember that
8
8
  # your test database is "scratch space" for the test suite and is wiped
9
9
  # and recreated between test runs. Don't rely on the data there!
10
- config.cache_classes = true
10
+ config.cache_classes = false
11
11
 
12
12
  # Do not eager load code on boot. This avoids loading your whole application
13
13
  # just for the purpose of running a single test. If you are using a tool that
@@ -14,3 +14,9 @@ Rails.application.config.assets.version = '1.0'
14
14
  # application.js, application.css, and all non-JS/CSS in the app/assets
15
15
  # folder are already added.
16
16
  # Rails.application.config.assets.precompile += %w( admin.js admin.css )
17
+
18
+ # To prevent Sass errors
19
+ # See https://github.com/rails/sprockets/issues/581
20
+ Rails.application.config.assets.configure do |env|
21
+ env.export_concurrent = false
22
+ end
@@ -2,17 +2,13 @@
2
2
  # Admin layout
3
3
  layout: 'lcms/engine/admin'
4
4
 
5
- # TODO: Check the default values handling
6
- # Engine
7
- engine: 'Lcms::Engine::Engine'
8
-
9
5
  # TODO: Check the default values handling
10
6
  # Redirects
11
7
  redirect:
12
8
  host:
13
- # root_path: 'admin_path'
14
- # document_path: 'document_path'
15
- # material_path: 'material_path'
9
+ root_path: 'admin_path'
10
+ document_path: 'document_path'
11
+ material_path: 'material_path'
16
12
  engine:
17
13
  root_path: 'admin_path'
18
14
  document_path: 'document_path'
@@ -4,5 +4,11 @@ Rails.application.routes.draw do
4
4
  mount Lcms::Engine::Engine => '/lcms-engine'
5
5
  root to: redirect('/lcms-engine/')
6
6
 
7
+ get '/oauth2callback', to: redirect(path: '/lcms-engine/oauth2callback')
8
+
9
+ # Used for testing only
10
+ direct(:document) { '/' }
11
+ direct(:material) { '/' }
12
+
7
13
  get '/admin', to: 'welcome#index', as: :admin
8
14
  end
@@ -2,11 +2,11 @@
2
2
  # of editing this file, please use the migrations feature of Active Record to
3
3
  # incrementally modify your database, and then regenerate this schema definition.
4
4
  #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
@@ -2,5 +2,6 @@
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :document, class: Lcms::Engine::Document do
5
+ file_id { "file_#{SecureRandom.hex(6)}" }
5
6
  end
6
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :download, class: Lcms::Engine::Download do
5
- title { Faker::Lorem.words.join '' }
5
+ title { Faker::Lorem.words.join }
6
6
  url { Faker::Internet.url }
7
7
  end
8
8
  end
@@ -5,7 +5,7 @@ FactoryBot.define do
5
5
  curriculum { ::Lcms::Engine::Curriculum.default || create(:curriculum) }
6
6
  curriculum_type { 'lesson' }
7
7
  metadata do
8
- { subject: 'ela', grade: 'grade 2', 'module': 'module 1',
8
+ { subject: 'ela', grade: 'grade 2', module: 'module 1',
9
9
  unit: 'unit 1', lesson: 'lesson 1' }
10
10
  end
11
11
  resource_type { ::Lcms::Engine::Resource.resource_types[:resource] }
@@ -20,7 +20,7 @@ FactoryBot.define do
20
20
 
21
21
  trait :module do
22
22
  curriculum_type { 'module' }
23
- metadata { { subject: 'ela', grade: 'grade 2', 'module': 'module 1' } }
23
+ metadata { { subject: 'ela', grade: 'grade 2', module: 'module 1' } }
24
24
  end
25
25
  end
26
26
  end
@@ -44,6 +44,7 @@ feature 'Admin adds a material' do
44
44
  expect(page).to have_field :material_form_link
45
45
 
46
46
  fill_in :material_form_link, with: data[:url]
47
+ find('#material_form_async').uncheck
47
48
  click_button 'Parse'
48
49
 
49
50
  expect(Lcms::Engine::Material.last.name).to eql(data[:file_name])
@@ -66,6 +67,7 @@ feature 'Admin adds a material' do
66
67
  allow(Lcms::Engine::S3Service).to receive(:upload)
67
68
 
68
69
  fill_in :material_form_link, with: data[:url]
70
+ find('#material_form_async').uncheck
69
71
  click_button 'Parse'
70
72
 
71
73
  expect(Lcms::Engine::Material.last.name).to eql(data[:file_name])
@@ -7,7 +7,7 @@ feature 'Admin users' do
7
7
 
8
8
  given(:access_code) { create(:access_code).code }
9
9
  given(:admin) { create :admin }
10
- given(:domain) { ENV['APPLICATION_DOMAIN'] }
10
+ given(:domain) { ENV.fetch('APPLICATION_DOMAIN', nil) }
11
11
  given!(:user) { create :user, email: "unbounded@#{domain}" }
12
12
  given(:name) { Faker::Lorem.name }
13
13
  given(:email) { Faker::Internet.email }
@@ -57,7 +57,7 @@ feature 'Admin users' do
57
57
  click_button 'Save'
58
58
 
59
59
  user.reload
60
- expect(current_path).to eq lcms_engine.edit_admin_user_path(user.id)
60
+ expect(current_path).to eq lcms_engine.admin_users_path
61
61
  expect(page.find('.callout.success').text).to include('saved successfully')
62
62
  expect(user.email).to eq "unbounded@#{domain}"
63
63
  expect(user.unconfirmed_email).to eq "joe@#{domain}"
@@ -2,26 +2,26 @@
2
2
 
3
3
  require 'rails_helper'
4
4
 
5
- describe Lcms::Engine::Admin::AdminController do
6
- describe '.host_engine_path' do
5
+ describe Lcms::Engine::PathHelper do
6
+ describe '#dynamic_path' do
7
7
  let(:args) { { query: 'test', filter: '1' } }
8
8
 
9
- subject { described_class.host_engine_path(:root_path, args) }
9
+ subject { helper.dynamic_path(:root_path, args) }
10
10
 
11
11
  context 'with host redirect' do
12
12
  it 'builds correct path' do
13
- expect(subject).to eq "/lcms-engine/admin?#{args.to_param}"
13
+ expect(subject).to eq "/admin?#{args.to_param}"
14
14
  end
15
15
  end
16
16
 
17
17
  context 'with engine redirect' do
18
18
  let(:settings) do
19
- settings = described_class.settings
19
+ settings = Lcms::Engine::Admin::AdminController.settings
20
20
  settings[:redirect].delete(:host)
21
21
  settings
22
22
  end
23
23
 
24
- before { allow(described_class).to receive(:settings).and_return(settings) }
24
+ before { allow(Lcms::Engine::Admin::AdminController).to receive(:settings).and_return(settings) }
25
25
 
26
26
  it 'builds correct path' do
27
27
  expect(subject).to eq "/lcms-engine/admin?#{args.to_param}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rails_helper'
4
- require 'doc_template/objects/activity_metadata'
4
+ # require 'doc_template/objects/activity_metadata'
5
5
 
6
6
  describe DocTemplate::Objects::ActivityMetadata do
7
7
  describe '.build_from' do
@@ -15,6 +15,7 @@ describe DocTemplate::Objects::AgendaMetadata do
15
15
  end
16
16
  end
17
17
 
18
+ # rubocop:disable Naming/VariableNumber
18
19
  describe 'correct data' do
19
20
  describe 'calculates time hierarchily' do
20
21
  let(:agenda_table) do
@@ -116,5 +117,6 @@ describe DocTemplate::Objects::AgendaMetadata do
116
117
  end
117
118
  end
118
119
  end
120
+ # rubocop:enable Naming/VariableNumber
119
121
  end
120
122
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rails_helper'
4
4
 
5
- describe DocTemplate::Objects::TOCMetadata do
5
+ describe DocTemplate::Objects::TocMetadata do
6
6
  let(:empty_toc) { {} }
7
7
  let(:l2_toc) do
8
8
  {
@@ -28,6 +28,6 @@ describe DocTemplate::Tags::PageBreakTag do
28
28
  context 'with soft returns on tag' do
29
29
  let(:original_content) { '<p><span>[page-break]</span>some content</p>' }
30
30
 
31
- it { expect { subject }.to raise_error(DocumentError) }
31
+ it { expect { subject }.to raise_error(Lcms::Engine::DocumentError) }
32
32
  end
33
33
  end
@@ -9,7 +9,7 @@ describe DocTemplate::Tags::PdTag do
9
9
  let(:original_content) { "<p><span>[PD: #{url}; #{title}; </span><span>#{description}]</span></p><p><span>" }
10
10
  let(:params) do
11
11
  {
12
- metadata: OpenStruct.new(resource_subject: 'ela'),
12
+ metadata: double('metadata', resource_subject: 'ela'),
13
13
  value: [url, title, description].join('; ')
14
14
  }
15
15
  end
@@ -111,7 +111,7 @@ describe Lcms::Engine::Document do
111
111
  subject { document.ordered_material_ids }
112
112
 
113
113
  it 'proxies the call to the TOC' do
114
- expect_any_instance_of(DocTemplate::Objects::TOCMetadata).to receive(:ordered_material_ids)
114
+ expect_any_instance_of(DocTemplate::Objects::TocMetadata).to receive(:ordered_material_ids)
115
115
  subject
116
116
  end
117
117
  end
@@ -8,6 +8,7 @@ describe Lcms::Engine::Standard do
8
8
  expect(obj).to be_valid
9
9
  end
10
10
 
11
+ # rubocop:disable Naming/VariableNumber
11
12
  describe '.search_by_name' do
12
13
  let(:alt_name) { 'a-synonym' }
13
14
  let(:name) { 'test-std' }
@@ -26,4 +27,5 @@ describe Lcms::Engine::Standard do
26
27
  expect(described_class.search_by_name(name).first).to eq standard_2
27
28
  end
28
29
  end
30
+ # rubocop:enable Naming/VariableNumber
29
31
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe Lcms::Engine::AdminMaterialsQuery do
6
+ describe 'filter by metadata' do
7
+ let(:query) { { lesson: 1, name_date: true } }
8
+ let(:scope) { double ActiveRecord::Relation }
9
+
10
+ before do
11
+ allow(Lcms::Engine::Material).to receive(:all).and_return(scope)
12
+ allow(scope).to receive_message_chain(:reorder, :distinct).and_return(scope)
13
+ end
14
+
15
+ subject { described_class.call query }
16
+
17
+ it 'filters by metadata using ILIKE' do
18
+ expect(scope).to receive(:where_metadata_like).with(:lesson, 1).and_return(scope)
19
+ expect(scope).to receive(:where_metadata_like).with(:name_date, true).and_return(scope)
20
+ subject
21
+ end
22
+
23
+ context 'strict metadata fields' do
24
+ let(:query) { { lesson: 1, grade: 'grade 1', subject: Faker::Lorem.word } }
25
+
26
+ it 'filters by metadata using explicit comparison' do
27
+ expect(scope).to receive(:where_metadata_like).with(:lesson, 1).and_return(scope)
28
+ expect(scope).to receive(:where_metadata).with(query.slice(:grade)).and_return(scope)
29
+ expect(scope).to receive(:where_metadata).with(query.slice(:subject)).and_return(scope)
30
+ subject
31
+ end
32
+ end
33
+ end
34
+ end
data/spec/rails_helper.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # This file is copied to spec/ when you run 'rails generate rspec:install'
4
+ require 'simplecov'
5
+ SimpleCov.start 'rails'
6
+
4
7
  require 'spec_helper'
5
8
 
6
9
  ENV['RAILS_ENV'] ||= 'test'
@@ -16,6 +19,9 @@ require 'email_spec'
16
19
  require 'email_spec/rspec'
17
20
  require 'faker'
18
21
 
22
+ Warning[:deprecated] = true
23
+ Warning[:experimental] = true
24
+
19
25
  Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each(&method(:require))
20
26
  Dir[File.expand_path('**/shared_examples/*.rb')].sort.each(&method(:require))
21
27
 
@@ -32,21 +38,4 @@ RSpec.configure do |config|
32
38
  config.infer_spec_type_from_file_location!
33
39
 
34
40
  config.filter_rails_from_backtrace!
35
-
36
- config.before(:suite) do
37
- # Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice.
38
- # See for detail: https://github.com/rails/rails/issues/34790
39
- if RUBY_VERSION.to_f >= 2.6 && Rails::VERSION::MAJOR == 4
40
- class ActionController::TestResponse # rubocop:disable Style/ClassAndModuleChildren
41
- prepend Module.new {
42
- def recycle!
43
- # Patch to avoid MonitorMixin double-initialize error:
44
- @mon_mutex_owner_object_id = nil
45
- @mon_mutex = nil
46
- super
47
- end
48
- }
49
- end
50
- end
51
- end
52
41
  end
@@ -10,29 +10,22 @@ describe Lcms::Engine::DocumentBuildService do
10
10
  let(:downloader) { double }
11
11
  let(:downloaded_document) { 'html-here' }
12
12
  let(:file) do
13
- OpenStruct.new(
14
- name: 'file name',
15
- modified_time: Time.current - 1.day
16
- )
13
+ double('file', name: 'file name', modified_time: Time.current - 1.day, last_modifying_user: 'User', version: '42')
17
14
  end
18
15
  let(:file_id) { 'Google Document file id' }
19
16
  let(:parsed_document) do
20
- OpenStruct.new(
21
- activity_metadata: [{ 'material_ids' => [] }],
22
- agenda: [],
23
- parts: []
24
- )
17
+ double('parsed_document', activity_metadata: [{ 'material_ids' => [] }], agenda: [], parts: [])
25
18
  end
26
19
  let(:template) do
27
20
  stubs = {
28
21
  css_styles: '',
29
22
  metadata: {},
30
- metadata_service: OpenStruct.new(errors: []),
23
+ metadata_service: double('service', errors: []),
31
24
  parse: parsed_document,
32
25
  parts: [],
33
26
  'prereq?' => false,
34
27
  render: '',
35
- toc: OpenStruct.new(collect_material_ids: [])
28
+ toc: double('toc', collect_material_ids: [])
36
29
  }
37
30
  instance_double DocTemplate::Template, stubs
38
31
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe Lcms::Engine::S3Service do
6
+ describe '.upload' do
7
+ let(:data) { StringIO.new('data to be uploaded') }
8
+ let(:full_options) { options.merge(body: data) }
9
+ let(:key) { 'path/to/file' }
10
+ let(:object) do
11
+ params = {
12
+ put: 'true',
13
+ public_url: url
14
+ }
15
+ double(::Aws::S3::Resource, **params)
16
+ end
17
+ let(:options) { { content_type: 'image/png' } }
18
+ let(:url) { Faker::Internet.url }
19
+
20
+ before { allow(described_class).to receive(:create_object).with(key).and_return(object) }
21
+
22
+ subject { described_class.upload(key, data, options) }
23
+
24
+ it 'uploads data with passed params' do
25
+ expect(object).to receive(:put).with(full_options)
26
+ subject
27
+ end
28
+
29
+ it 'returns URL of the uploaded object'
30
+ end
31
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rails_helper'
4
4
 
5
+ # rubocop:disable Naming/VariableNumber
5
6
  shared_examples_for 'navigable' do # rubocop:disable Metrics/BlockLength
6
7
  let(:another_grandchild) { create factory }
7
8
  let(:child) { create factory }
@@ -71,3 +72,4 @@ shared_examples_for 'navigable' do # rubocop:disable Metrics/BlockLength
71
72
  end
72
73
  end
73
74
  end
75
+ # rubocop:enable Naming/VariableNumber
@@ -9,6 +9,10 @@ module Lcms
9
9
  included do
10
10
  routes { ::Lcms::Engine::Engine.routes }
11
11
  end
12
+
13
+ def lcms_engine(path)
14
+ "/lcms-engine#{path}"
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -11,7 +11,7 @@ shared_examples 'content_tag' do # rubocop:disable Metrics/BlockLength
11
11
  HTML
12
12
  end
13
13
 
14
- it { expect { subject }.to raise_error(DocumentError) }
14
+ it { expect { subject }.to raise_error(Lcms::Engine::DocumentError) }
15
15
  end
16
16
 
17
17
  context 'with soft return before start tag' do
@@ -22,7 +22,7 @@ shared_examples 'content_tag' do # rubocop:disable Metrics/BlockLength
22
22
  HTML
23
23
  end
24
24
 
25
- it { expect { subject }.to raise_error(DocumentError) }
25
+ it { expect { subject }.to raise_error(Lcms::Engine::DocumentError) }
26
26
  end
27
27
 
28
28
  context 'with soft return before stop tag' do
@@ -34,7 +34,7 @@ shared_examples 'content_tag' do # rubocop:disable Metrics/BlockLength
34
34
  HTML
35
35
  end
36
36
 
37
- it { expect { subject }.to raise_error(DocumentError) }
37
+ it { expect { subject }.to raise_error(Lcms::Engine::DocumentError) }
38
38
  end
39
39
 
40
40
  context 'with soft return after stop tag' do
@@ -46,6 +46,6 @@ shared_examples 'content_tag' do # rubocop:disable Metrics/BlockLength
46
46
  HTML
47
47
  end
48
48
 
49
- it { expect { subject }.to raise_error(DocumentError) }
49
+ it { expect { subject }.to raise_error(Lcms::Engine::DocumentError) }
50
50
  end
51
51
  end
data/templates/routes.rb CHANGED
@@ -54,7 +54,6 @@ Rails.application.routes.draw do
54
54
 
55
55
  namespace :admin do
56
56
  get '/' => 'welcome#index'
57
- get '/whoami' => 'admin#whoami'
58
57
  get 'google_oauth2_callback' => 'google_oauth2#callback'
59
58
  get '/association_picker' => 'association_picker#index'
60
59
  resources :reading_assignment_texts