lcms-engine 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +11 -15
  4. data/Dockerfile +0 -1
  5. data/README.md +13 -4
  6. data/app/assets/javascripts/lcms/engine/admin/application.js +2 -6
  7. data/app/assets/javascripts/lcms/engine/application.js +2 -2
  8. data/app/assets/javascripts/lcms/engine/initializers/{google_analytics.js → analytics.js} +0 -0
  9. data/app/assets/javascripts/lcms/engine/initializers/lessons.js +1 -1
  10. data/app/assets/stylesheets/lcms/engine/admin.scss +1 -1
  11. data/app/assets/stylesheets/lcms/engine/application.scss +4 -3
  12. data/app/assets/stylesheets/lcms/engine/components/_curriculum-cards.scss +1 -1
  13. data/app/assets/stylesheets/lcms/engine/components/_curriculum-map.scss +4 -4
  14. data/app/assets/stylesheets/lcms/engine/components/_media-resources.scss +1 -1
  15. data/app/assets/stylesheets/lcms/engine/components/_panel-dsc.scss +1 -1
  16. data/app/assets/stylesheets/lcms/engine/components/_resource.scss +6 -6
  17. data/app/assets/stylesheets/lcms/engine/pages/_home.scss +4 -4
  18. data/app/assets/stylesheets/lcms/engine/pdf.scss +1 -1
  19. data/app/assets/stylesheets/lcms/engine/themes/_settings.scss +419 -116
  20. data/app/assets/stylesheets/lcms/engine/utils/_mixins.scss +2 -2
  21. data/app/assets/stylesheets/lcms/engine/vendors/foundation_and_overrides-pdf.scss +0 -1
  22. data/app/assets/stylesheets/lcms/engine/vendors/foundation_and_overrides.scss +13 -2
  23. data/app/controllers/lcms/engine/admin/admin_controller.rb +0 -2
  24. data/app/controllers/lcms/engine/admin/association_picker_controller.rb +10 -9
  25. data/app/controllers/lcms/engine/admin/documents_controller.rb +17 -14
  26. data/app/controllers/lcms/engine/admin/materials_controller.rb +19 -23
  27. data/app/controllers/lcms/engine/admin/resource_picker_controller.rb +2 -2
  28. data/app/controllers/lcms/engine/admin/resources_controller.rb +45 -79
  29. data/app/controllers/lcms/engine/admin/sketch_compilers_controller.rb +2 -2
  30. data/app/controllers/lcms/engine/application_controller.rb +0 -15
  31. data/app/entities/lcms/engine/pagination.rb +14 -5
  32. data/app/forms/lcms/engine/material_form.rb +0 -1
  33. data/app/helpers/lcms/engine/application_helper.rb +2 -6
  34. data/app/helpers/lcms/engine/view_helper.rb +1 -3
  35. data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +1 -1
  36. data/app/javascript/components/admin/ImportStatus.jsx +1 -1
  37. data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +1 -1
  38. data/app/javascript/components/admin/picker/pickerWindowWrapper.jsx +0 -1
  39. data/app/models/lcms/engine/access_code.rb +1 -1
  40. data/app/models/lcms/engine/application_record.rb +9 -0
  41. data/app/models/lcms/engine/author.rb +1 -1
  42. data/app/models/lcms/engine/copyright_attribution.rb +1 -1
  43. data/app/models/lcms/engine/curriculum.rb +1 -1
  44. data/app/models/lcms/engine/document.rb +3 -3
  45. data/app/models/lcms/engine/document_bundle.rb +2 -2
  46. data/app/models/lcms/engine/document_part.rb +1 -1
  47. data/app/models/lcms/engine/download.rb +3 -3
  48. data/app/models/lcms/engine/download_category.rb +1 -1
  49. data/app/models/lcms/engine/leadership_post.rb +1 -1
  50. data/app/models/lcms/engine/material.rb +2 -2
  51. data/app/models/lcms/engine/material_part.rb +1 -1
  52. data/app/models/lcms/engine/page.rb +1 -1
  53. data/app/models/lcms/engine/reading_assignment_author.rb +1 -1
  54. data/app/models/lcms/engine/reading_assignment_text.rb +1 -1
  55. data/app/models/lcms/engine/resource.rb +4 -12
  56. data/app/models/lcms/engine/resource_additional_resource.rb +1 -1
  57. data/app/models/lcms/engine/resource_download.rb +1 -1
  58. data/app/models/lcms/engine/resource_reading_assignment.rb +1 -1
  59. data/app/models/lcms/engine/resource_related_resource.rb +1 -1
  60. data/app/models/lcms/engine/resource_standard.rb +1 -1
  61. data/app/models/lcms/engine/search/elastic_search_document.rb +1 -1
  62. data/app/models/lcms/engine/settings.rb +1 -1
  63. data/app/models/lcms/engine/social_thumbnail.rb +1 -1
  64. data/app/models/lcms/engine/staff_member.rb +1 -1
  65. data/app/models/lcms/engine/standard.rb +1 -1
  66. data/app/models/lcms/engine/standard_link.rb +1 -1
  67. data/app/models/lcms/engine/user.rb +3 -3
  68. data/app/presenters/lcms/engine/content_presenter.rb +1 -1
  69. data/app/queries/lcms/engine/admin_documents_query.rb +1 -1
  70. data/app/queries/lcms/engine/admin_materials_query.rb +1 -1
  71. data/app/serializers/lcms/engine/association_item_serializer.rb +0 -1
  72. data/app/serializers/lcms/engine/curriculum_resource_serializer.rb +0 -2
  73. data/app/serializers/lcms/engine/document_material_serializer.rb +0 -1
  74. data/app/serializers/lcms/engine/material_serializer.rb +0 -1
  75. data/app/serializers/lcms/engine/previews_material_serializer.rb +0 -1
  76. data/app/serializers/lcms/engine/resource_details_serializer.rb +0 -2
  77. data/app/serializers/lcms/engine/resource_instruction_serializer.rb +0 -2
  78. data/app/serializers/lcms/engine/resource_picker_serializer.rb +0 -2
  79. data/app/serializers/lcms/engine/resource_serializer.rb +0 -2
  80. data/app/serializers/lcms/engine/search_document_serializer.rb +0 -2
  81. data/app/services/lcms/engine/document_build_service.rb +1 -0
  82. data/app/services/lcms/engine/html_sanitizer.rb +2 -2
  83. data/app/services/lcms/engine/s3_service.rb +1 -1
  84. data/app/uploaders/social_thumbnail_uploader.rb +0 -4
  85. data/app/views/layouts/lcms/engine/admin.html.erb +1 -1
  86. data/app/views/lcms/engine/admin/access_codes/index.html.erb +10 -8
  87. data/app/views/lcms/engine/admin/documents/index.html.erb +2 -2
  88. data/app/views/lcms/engine/admin/materials/index.html.erb +2 -2
  89. data/app/views/lcms/engine/admin/pages/index.html.erb +3 -3
  90. data/app/views/lcms/engine/admin/standards/index.html.erb +9 -7
  91. data/app/views/lcms/engine/admin/users/index.html.erb +16 -14
  92. data/app/views/lcms/engine/resources/_children_list.html.erb +1 -1
  93. data/app/views/lcms/engine/shared/_social_sharing_menu.html.erb +4 -4
  94. data/config/initializers/carrier_wave.rb +0 -1
  95. data/config/locales/admin/en.yml +0 -2
  96. data/db/migrate/20200422130652_add_reimported_at_to_documents.rb +7 -0
  97. data/lcms-engine.gemspec +73 -87
  98. data/lib/doc_template/document.rb +2 -2
  99. data/lib/doc_template/tables/activity.rb +2 -1
  100. data/lib/doc_template/tables/base.rb +0 -4
  101. data/lib/doc_template/tables/section.rb +2 -1
  102. data/lib/doc_template/tags/link_tag.rb +1 -1
  103. data/lib/doc_template/xpath_functions.rb +1 -3
  104. data/lib/document_exporter/base.rb +1 -2
  105. data/lib/document_exporter/docx.rb +0 -1
  106. data/lib/generators/lcms/engine/install/install_generator.rb +1 -4
  107. data/lib/generators/lcms/engine/install/templates/config/lcms.yml +1 -1
  108. data/lib/lcms/engine/engine.rb +0 -16
  109. data/lib/lcms/engine/migration.rb +2 -0
  110. data/lib/lcms/engine/version.rb +1 -1
  111. data/lib/lt/lcms/metadata/context.rb +7 -5
  112. data/spec/controllers/admin/admin_controller_spec.rb +1 -1
  113. data/spec/controllers/admin/association_picker_controller_spec.rb +2 -2
  114. data/spec/controllers/admin/curriculums_controller_spec.rb +1 -2
  115. data/spec/controllers/admin/documents_controller_spec.rb +12 -41
  116. data/spec/controllers/admin/materials_controller_spec.rb +7 -67
  117. data/spec/controllers/admin/pages_controller_spec.rb +2 -2
  118. data/spec/controllers/admin/resource_bulk_edit_controller_spec.rb +3 -3
  119. data/spec/controllers/admin/sketch_compilers_controller_spec.rb +5 -4
  120. data/spec/controllers/admin/standards_controller_spec.rb +12 -9
  121. data/spec/controllers/admin/users_controller_spec.rb +2 -2
  122. data/spec/controllers/admin/welcome_controller_spec.rb +1 -1
  123. data/spec/controllers/documents_controller_spec.rb +3 -3
  124. data/spec/controllers/enhance_instruction_controller_spec.rb +1 -1
  125. data/spec/controllers/explore_curriculum_controller_spec.rb +2 -2
  126. data/spec/controllers/find_lessons_controller_spec.rb +1 -1
  127. data/spec/controllers/pages_controller_spec.rb +9 -12
  128. data/spec/controllers/resources_controller_spec.rb +2 -2
  129. data/spec/controllers/search_controller_spec.rb +1 -1
  130. data/spec/dummy/bin/spring +2 -2
  131. data/spec/dummy/config/application.rb +3 -3
  132. data/spec/dummy/config/environments/test.rb +2 -5
  133. data/spec/dummy/config/lcms-admin.yml +3 -3
  134. data/spec/dummy/config/webpack/development.js +5 -0
  135. data/spec/dummy/config/webpack/environment.js +3 -0
  136. data/spec/dummy/config/webpack/production.js +5 -0
  137. data/spec/dummy/config/webpack/test.js +5 -0
  138. data/spec/dummy/config/webpacker.yml +96 -0
  139. data/spec/dummy/db/schema.rb +251 -275
  140. data/spec/factories/document_bundles.rb +1 -1
  141. data/spec/factories/standard_links.rb +2 -0
  142. data/spec/factories/taggings.rb +1 -0
  143. data/spec/models/document_bundle_spec.rb +0 -6
  144. data/spec/models/resource_spec.rb +0 -33
  145. data/spec/rails_helper.rb +0 -1
  146. data/spec/requests/admin/curriculum_spec.rb +17 -0
  147. data/spec/services/document_build_service_spec.rb +76 -62
  148. data/spec/services/html_sanitizer_spec.rb +0 -34
  149. data/spec/support/capybara.rb +1 -3
  150. data/spec/support/concerns/searchable.rb +2 -0
  151. data/spec/support/database_cleaner.rb +5 -16
  152. data/spec/support/devise.rb +2 -0
  153. data/yarn.lock +442 -530
  154. metadata +183 -439
  155. data/Gemfile.lock +0 -752
  156. data/config/initializers/active_record.rb +0 -3
  157. data/spec/controllers/admin/resources_controller_spec.rb +0 -84
  158. data/spec/fixtures/tables/activity-metadata-3activities.html +0 -1
  159. data/spec/fixtures/tables/document-metadata-2paragpraphs.html +0 -97
  160. data/spec/fixtures/tables/document-metadata-2spans.html +0 -96
  161. data/spec/fixtures/tables/document-metadata.html +0 -96
  162. data/spec/lib/doc_template/tables/activity_spec.rb +0 -28
  163. data/spec/lib/doc_template/tables/metadata_spec.rb +0 -40
  164. data/spec/lib/doc_template/tables/shared_examples/remove_table.rb +0 -11
  165. data/spec/support/fixture_helper.rb +0 -16
