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
@@ -0,0 +1 @@
1
+ .jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none;user-select:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-no-icons{margin-left:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default-dark .jstree-anchor,.jstree-default-dark .jstree-animated,.jstree-default-dark .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default-dark .jstree-hovered{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-context{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-clicked{background:#5fa2db;border-radius:2px;box-shadow:inset 0 0 1px #666666}.jstree-default-dark .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default-dark .jstree-disabled{background:transparent;color:#666666}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#333333}.jstree-default-dark .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark .jstree-search{font-style:italic;color:#ffffff;font-weight:bold}.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#555}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#555}.jstree-default-dark>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default-dark>.jstree-wholerow-ul .jstree-hovered,.jstree-default-dark>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default-dark .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default-dark .jstree-wholerow-hovered{background:#555}.jstree-default-dark .jstree-wholerow-clicked{background:#5fa2db;background:-webkit-linear-gradient(top, #5fa2db 0, #5fa2db 100%);background:linear-gradient(to bottom, #5fa2db 0, #5fa2db 100%)}.jstree-default-dark .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default-dark .jstree-anchor{line-height:24px;height:24px}.jstree-default-dark .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default-dark .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default-dark.jstree-rtl .jstree-node{margin-right:24px}.jstree-default-dark .jstree-wholerow{height:24px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-image:url("32px.png")}.jstree-default-dark .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default-dark .jstree-last{background:transparent}.jstree-default-dark .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default-dark .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default-dark .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default-dark .jstree-themeicon{background-position:-260px -4px}.jstree-default-dark>.jstree-no-dots .jstree-node,.jstree-default-dark>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default-dark>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default-dark .jstree-disabled{background:transparent}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark .jstree-checkbox{background-position:-164px -4px}.jstree-default-dark .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default-dark .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default-dark .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default-dark .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark>.jstree-striped{background-size:auto 48px}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default-dark.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default-dark.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default-dark .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark .jstree-file{background:url("32px.png") -100px -68px no-repeat}.jstree-default-dark .jstree-folder{background:url("32px.png") -260px -4px no-repeat}.jstree-default-dark>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default-dark .jstree-ok,#jstree-dnd.jstree-default-dark .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark i{background:transparent;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default-dark .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default-dark .jstree-er{background-position:-36px -68px}.jstree-default-dark .jstree-ellipsis{overflow:hidden}.jstree-default-dark .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-dark-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-dark-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-dark-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-dark-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-dark-small .jstree-wholerow{height:18px}.jstree-default-dark-small .jstree-node,.jstree-default-dark-small .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-dark-small .jstree-last{background:transparent}.jstree-default-dark-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-dark-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-dark-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-dark-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-node,.jstree-default-dark-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-dark-small .jstree-disabled{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-dark-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-dark-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-small>.jstree-striped{background-size:auto 36px}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-dark-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-dark-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-dark-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-small .jstree-file{background:url("32px.png") -103px -71px no-repeat}.jstree-default-dark-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat}.jstree-default-dark-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-dark-small .jstree-ok,#jstree-dnd.jstree-default-dark-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-dark-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-dark-small .jstree-er{background-position:-39px -71px}.jstree-default-dark-small .jstree-ellipsis{overflow:hidden}.jstree-default-dark-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-dark-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-dark-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-dark-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-dark-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-dark-large .jstree-wholerow{height:32px}.jstree-default-dark-large .jstree-node,.jstree-default-dark-large .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-dark-large .jstree-last{background:transparent}.jstree-default-dark-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-dark-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-dark-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-dark-large .jstree-themeicon{background-position:-256px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-node,.jstree-default-dark-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-dark-large .jstree-disabled{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-large .jstree-checkbox{background-position:-160px 0}.jstree-default-dark-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-dark-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-large>.jstree-striped{background-size:auto 64px}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-dark-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-dark-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-dark-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-large .jstree-file{background:url("32px.png") -96px -64px no-repeat}.jstree-default-dark-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat}.jstree-default-dark-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-dark-large .jstree-ok,#jstree-dnd.jstree-default-dark-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-dark-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-dark-large .jstree-er{background-position:-32px -64px}.jstree-default-dark-large .jstree-ellipsis{overflow:hidden}.jstree-default-dark-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-dark-responsive .jstree-icon{background-image:url("40px.png")}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-dark-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-dark-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-default-dark-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-dark-responsive .jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl,.jstree-default-dark-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important}.jstree-default-dark-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important}.jstree-default-dark-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important}.jstree-default-dark-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-dark-responsive .jstree-checkbox,.jstree-default-dark-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-dark-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-default-dark-responsive>.jstree-striped{background:transparent}.jstree-default-dark-responsive .jstree-wholerow{border-top:1px solid #666;border-bottom:1px solid #000;background:#333333;height:40px}.jstree-default-dark-responsive .jstree-wholerow-hovered{background:#555}.jstree-default-dark-responsive .jstree-wholerow-clicked{background:#5fa2db}.jstree-default-dark-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #111111}.jstree-default-dark-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #111111;border-top:0}.jstree-default-dark-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-node>.jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px}.jstree-default-dark-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-dark-responsive .jstree-last{background:transparent}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-dark-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-dark-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}.jstree-default-dark{background:#333}.jstree-default-dark .jstree-anchor{color:#999;text-shadow:1px 1px 0 rgba(0,0,0,0.5)}.jstree-default-dark .jstree-clicked,.jstree-default-dark .jstree-checked{color:white}.jstree-default-dark .jstree-hovered{color:white}#jstree-marker.jstree-default-dark{border-left-color:#999;background:transparent}.jstree-default-dark .jstree-anchor>.jstree-icon{opacity:.75}.jstree-default-dark .jstree-clicked>.jstree-icon,.jstree-default-dark .jstree-hovered>.jstree-icon,.jstree-default-dark .jstree-checked>.jstree-icon{opacity:1}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}
@@ -10,7 +10,7 @@ module Lcms
10
10
 
11
11
  WAIT_FOR_JOBS = %w(
12
12
  Lcms::Engine::MaterialGenerateJob
13
- Lcms::Engine::MaterialGeneratePDFJob
13
+ Lcms::Engine::MaterialGeneratePdfJob
14
14
  Lcms::Engine::MaterialGenerateGdocJob
15
15
  ).freeze
16
16
 
@@ -9,21 +9,21 @@ module Lcms
9
9
  queue_as :default
10
10
 
11
11
  PDF_EXPORTERS = {
12
- 'full' => DocumentExporter::PDF::Document,
13
- 'sm' => DocumentExporter::PDF::StudentMaterial,
14
- 'tm' => DocumentExporter::PDF::TeacherMaterial
12
+ 'full' => ::DocumentExporter::Pdf::Document,
13
+ 'sm' => ::DocumentExporter::Pdf::StudentMaterial,
14
+ 'tm' => ::DocumentExporter::Pdf::TeacherMaterial
15
15
  }.freeze
16
16
 
17
17
  def perform(doc, options)
18
18
  content_type = options[:content_type]
19
19
  document = DocumentGenerator.document_presenter.new doc.reload, content_type: content_type
20
- filename = options[:filename].presence || "#{DocumentExporter::PDF::Base.s3_folder}/#{document.pdf_filename}"
20
+ filename = options[:filename].presence || "#{::DocumentExporter::Pdf::Base.s3_folder}/#{document.pdf_filename}"
21
21
  pdf = PDF_EXPORTERS[content_type].new(document, options).export
22
22
  url = S3Service.upload filename, pdf
23
23
 
24
24
  return if options[:excludes].present?
25
25
 
26
- key = ::DocumentExporter::PDF::Base.pdf_key options[:content_type]
26
+ key = ::DocumentExporter::Pdf::Base.pdf_key options[:content_type]
27
27
  document.with_lock do
28
28
  document.update links: document.reload.links.merge(key => url)
29
29
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lcms
4
4
  module Engine
5
- class MaterialGeneratePDFJob < Lcms::Engine::ApplicationJob
5
+ class MaterialGeneratePdfJob < Lcms::Engine::ApplicationJob
6
6
  include ResqueJob
7
7
 
8
8
  include RetrySimple
@@ -31,12 +31,12 @@ module Lcms
31
31
  def links_from_upload(material, document)
32
32
  material = material_presenter(material, document)
33
33
 
34
- basename = "#{DocumentExporter::PDF::Base.s3_folder}/#{material.pdf_filename}"
34
+ basename = "#{::DocumentExporter::Pdf::Base.s3_folder}/#{material.pdf_filename}"
35
35
  pdf_filename = "#{basename}#{ContentPresenter::PDF_EXT}"
36
36
  thumb_filename = "#{basename}#{ContentPresenter::THUMB_EXT}"
37
37
 
38
- pdf = DocumentExporter::PDF::Material.new(material).export
39
- thumb = DocumentExporter::Thumbnail.new(pdf).export
38
+ pdf = ::DocumentExporter::Pdf::Material.new(material).export
39
+ thumb = ::DocumentExporter::Thumbnail.new(pdf).export
40
40
 
41
41
  pdf_url = S3Service.upload pdf_filename, pdf
42
42
  thumb_url = S3Service.upload thumb_filename, thumb
@@ -13,29 +13,25 @@ module Lcms
13
13
  end
14
14
 
15
15
  def previous
16
- @previous ||= begin
17
- return unless level_position
18
-
19
- if level_position.positive?
16
+ @previous ||=
17
+ if level_position.to_i.positive?
20
18
  siblings.where(level_position: level_position - 1).first
21
19
  else
22
20
  # last element of previous node from parent level
23
21
  parent.try(:previous).try(:children).try(:last)
24
22
  end
25
- end
26
23
  end
27
24
 
28
25
  def next
29
- @next ||= begin
30
- return unless level_position
31
-
32
- if level_position < siblings.size
26
+ @next ||=
27
+ if level_position.nil?
28
+ nil
29
+ elsif level_position < siblings.size
33
30
  siblings.where(level_position: level_position + 1).first
34
31
  else
35
32
  # first element of next node from parent level
36
33
  parent.try(:next).try(:children).try(:first)
37
34
  end
38
- end
39
35
  end
40
36
  end
41
37
  end
@@ -47,6 +47,13 @@ module Lcms
47
47
  def should_index?
48
48
  !skip_indexing && search_repo.index_exists?
49
49
  end
50
+
51
+ #
52
+ # Explicitly skip indexing as we do not use it now
53
+ #
54
+ def skip_indexing
55
+ true
56
+ end
50
57
  end
51
58
  end
52
59
  end
@@ -14,7 +14,7 @@ module Lcms
14
14
  before_save :set_resource_from_metadata
15
15
 
16
16
  store_accessor :foundational_metadata
17
- serialize :toc, DocTemplate::Objects::TOCMetadata
17
+ serialize :toc, DocTemplate::Objects::TocMetadata
18
18
 
19
19
  scope :actives, -> { where(active: true) }
20
20
  scope :inactives, -> { where(active: false) }
@@ -88,7 +88,7 @@ module Lcms
88
88
 
89
89
  def metadata_from_dir(dir)
90
90
  pairs = hierarchy[0...dir.size].zip(dir)
91
- Hash[pairs].compact.stringify_keys
91
+ pairs.to_h.compact.stringify_keys
92
92
  end
93
93
 
94
94
  def find_by_directory(*dir)
@@ -47,7 +47,7 @@ module Lcms
47
47
  include Elasticsearch::Persistence::Repository
48
48
  include Elasticsearch::Persistence::Repository::DSL
49
49
 
50
- client Elasticsearch::Client.new(host: ENV['ELASTICSEARCH_ADDRESS'])
50
+ client Elasticsearch::Client.new(host: ENV.fetch('ELASTICSEARCH_ADDRESS', nil))
51
51
 
52
52
  index_name :"unbounded_documents_#{Rails.env}"
53
53
 
@@ -67,7 +67,7 @@ module Lcms
67
67
 
68
68
  def document_parts_index
69
69
  @document_parts_index ||= document_parts.pluck(:placeholder, :anchor, :content, :optional)
70
- .map { |p| [p[0], { anchor: p[1], content: p[2], optional: p[3] }] }.to_h
70
+ .to_h { |p| [p[0], { anchor: p[1], content: p[2], optional: p[3] }] }
71
71
  end
72
72
 
73
73
  def layout_content(context_type)
@@ -8,31 +8,15 @@ module Lcms
8
8
 
9
9
  def editor_props
10
10
  @editor_props ||= {
11
- tree: jstree_data,
12
11
  form_url: routes.admin_curriculum_path
13
12
  }
14
13
  end
15
14
 
16
- private
17
-
18
- # Parse tree to be compatible with jstree input data
19
- def jstree_data
20
- Resource.tree.ordered.roots.map { |res| parse_jstree_node(res) }
21
- end
22
-
23
- def opened?(node)
24
- return false if node.curriculum_type.blank?
25
-
26
- level = Lcms::Engine::Resource.hierarchy.index(node.curriculum_type.to_sym)
27
- level < UNIT_LEVEL
28
- end
29
-
30
15
  def parse_jstree_node(node)
31
16
  {
32
17
  id: node.id,
33
- text: node.short_title,
34
- state: { opened: opened?(node) },
35
- children: node.children.tree.ordered.map { |res| parse_jstree_node(res) },
18
+ text: element_text(node),
19
+ children: node.children.any?,
36
20
  li_attr: { title: node.title }
37
21
  }
38
22
  end
@@ -40,6 +24,25 @@ module Lcms
40
24
  def routes
41
25
  Lcms::Engine::Engine.routes.url_helpers
42
26
  end
27
+
28
+ private
29
+
30
+ def element_text(resource)
31
+ case resource.curriculum_type
32
+ when 'subject'
33
+ resource.title
34
+ when 'unit'
35
+ resource.short_title&.upcase.presence || 'N/A'
36
+ when 'grade'
37
+ resource.short_title&.capitalize.presence || 'N/A'
38
+ when 'lesson_set'
39
+ "Lesson set #{resource.metadata['lesson_set']}"
40
+ when 'lesson'
41
+ "Lesson #{resource.metadata['lesson']}"
42
+ else
43
+ "Unknown curriculum type for: #{resource.title}"
44
+ end
45
+ end
43
46
  end
44
47
  end
45
48
  end
@@ -3,6 +3,8 @@
3
3
  module Lcms
4
4
  module Engine
5
5
  class DocumentPresenter < Lcms::Engine::ContentPresenter
6
+ include Rails.application.routes.url_helpers
7
+
6
8
  PDF_SUBTITLES = { full: '', sm: '_student_materials', tm: '_teacher_materials' }.freeze
7
9
  SUBJECT_FULL = { 'ela' => 'ELA', 'math' => 'Math' }.freeze
8
10
  TOC_RESOURCES = [I18n.t('document.toc.tm'), I18n.t('document.toc.sm'), I18n.t('document.toc.credits')].freeze
@@ -157,7 +159,7 @@ module Lcms
157
159
 
158
160
  def short_url
159
161
  @short_url ||= Bitly.client
160
- .shorten(Rails.application.routes.url_helpers.document_url(self))
162
+ .shorten(document_url(self))
161
163
  .short_url
162
164
  end
163
165
 
@@ -26,11 +26,14 @@ module Lcms
26
26
 
27
27
  next unless settings.values.any? || downloads.any?
28
28
 
29
- OpenStruct.new(category: dc, title: dc.title, downloads: downloads, settings: settings)
29
+ data = { category: dc, title: dc.title, downloads: downloads, settings: settings }
30
+ Struct.new(*data.keys, keyword_init: true).new(data)
30
31
  end
31
32
 
32
- uncategorized = download_categories['']
33
- downloads_list << OpenStruct.new(downloads: uncategorized, settings: {}) if uncategorized.present?
33
+ if (uncategorized = download_categories['']).present?
34
+ data = { downloads: uncategorized, settings: {} }
35
+ downloads_list << Struct.new(*data.keys, keyword_init: true).new(data)
36
+ end
34
37
 
35
38
  downloads_list.compact
36
39
  end
@@ -8,7 +8,7 @@ module Lcms
8
8
  class AdminDocumentsQuery < BaseQuery
9
9
  # Returns: ActiveRecord relation
10
10
  def call
11
- @scope = Document.includes(:materials, :resource).all # initial scope
11
+ @scope = Document.all # initial scope
12
12
  apply_filters
13
13
 
14
14
  if @pagination.present?
@@ -5,9 +5,11 @@ module Lcms
5
5
  # Usage:
6
6
  # @materials = AdminMaterialsQuery.call(query_params, page: params[:page])
7
7
  class AdminMaterialsQuery < BaseQuery
8
+ STRICT_METADATA = %w(grade subject).freeze
9
+
8
10
  # Returns: ActiveRecord relation
9
11
  def call
10
- @scope = Material.includes(:documents).all # initial scope
12
+ @scope = Material.all # initial scope
11
13
  search_by_identifier
12
14
  search_by_file_name
13
15
 
@@ -24,7 +26,14 @@ module Lcms
24
26
 
25
27
  def filter_by_metadata
26
28
  metadata_keys.each do |key|
27
- @scope = @scope.where_metadata_like(key, q[key]) if q[key].present?
29
+ next unless q[key].present?
30
+
31
+ @scope =
32
+ if STRICT_METADATA.include?(key.to_s)
33
+ @scope.where_metadata(key => q[key])
34
+ else
35
+ @scope.where_metadata_like(key, q[key])
36
+ end
28
37
  end
29
38
  end
30
39
 
@@ -10,7 +10,7 @@ module Lcms
10
10
  # query : query params (Hash or OpenStruct)
11
11
  # pagination : pagination params, if pagination is nil whe return all results
12
12
  def initialize(query, pagination = nil)
13
- @q = OpenStruct.new(query)
13
+ @q = OpenStruct.new(query) # rubocop:disable Style/OpenStructUse
14
14
  @pagination = pagination
15
15
  end
16
16
 
@@ -122,6 +122,7 @@ module Lcms
122
122
  # - fills in original or fs contents
123
123
  # - stores specific file_id for each type of a lesson
124
124
  def create_document
125
+ # rubocop:disable Lint/AmbiguousOperatorPrecedence
125
126
  if template.metadata['subject'].presence &&
126
127
  template.metadata['subject'].casecmp('ela').zero? || template.prereq?
127
128
  @document = Document.actives.find_or_initialize_by(file_id: downloader.file_id)
@@ -134,6 +135,7 @@ module Lcms
134
135
  @document[id_field] = downloader.file_id if @document.present?
135
136
  @document ||= Document.actives.find_or_initialize_by(id_field => downloader.file_id)
136
137
  end
138
+ # rubocop:enable Lint/AmbiguousOperatorPrecedence
137
139
  end
138
140
 
139
141
  def document_params
@@ -15,7 +15,7 @@ module Lcms
15
15
 
16
16
  MATERIAL_GENERATORS = {
17
17
  gdoc: '::Lcms::Engine::MaterialGenerateGdocJob',
18
- pdf: '::Lcms::Engine::MaterialGeneratePDFJob'
18
+ pdf: '::Lcms::Engine::MaterialGeneratePdfJob'
19
19
  }.with_indifferent_access.freeze
20
20
 
21
21
  MATERIAL_PARSE_JOB = '::Lcms::Engine::MaterialParseJob'
@@ -84,7 +84,7 @@ module Lcms
84
84
  document.links['materials'] = {}
85
85
  CONTENT_TYPES.each do |type|
86
86
  [
87
- DocumentExporter::PDF::Base.pdf_key(type),
87
+ DocumentExporter::Pdf::Base.pdf_key(type),
88
88
  DocumentExporter::Gdoc::Base.gdoc_key(type)
89
89
  ].each { |key| document.links.delete(key) }
90
90
  end
@@ -33,15 +33,12 @@ module Lcms
33
33
  folder = @options[:folder_id] || parent
34
34
  file_name = document.base_filename
35
35
  response = service.list_files(
36
- q: "'#{folder}' in parents and name = '#{file_name}' and mimeType = '#{MIME_FILE}' and trashed = false",
36
+ q: %("#{folder}" in parents and name = "#{file_name}" and mimeType = "#{MIME_FILE}" and trashed = false),
37
37
  fields: 'files(id)'
38
38
  )
39
- return nil if response.files.empty?
40
-
41
- unless response.files.size == 1
42
- Rails.logger.warn "Multiple files: more than 1 file with same name: #{file_name}"
43
- end
44
- response.files[0].id
39
+ files = Array.wrap(response&.files)
40
+ Rails.logger.warn "Multiple files: more than 1 file with same name: #{file_name}" unless files.size == 1
41
+ files.first&.id
45
42
  end
46
43
  end
47
44
 
@@ -62,14 +59,9 @@ module Lcms
62
59
  attr_reader :document, :options
63
60
 
64
61
  def folder_query(folder_name, parent_id)
65
- query = %(
66
- '#{parent_id}' in parents and name = '#{folder_name}' and
67
- mimeType = '#{::Lt::Google::Api::Drive::MIME_FOLDER}' and
68
- trashed = false)
69
- service.list_files(
70
- q: query,
71
- fields: 'files(id)'
72
- )
62
+ query = %("#{parent_id}" in parents and name = "#{folder_name}" and mimeType =
63
+ "#{::Lt::Google::Api::Drive::MIME_FOLDER}" and trashed = false)
64
+ service.list_files(q: query, fields: 'files(id)')
73
65
  end
74
66
 
75
67
  def subfolder(folder_name, parent_id = FOLDER_ID)
@@ -14,6 +14,9 @@ module Lcms
14
14
  @document = document
15
15
  end
16
16
 
17
+ #
18
+ # @param [String] id Google Document identifier
19
+ #
17
20
  def execute(id)
18
21
  # Create an execution request object.
19
22
  request = ::Google::Apis::ScriptV1::ExecutionRequest.new(
@@ -25,11 +28,12 @@ module Lcms
25
28
 
26
29
  # The API executed, but the script returned an error.
27
30
  error = response.error.details[0]
28
- msg = +"Script error message: #{error['errorMessage']}\n"
31
+ msg = "Error with document: #{id}\n"
32
+ msg += "Script error message: #{error['errorMessage']}\n"
29
33
  if error['scriptStackTraceElements']
30
- msg << 'Script error stacktrace:'
34
+ msg += 'Script error stacktrace:'
31
35
  error['scriptStackTraceElements'].each do |trace|
32
- msg << "\t#{trace['function']}: #{trace['lineNumber']}"
36
+ msg += "\t#{trace['function']}: #{trace['lineNumber']}"
33
37
  end
34
38
  end
35
39
  raise ::Google::Apis::Error, msg
@@ -253,7 +253,7 @@ module Lcms
253
253
  return unless node.element? && node.name == 'li' && node['style'].to_s.include?('margin-left')
254
254
 
255
255
  indent = /margin-left\s*:\s*(\d+)/.match(node['style']).try(:[], 1).to_i
256
- add_css_class(node, "u-ld-indent--l#{(indent - 50) / 30 + 2}") if indent >= 50
256
+ add_css_class(node, "u-ld-indent--l#{((indent - 50) / 30) + 2}") if indent >= 50
257
257
  end
258
258
 
259
259
  def post_processing_default(nodes)
@@ -29,7 +29,7 @@ module Lcms
29
29
  end
30
30
 
31
31
  def create_cartridge(resource)
32
- # Note: For now work only with Modules
32
+ # NOTE: For now work only with Modules
33
33
  # Subject - Grade - Module
34
34
  parent = {
35
35
  children: [{
@@ -54,7 +54,7 @@ module Lcms
54
54
 
55
55
  def generate_pdf
56
56
  pdf_filename = "#{PDF_S3_FOLDER}/#{material.id}/#{material.base_filename}#{ContentPresenter::PDF_EXT}"
57
- pdf = DocumentExporter::PDF::Material.new(material).export
57
+ pdf = DocumentExporter::Pdf::Material.new(material).export
58
58
  @url = S3Service.upload pdf_filename, pdf
59
59
  true
60
60
  end
@@ -12,9 +12,21 @@ module Lcms
12
12
  .object(key)
13
13
  end
14
14
 
15
- def self.upload(key, data)
15
+ #
16
+ # Upload data to the specified resource by key
17
+ #
18
+ # @param [String] key Key of the object. Usually represents the full path inside a bucket
19
+ # @param [IO|StringIO] data The data to be uploaded
20
+ # @param [Hash] options Additional options to be passed to Aws::S3::Object#put method
21
+ #
22
+ # @return [String] The final URL of the uploaded object
23
+ #
24
+ def self.upload(key, data, options = {})
16
25
  object = create_object key
17
- object.put(body: data)
26
+ options = options.merge(
27
+ body: data
28
+ )
29
+ object.put(options)
18
30
  object.public_url
19
31
  end
20
32
 
@@ -40,13 +40,13 @@ class ResourceTasks
40
40
  Resource.lessons.find_each do |res|
41
41
  next if res.time_to_teach.present? && res.time_to_teach != 0
42
42
 
43
- res.update_attributes(time_to_teach: 60)
43
+ res.update(time_to_teach: 60)
44
44
  end
45
45
 
46
46
  %i(units modules grades subjects).each do |level|
47
47
  Resource.send(level).find_each do |res|
48
48
  total = res.children.map(&:time_to_teach).sum
49
- res.update_attributes(time_to_teach: total)
49
+ res.update(time_to_teach: total)
50
50
  end
51
51
  end
52
52
  end
@@ -8,11 +8,11 @@
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1">
9
9
  <%= render partial: 'lcms/engine/shared/favicon' %>
10
10
  <script>document.querySelector('html').className = 'js';</script>
11
- <%= stylesheet_link_tag 'lcms/engine/admin', media: 'all', 'data-turbolinks-track' => 'reload' %>
11
+ <%= stylesheet_link_tag 'lcms/engine/lcms_engine_admin', media: 'all', 'data-turbolinks-track' => 'reload' %>
12
12
  <%= csrf_meta_tags %>
13
13
  <%# NOTE: JS served via Assets pipeline should be added first %>
14
- <%= javascript_include_tag 'lcms/engine/admin/application', 'data-turbolinks-track' => 'reload' %>
15
- <%= lcms_engine_javascript_pack_tag 'admin' %>
14
+ <%= javascript_include_tag 'lcms/engine/admin/lcms_engine_application', 'data-turbolinks-track' => 'reload' %>
15
+ <%= lcms_engine_javascript_pack_tag 'lcms_engine_admin' %>
16
16
  </head>
17
17
  <body>
18
18
  <div class="u-page-wrap c-admin u-supported">
@@ -9,8 +9,8 @@
9
9
  <%= redirect_meta_tag %>
10
10
  <%= render partial: 'lcms/engine/shared/favicon' %>
11
11
  <script>document.querySelector('html').className = 'js';</script>
12
- <%= stylesheet_link_tag 'lcms/engine/application', media: 'all', 'data-turbolinks-track' => 'reload' %>
13
- <%= javascript_include_tag 'lcms/engine/application', 'data-turbolinks-track' => 'reload' %>
12
+ <%= stylesheet_link_tag 'lcms/engine/lcms_engine_application', media: 'all', 'data-turbolinks-track' => 'reload' %>
13
+ <%= javascript_include_tag 'lcms/engine/lcms_engine_application', 'data-turbolinks-track' => 'reload' %>
14
14
  <%= csrf_meta_tags %>
15
15
  <% if content_for?(:canonical_url) %>
16
16
  <link rel=canonical href='<%= yield(:canonical_url) %>'>
@@ -5,7 +5,7 @@
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
7
  <script>document.querySelector('html').className = 'js';</script>
8
- <%= stylesheet_link_tag 'lcms/engine/application', media: 'all', 'data-turbolinks-track' => 'reload' %>
8
+ <%= stylesheet_link_tag 'lcms/engine/lcms_engine_application', media: 'all', 'data-turbolinks-track' => 'reload' %>
9
9
  <%= javascript_include_tag '//s7.addthis.com/js/300/addthis_widget.js#async=1' %>
10
10
  <%= javascript_include_tag 'lcms/engine/application_lti', 'data-turbolinks-track' => 'reload' %>
11
11
  <%= csrf_meta_tags %>
@@ -1,4 +1,4 @@
1
- <%= simple_form_for [:admin, @access_code], html: { id: 'access_code_form' } do |f| %>
1
+ <%= simple_form_for @access_code, url: @url.presence || lcms_engine.admin_access_codes_path, html: { id: 'access_code_form' } do |f| %>
2
2
  <%= f.input :code %>
3
3
  <%= f.input :active %>
4
4
  <%= f.button :submit, t('ui.save'), name: nil %>
@@ -1,7 +1,7 @@
1
1
  <div class=o-page>
2
2
  <div class=clearfix>
3
3
  <div class=pull-right>
4
- <%= link_to t('.new_access_code'), :new_admin_access_code, class: 'button success', 'data-turbolinks' => false %>
4
+ <%= link_to t('.new_access_code'), lcms_engine.new_admin_access_code_path, class: 'button success', 'data-turbolinks' => false %>
5
5
  </div>
6
6
  </div>
7
7
 
@@ -19,10 +19,10 @@
19
19
  <% @access_codes.each do |access_code| %>
20
20
  <% cache access_code do %>
21
21
  <tr id="access_code_<%= access_code.id %>">
22
- <td><%= link_to access_code.code, edit_admin_access_code_path(access_code) %>
22
+ <td><%= link_to access_code.code, lcms_engine.edit_admin_access_code_path(access_code) %>
23
23
  <td><%= access_code.active ? 'YES' : 'NO' %>
24
24
  <td>
25
- <%= button_to t('ui.delete'), admin_access_code_path(access_code), class: 'button alert', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :delete %>
25
+ <%= button_to t('ui.delete'), lcms_engine.admin_access_code_path(access_code), class: 'button alert', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :delete %>
26
26
  </td>
27
27
  </tr>
28
28
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= simple_form_for :query, url: :admin_batch_reimport, html: { class: 'form-inline well o-admin-lessons-search', method: :post } do |f| %>
1
+ <%= simple_form_for :query, url: lcms_engine.admin_batch_reimport_path, html: { class: 'form-inline well o-admin-lessons-search', method: :post } do |f| %>
2
2
 
3
3
  <div class="row align-bottom align-justify">
4
4
  <button class="button o-admin-search-subject float-right" type="button" data-toggle="subject">Select Subject</button>