@@ -21,111 +21,97 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.required_ruby_version = '>= 2.5'
23
23
 
24
- s.add_dependency 'active_model_serializers', '~> 0.9.3'
24
+ s.add_dependency 'active_model_serializers', '~> 0.10.10'
25
25
  s.add_dependency 'activejob-retry', '~> 0.6.3'
26
- s.add_dependency 'acts-as-taggable-on', '~> 5.0'
27
- s.add_dependency 'acts_as_list', '~> 0.9.10'
28
- s.add_dependency 'addressable', '~> 2.5.1'
29
- s.add_dependency 'airbrake', ' ~> 10'
30
- s.add_dependency 'autoprefixer-rails', '~> 6.4.0'
31
- s.add_dependency 'aws-sdk-rails', '~> 1.0'
32
- s.add_dependency 'backport_new_renderer', '~> 1.0.0'
33
- s.add_dependency 'bigdecimal', '~> 1.4' # Required to handle BigDecimal.new Rails 4 issue
34
- s.add_dependency 'bitly', '~> 1.0'
26
+ s.add_dependency 'acts-as-taggable-on', '~> 6.5.0'
27
+ s.add_dependency 'acts_as_list', '~> 1.0.0'
28
+ s.add_dependency 'addressable', '~> 2.7.0'
29
+ s.add_dependency 'airbrake', '~> 10.0.1'
30
+ s.add_dependency 'autoprefixer-rails', '~> 9.7.4'
31
+ s.add_dependency 'aws-sdk-rails', '~> 3.1'
32
+ s.add_dependency 'aws-sdk-s3', '~> 1'
33
+ s.add_dependency 'bitly', '~> 1.1.2'
35
34
  s.add_dependency 'bootstrap-sass', '~> 3.4.1'
36
- s.add_dependency 'bullet', '~> 5.7.3'
37
- s.add_dependency 'carrierwave', '~> 1'
38
- s.add_dependency 'ckeditor', '~> 4'
39
- s.add_dependency 'closure_tree', '~> 7'
40
- s.add_dependency 'coffee-rails', '~> 4.1.1'
41
- s.add_dependency 'combine_pdf', '~> 1.0.15'
42
- s.add_dependency 'daemons', '~> 1.2', '>= 1.2.3'
43
- s.add_dependency 'devise', '~> 4'
44
- s.add_dependency 'elasticsearch-dsl', '~> 0.1.6'
45
- s.add_dependency 'elasticsearch-model', '~> 6.0'
46
- s.add_dependency 'elasticsearch-persistence', '~> 6.0'
47
- s.add_dependency 'elasticsearch-rails', '~> 6.0'
48
- s.add_dependency 'fog-aws', '~> 2.0'
49
- s.add_dependency 'font-awesome-sass', '~> 4.7.0'
50
- s.add_dependency 'foreman', '~> 0.78.0'
51
- s.add_dependency 'foundation-rails', '~> 6.2.1'
52
- s.add_dependency 'google-api-client', '~> 0.30'
53
- s.add_dependency 'heap', '~> 1.0'
54
- s.add_dependency 'hiredis', '~> 0.6'
55
- s.add_dependency 'httparty', '~> 0.16'
56
- s.add_dependency 'jbuilder', '~> 2.0'
57
- s.add_dependency 'jquery-rails', '~> 4.3'
58
- s.add_dependency 'js-routes', '~> 1.1.2'
59
- s.add_dependency 'lt-google-api', '~> 0.1'
60
- s.add_dependency 'lt-lcms', '~> 0.3.0'
61
- s.add_dependency 'migration_data', '~> 0.2.1'
62
- s.add_dependency 'mini_magick', '~> 4.9', '>= 4.9.4'
63
- s.add_dependency 'nested_form', '~> 0.3'
64
- s.add_dependency 'newrelic_rpm', '~> 6.9'
35
+ s.add_dependency 'bullet', '~> 6.1.0'
36
+ s.add_dependency 'carrierwave', '~> 2.1.0'
37
+ s.add_dependency 'ckeditor', '~> 4.3.0'
38
+ s.add_dependency 'closure_tree', '~> 7.1.0'
39
+ s.add_dependency 'combine_pdf', '~> 1.0.16'
40
+ s.add_dependency 'daemons', '~> 1.3.1'
41
+ s.add_dependency 'devise', '~> 4.7.1'
42
+ s.add_dependency 'elasticsearch-dsl', '~> 0.1.9'
43
+ s.add_dependency 'elasticsearch-model', '~> 7.0.0'
44
+ s.add_dependency 'elasticsearch-persistence', '~> 7.0.0'
45
+ s.add_dependency 'elasticsearch-rails', '~> 7.0.0'
46
+ s.add_dependency 'fog-aws', '~> 3.5.2'
47
+ s.add_dependency 'font-awesome-sass', '~> 5.12.0'
48
+ s.add_dependency 'foundation-rails', '~> 6.6.1.0'
49
+ s.add_dependency 'google-api-client', '~> 0.37.1'
50
+ s.add_dependency 'heap', '~> 1'
51
+ s.add_dependency 'hiredis', '~> 0.6.3'
52
+ s.add_dependency 'httparty', '~> 0.18.0'
53
+ s.add_dependency 'jbuilder', '~> 2.10.0'
54
+ s.add_dependency 'jquery-rails', '~> 4.3.5'
55
+ s.add_dependency 'js-routes', '~> 1.4.9'
56
+ s.add_dependency 'lt-google-api', '~> 0.1.1'
57
+ s.add_dependency 'lt-lcms', '~> 0.2.0'
58
+ s.add_dependency 'migration_data', '~> 0.6.0'
59
+ s.add_dependency 'mini_magick', '~> 4.10.1'
60
+ s.add_dependency 'nested_form', '~> 0.3.2'
65
61
  s.add_dependency 'nikkou', '~> 0.0.5'
66
- s.add_dependency 'nokogiri', '~> 1.10', '>= 1.10.4'
67
- s.add_dependency 'oj', '3.10.8'
62
+ s.add_dependency 'nokogiri', '~> 1.10.8'
63
+ s.add_dependency 'oj', '~> 3.10.2'
68
64
  s.add_dependency 'oj_mimic_json', '~> 1.0.1'
69
- s.add_dependency 'pandoc-ruby', '~> 2.0.1'
70
- s.add_dependency 'pdfjs_viewer-rails', '~> 0.0.9'
71
- s.add_dependency 'pg', '0.20'
72
- s.add_dependency 'pg_search', '~> 2.1'
73
- s.add_dependency 'postgres_ext', '~> 3.0'
74
- s.add_dependency 'rack-mini-profiler', '~> 2'
75
- s.add_dependency 'rails', '~> 4.2.11'
76
- s.add_dependency 'rails-assets-classnames', '~> 2.2.3'
77
- s.add_dependency 'rails-assets-es6-promise', '~> 3.1.2'
78
- s.add_dependency 'rails-assets-eventemitter3', '~> 1.2.0'
79
- s.add_dependency 'rails-assets-fetch', '~> 0.11.0'
80
- s.add_dependency 'rails-assets-jstree', '~> 3.3.4'
81
- s.add_dependency 'rails-assets-knockout', '~> 3.3.0'
82
- s.add_dependency 'rails-assets-lodash', '~> 4.17.11'
83
- s.add_dependency 'rails-assets-selectize', '~> 0.12.1'
84
- s.add_dependency 'ransack', '~> 1.7.0'
85
- s.add_dependency 'react-rails', '~> 2.6.0'
86
- s.add_dependency 'readthis', '~> 2'
87
- s.add_dependency 'redis', '< 4'
88
- s.add_dependency 'resque', '~> 2'
89
- s.add_dependency 'resque-scheduler', '~> 4.4'
90
- s.add_dependency 'rest-client', '~> 2.1'
91
- s.add_dependency 'ruby-progressbar', '~> 1.7', '>= 1.7.5'
65
+ s.add_dependency 'pandoc-ruby', '~> 2.0.2'
66
+ s.add_dependency 'pdfjs_viewer-rails', '~> 0.3.1'
67
+ s.add_dependency 'pg', '~> 1.2.2'
68
+ s.add_dependency 'pg_search', '~> 2.3.2'
69
+ s.add_dependency 'rack-mini-profiler', '~> 1.1.6'
70
+ s.add_dependency 'rails', '~> 5.2.4'
71
+ s.add_dependency 'rails-assets-classnames', '~> 2.2.5'
72
+ s.add_dependency 'rails-assets-es6-promise', '~> 4.2.4'
73
+ s.add_dependency 'rails-assets-eventemitter3', '~> 3.1.2'
74
+ s.add_dependency 'rails-assets-fetch', '~> 3.0.0'
75
+ s.add_dependency 'rails-assets-jstree', '~> 3.3.8'
76
+ s.add_dependency 'rails-assets-knockout', '~> 3.5.0'
77
+ s.add_dependency 'rails-assets-lodash', '~> 4.17.15'
78
+ s.add_dependency 'rails-assets-selectize', '~> 0.12.6'
79
+ s.add_dependency 'ransack', '~> 2.3.2'
80
+ s.add_dependency 'react-rails', '~> 2.6.1'
81
+ s.add_dependency 'redis', '~> 4.1.3'
82
+ s.add_dependency 'resque', '~> 2.0.0'
83
+ s.add_dependency 'resque-scheduler', '~> 4.4.0'
84
+ s.add_dependency 'rest-client', '~> 2.1.0'
85
+ s.add_dependency 'ruby-progressbar', '~> 1.10.1'
92
86
  s.add_dependency 'rubyzip', '~> 2'
93
- s.add_dependency 'sanitize', '>= 5.1', '< 5.3'
94
- s.add_dependency 'sass-rails', '~> 5.0'
95
- s.add_dependency 'simple_form', '~> 3.5'
96
- s.add_dependency 'staccato', '~> 0.4.7'
97
- s.add_dependency 'thor', '0.19.1'
87
+ s.add_dependency 'sanitize', '~> 5.1.0'
88
+ s.add_dependency 'sass-rails', '~> 5.1.0'
89
+ s.add_dependency 'simple_form', '~> 5.0.2'
90
+ s.add_dependency 'staccato', '~> 0.5.3'
98
91
  s.add_dependency 'truncate_html', '~> 0.9.3'
99
- s.add_dependency 'turbolinks', '~> 5.1.0'
100
- s.add_dependency 'uglifier', '~> 3.0', '>= 3.0.4'
101
- s.add_dependency 'validate_url', '~> 1.0'
92
+ s.add_dependency 'turbolinks', '~> 5.2.1'
93
+ s.add_dependency 'validate_url', '~> 1.0.8'
102
94
  s.add_dependency 'virtus', '~> 1.0.5'
103
- s.add_dependency 'will_paginate', '~> 3.0.7'
104
- s.add_dependency 'will_paginate-bootstrap', '~> 1'
95
+ s.add_dependency 'will_paginate', '~> 3.2.1'
96
+ s.add_dependency 'will_paginate-bootstrap', '~> 1.0.2'
105
97
 
106
- s.add_development_dependency 'capybara-screenshot', '~> 1'
107
- s.add_development_dependency 'database_cleaner', '~> 1'
98
+ s.add_development_dependency 'capybara', '~> 3.31'
99
+ s.add_development_dependency 'database_cleaner-active_record', '~> 1.8'
108
100
  s.add_development_dependency 'dotenv-rails', '~> 2.2'
109
101
  s.add_development_dependency 'email_spec', '~> 2.1'
110
102
  s.add_development_dependency 'factory_bot', '~> 5'
111
103
  s.add_development_dependency 'faker', '~> 2.1'
112
- s.add_development_dependency 'guard-livereload', '~> 2.5', '>= 2.5.2'
113
- s.add_development_dependency 'mailcatcher', '~> 0.7'
114
104
  s.add_development_dependency 'overcommit', '~> 0.49.1'
115
105
  s.add_development_dependency 'pry-byebug', '~> 3.7'
116
106
  s.add_development_dependency 'pry-rails', '~> 0.3.5'
117
- s.add_development_dependency 'puma', '~> 4', '>= 4.3.5'
118
- s.add_development_dependency 'quiet_assets', '~> 1.1'
119
- s.add_development_dependency 'rack-livereload', '~> 0.3.16'
120
107
  s.add_development_dependency 'rspec-rails', '~> 3.8'
121
108
  s.add_development_dependency 'rubocop', '~> 0.59.2'
122
- s.add_development_dependency 'safe_attributes', '~> 1.0.10'
123
- s.add_development_dependency 'sdoc', '~> 0.4.0'
124
- s.add_development_dependency 'seedbank', '~> 0.3'
125
- s.add_development_dependency 'selenium-webdriver', '~> 3.142', '>= 3.142.7'
109
+ s.add_development_dependency 'sdoc', '~> 1.1'
110
+ s.add_development_dependency 'selenium-webdriver', '~> 3.142'
126
111
  s.add_development_dependency 'shoulda-matchers', '~> 4.1'
127
112
  s.add_development_dependency 'spring', '~> 2.1'
128
- s.add_development_dependency 'spring-commands-rspec', '~> 1'
113
+ s.add_development_dependency 'spring-commands-rspec', '~> 1.0'
129
114
  s.add_development_dependency 'traceroute', '~> 0.8'
130
- s.add_development_dependency 'webpacker', '~> 4.0.6'
115
+ s.add_development_dependency 'webdrivers', '~> 4.0'
116
+ s.add_development_dependency 'webpacker', '~> 4.0'
131
117
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DocTemplate
4
4
  class Document
5
- MAX_PARSE_ITERATIONS = 300
5
+ MAX_PARSE_ITERATIONS = 100
6
6
 
7
7
  # Contains the list of tags for which no parts should be created
8
8
  TAGS_WITHOUT_PARTS = [
@@ -178,7 +178,7 @@ module DocTemplate
178
178
 
179
179
  parts << {
180
180
  anchor: parsed_tag.anchor.to_s,
181
- content: parsed_tag.try(:without_squish?) ? sanitized_content : sanitized_content.squish,
181
+ content: sanitized_content.squish,
182
182
  context_type: @opts[:context_type],
183
183
  data: parsed_tag.tag_data,
184
184
  materials: parsed_tag.materials,
@@ -10,9 +10,10 @@ module DocTemplate
10
10
 
11
11
  def parse(fragment, *args)
12
12
  template_type = args.extract_options![:template_type].presence || 'core'
13
+ path = ".//table/*/tr[1]/td//*[case_insensitive_equals(text(),'#{HEADER_LABEL}')]"
13
14
  idx = 0
14
15
  [].tap do |result|
15
- fragment.xpath(xpath_meta_headers, XpathFunctions.new).each do |el|
16
+ fragment.xpath(path, XpathFunctions.new).each do |el|
16
17
  table = el.ancestors('table').first
17
18
  data = fetch table
18
19
 
@@ -132,10 +132,6 @@ module DocTemplate
132
132
  end
133
133
  end
134
134
  end
135
-
136
- def xpath_meta_headers
137
- ".//table/*/tr[1]/td[1][case_insensitive_equals(normalize-space(),'#{self.class::HEADER_LABEL}')]"
138
- end
139
135
  end
140
136
  end
141
137
  end
@@ -9,7 +9,8 @@ module DocTemplate
9
9
  MATERIALS_KEY = 'section-materials'
10
10
 
11
11
  def parse(fragment, *args)
12
- section_tables = fragment.xpath(xpath_meta_headers, XpathFunctions.new)
12
+ path = ".//table/*/tr[1]/td//*[case_insensitive_equals(text(),'#{HEADER_LABEL}')]"
13
+ section_tables = fragment.xpath(path, XpathFunctions.new)
13
14
 
14
15
  # # Allows to handle ELA as Math:: inject fake section
15
16
  return fake_section(fragment) if section_tables.empty? && args.extract_options![:force_inject]
@@ -24,7 +24,7 @@ module DocTemplate
24
24
  label = text.present? ? "<b>#{text}</b>" : ''
25
25
  href = build_href(title, opts[:metadata])
26
26
 
27
- "<a href=\"#{href}\" target=\"_blank\" title=\"#{title}\"><i class=\"fa fa-book\"></i> #{label}</a>"
27
+ "<a href=\"#{href}\" target=\"_blank\" title=\"#{title}\"><i class=\"fas fa-book\"></i> #{label}</a>"
28
28
  end
29
29
 
30
30
  def build_href(title, metadata)
@@ -3,9 +3,7 @@
3
3
  module DocTemplate
4
4
  class XpathFunctions
5
5
  def case_insensitive_equals(node_set, str_to_match)
6
- return node_set.to_s.squish.casecmp(str_to_match).zero? if node_set.is_a?(String)
7
-
8
- node_set.find_all { |node| node.to_s.squish.casecmp(str_to_match).zero? }
6
+ node_set.find_all { |node| node.to_s.casecmp(str_to_match).zero? }
9
7
  end
10
8
 
11
9
  def case_insensitive_contains(node_set, str_to_match)
@@ -50,11 +50,10 @@ module DocumentExporter
50
50
 
51
51
  def render_template(path, layout:)
52
52
  field = path.starts_with?('/') ? :file : :template
53
- # Using backport of Rails 5 Renderer here
54
53
  Lcms::Engine::ApplicationController.render(
55
54
  field => path,
56
55
  layout: layout,
57
- locals: { document: @document, options: @options }
56
+ assigns: { document: @document, options: @options }
58
57
  )
59
58
  end
60
59
 
@@ -15,7 +15,6 @@ module DocumentExporter
15
15
  private
16
16
 
17
17
  def content
18
- # Using backport of Rails 5 Renderer here
19
18
  @content ||= ApplicationController.render(
20
19
  layout: 'ld_docx',
21
20
  locals: { :@document => @document },
@@ -13,13 +13,10 @@ module Lcms
13
13
  end
14
14
 
15
15
  def update_gemfile
16
- # Rails-assets.org is needed to fetch required gems (rails-assets-*)
17
- add_source 'https://rails-assets.org'
18
-
19
16
  # Required by lcms-engine because of unpublished gems are not automatically installed with the parent gem
20
17
  gem 'wicked_pdf', git: 'https://github.com/learningtapestry/wicked_pdf.git',
21
18
  branch: 'puppeteer-support',
22
- ref: 'c807f6b4'
19
+ ref: '964a090'
23
20
  end
24
21
  end
25
22
  end
@@ -48,4 +48,4 @@ sanitizer: '::Lcms::Engine::HtmlSanitizer'
48
48
  # material_preview_job:
49
49
 
50
50
  queries:
51
- document: 'AdminDocumentsQuery'
51
+ document: '::Lcms::Engine::AdminDocumentsQuery'
@@ -3,7 +3,6 @@
3
3
  require 'active_job'
4
4
  require 'acts-as-taggable-on'
5
5
  require 'active_model_serializers'
6
- require 'backport_new_renderer'
7
6
  require 'carrierwave'
8
7
  require 'carrierwave/orm/activerecord'
9
8
  require 'closure_tree'
@@ -131,21 +130,6 @@ module Lcms
131
130
  )
132
131
  end
133
132
 
134
- ENABLE_CACHING = ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(
135
- ENV.fetch('ENABLE_CACHING', true)
136
- )
137
-
138
- if ENABLE_CACHING
139
- redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379')
140
- config.cache_store = :readthis_store, {
141
- expires_in: 1.hour.to_i,
142
- namespace: 'unbounded',
143
- redis: { url: redis_url, driver: :hiredis }
144
- }
145
- else
146
- config.cache_store = :null_store
147
- end
148
-
149
133
  # NOTE: Sample to customize the layout
150
134
  # config.to_prepare do
151
135
  # Devise::SessionsController.layout "layout_for_sessions_controller"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'version'
4
+
3
5
  module Lcms
4
6
  module Engine
5
7
  if Rails::VERSION::MAJOR >= 5
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lcms
4
4
  module Engine
5
- VERSION = '0.1.4'
5
+ VERSION = '0.2.0'
6
6
  RAILS_5_VERSION = 5.2
7
7
  end
8
8
  end
@@ -17,11 +17,11 @@ module Lt
17
17
  # Is used inside `#find_or_create_resource` method
18
18
  #
19
19
  def update_grades_level_position_for(grades)
20
- update_level_position_for(grades) { |g| ::Lcms::Engine::Grades::GRADES.index(g.metadata['grade']) }
20
+ update_level_position_for(grades) { |m| ::Lcms::Engine::Grades::GRADES.index(m.metadata['grade']) }
21
21
  end
22
22
 
23
23
  #
24
- # Fix level position for modules
24
+ # Fix level position for modules (guidebooks)
25
25
  # Is used inside `#find_or_create_resource` method
26
26
  #
27
27
  def update_modules_level_position_for(modules)
@@ -30,11 +30,11 @@ module Lt
30
30
  end
31
31
 
32
32
  #
33
- # Fix level position for units
33
+ # Fix level position for units (sections)
34
34
  # Is used inside `#find_or_create_resource` method
35
35
  #
36
36
  def update_units_level_position_for(units)
37
- update_level_position_for(units) { |u| u.metadata['unit'][NUM_RE].to_i }
37
+ update_level_position_for(units) { |m| m.metadata['unit'][NUM_RE].to_i }
38
38
  end
39
39
 
40
40
  #
@@ -103,6 +103,8 @@ module Lt
103
103
  else
104
104
  set_lesson_position(parent, resource)
105
105
  end
106
+
107
+ parent = resource
106
108
  end
107
109
 
108
110
  update resource
@@ -290,7 +292,7 @@ module Lt
290
292
  def set_lesson_position(parent, resource)
291
293
  next_lesson = parent.children.detect do |r|
292
294
  # first lesson with a bigger lesson num
293
- r.metadata['lesson'].to_s[NUM_RE].to_i > context[:lesson].to_s[NUM_RE].to_i
295
+ r.lesson_number > context[:lesson].to_i
294
296
  end
295
297
  next_lesson ? next_lesson.prepend_sibling(resource) : resource.save!
296
298
  end
@@ -10,7 +10,7 @@ describe Lcms::Engine::Admin::AdminController do
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
 
@@ -13,8 +13,8 @@ describe Lcms::Engine::Admin::AssociationPickerController do
13
13
  describe '#index' do
14
14
  ASSOCIATIONS.each do |assoc|
15
15
  it "list #{assoc} association items" do
16
- get :index, association: assoc, format: :json
17
- expect(response).to be_success
16
+ get :index, params: { association: assoc, format: :json }
17
+ expect(response).to be_successful
18
18
  end
19
19
  end
20
20
  end
@@ -10,7 +10,6 @@ describe Lcms::Engine::Admin::CurriculumsController do
10
10
  describe '#edit' do
11
11
  subject { get :edit }
12
12
 
13
- it { is_expected.to be_success }
14
- it { is_expected.to render_template :edit }
13
+ it { is_expected.to be_successful }
15
14
  end
16
15
  end
@@ -8,15 +8,18 @@ describe Lcms::Engine::Admin::DocumentsController do
8
8
  before { sign_in user }
9
9
 
10
10
  describe '#create' do
11
+ let(:credentials) { double }
11
12
  let(:document) { create :document }
12
13
  let(:form) { instance_double('Lcms::Engine::DocumentForm', document: document, save: valid) }
13
- let(:link) { 'link' }
14
- let(:params) { { link: link, link_fs: 'link_fs', reimport: '1' } }
14
+ let(:params) { { link: 'link', link_fs: 'link_fs', reimport: '1' } }
15
15
  let(:valid) { true }
16
16
 
17
- before { allow(Lcms::Engine::DocumentForm).to receive(:new).and_return(form) }
17
+ before do
18
+ # allow(controller).to receive(:google_credentials).and_return(credentials)
19
+ allow(Lcms::Engine::DocumentForm).to receive(:new).and_return(form)
20
+ end
18
21
 
19
- subject { post :create, document_form: params }
22
+ subject { post :create, params: { document_form: params } }
20
23
 
21
24
  it 'creates DocumentForm object' do
22
25
  expect(Lcms::Engine::DocumentForm).to receive(:new).with(params)
@@ -28,51 +31,18 @@ describe Lcms::Engine::Admin::DocumentsController do
28
31
  expect(response).to redirect_to Lcms::Engine::Admin::AdminController.document_path(document)
29
32
  end
30
33
 
31
- context 'when there is an error' do
34
+ # TODO: Rails upgrade - move to system spec
35
+ xcontext 'when there is an error' do
32
36
  let(:valid) { false }
33
37
 
34
38
  it { is_expected.to render_template :new }
35
39
  end
36
-
37
- context 'when a link to Google Documents folder passed in' do
38
- let(:credentials) { double }
39
- let(:file_ids) { ['file_id'] }
40
- let(:folder_id) { 'folder_id' }
41
- let(:link) { 'https://drive.google.com/drive/u/x/folders/fkjsdhfjkshfkjsdhf' }
42
-
43
- before do
44
- allow(controller).to receive(:google_credentials).and_return(credentials)
45
- allow(::Lt::Google::Api::Drive).to \
46
- receive(:folder_id_for).with(link).and_return(folder_id)
47
- allow(::Lt::Google::Api::Drive).to \
48
- receive_message_chain(:new, :list_file_ids_in, :map).and_return(file_ids)
49
- end
50
-
51
- it 'calls batch reimport' do
52
- expect(Lcms::Engine::DocumentGenerator).to \
53
- receive_message_chain(:document_parse_job, :perform_later).and_return(OpenStruct.new(job_id: 0))
54
- subject
55
- end
56
-
57
- it 'renders import template' do
58
- expect(subject).to render_template :import
59
- end
60
-
61
- context 'and when there are no documents' do
62
- let(:file_ids) { [] }
63
-
64
- it 'shows the message' do
65
- subject
66
- expect(flash[:alert]).to eq I18n.t('lcms.engine.admin.documents.create.empty_folder')
67
- end
68
- end
69
- end
70
40
  end
71
41
 
72
42
  describe '#destroy' do
73
43
  let!(:document) { create :document }
74
44
 
75
- subject { delete :destroy, id: document.id }
45
+ subject { delete :destroy, params: { id: document.id } }
76
46
 
77
47
  it 'deletes the document' do
78
48
  expect { subject }.to change(Lcms::Engine::Document, :count).by(-1)
@@ -87,6 +57,7 @@ describe Lcms::Engine::Admin::DocumentsController do
87
57
  subject
88
58
  end
89
59
 
90
- it { is_expected.to render_template :new }
60
+ # TODO: Rails upgrade - move to system spec
61
+ xit { is_expected.to render_template :new }
91
62
  end
92
63
  end