lcms-engine 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.dockerignore +25 -0
- data/.env.docker +1 -1
- data/.eslintignore +2 -1
- data/.eslintrc +23 -73
- data/.nvmrc +1 -1
- data/.overcommit.yml +8 -2
- data/.prettierrc +7 -0
- data/.rubocop.yml +12 -8
- data/.ruby-version +1 -1
- data/.stylelintignore +9 -0
- data/.stylelintrc +8 -0
- data/CHANGELOG.md +50 -1
- data/Dockerfile +3 -3
- data/Gemfile.lock +408 -322
- data/README.md +20 -17
- data/app/assets/config/lcms_engine_manifest.js +4 -2
- data/app/assets/javascripts/lcms/engine/admin/{application.js → lcms_engine_application.js} +1 -3
- data/app/assets/javascripts/lcms/engine/initializers/foundation.js +1 -1
- data/app/assets/javascripts/lcms/engine/{application.js → lcms_engine_application.js} +0 -0
- data/app/assets/stylesheets/lcms/engine/admin/collections.scss +2 -1
- data/app/assets/stylesheets/lcms/engine/admin/components.scss +60 -19
- data/app/assets/stylesheets/lcms/engine/admin/curriculums.scss +12 -10
- data/app/assets/stylesheets/lcms/engine/admin/lessons.scss +21 -15
- data/app/assets/stylesheets/lcms/engine/admin/materials.scss +25 -17
- data/app/assets/stylesheets/lcms/engine/admin/resources.scss +8 -7
- data/app/assets/stylesheets/lcms/engine/admin/standards.scss +4 -1
- data/app/assets/stylesheets/lcms/engine/admin/users.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/base/_colors.scss +8 -10
- data/app/assets/stylesheets/lcms/engine/base/_ld-colors.scss +10 -10
- data/app/assets/stylesheets/lcms/engine/components/_assoc-picker.scss +4 -5
- data/app/assets/stylesheets/lcms/engine/components/lesson/_activity.scss +6 -2
- data/app/assets/stylesheets/lcms/engine/components/lesson/_callout.scss +19 -5
- data/app/assets/stylesheets/lcms/engine/components/lesson/_columns.scss +4 -3
- data/app/assets/stylesheets/lcms/engine/components/lesson/_curriculum-map.scss +16 -7
- data/app/assets/stylesheets/lcms/engine/components/lesson/_def.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/components/lesson/_expand.scss +9 -9
- data/app/assets/stylesheets/lcms/engine/components/lesson/_foundational-divider.scss +0 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_group.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_icons.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_image-wrap.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/components/lesson/_inset.scss +7 -2
- data/app/assets/stylesheets/lcms/engine/components/lesson/_materials.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_multiple-choice.scss +4 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_override.scss +28 -9
- data/app/assets/stylesheets/lcms/engine/components/lesson/_pd.scss +7 -7
- data/app/assets/stylesheets/lcms/engine/components/lesson/_pv.scss +5 -4
- data/app/assets/stylesheets/lcms/engine/components/lesson/_section.scss +10 -3
- data/app/assets/stylesheets/lcms/engine/components/lesson/_selection-control.scss +14 -8
- data/app/assets/stylesheets/lcms/engine/components/lesson/_sidebar.scss +25 -10
- data/app/assets/stylesheets/lcms/engine/components/lesson/_title.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/components/lesson/_unit-map.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/material/_material.scss +3 -3
- data/app/assets/stylesheets/lcms/engine/components/material/_overlay.scss +12 -4
- data/app/assets/stylesheets/lcms/engine/components/material/_preview.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/support/_survey.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/layout/_footer.scss +29 -11
- data/app/assets/stylesheets/lcms/engine/layout/_header.scss +5 -5
- data/app/assets/stylesheets/lcms/engine/layout/_navigation.scss +4 -6
- data/app/assets/stylesheets/lcms/engine/layout/_page.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/{admin.scss → lcms_engine_admin.scss} +26 -15
- data/app/assets/stylesheets/lcms/engine/lcms_engine_application.scss +9 -0
- data/app/assets/stylesheets/lcms/engine/pdf.scss +5 -26
- data/app/assets/stylesheets/lcms/engine/pdf_plain.scss +5 -23
- data/app/assets/stylesheets/lcms/engine/print/_base.scss +41 -12
- data/app/assets/stylesheets/lcms/engine/print/_cover.scss +12 -12
- data/app/assets/stylesheets/lcms/engine/print/_footer.scss +8 -3
- data/app/assets/stylesheets/lcms/engine/print/_gdoc-base.scss +10 -37
- data/app/assets/stylesheets/lcms/engine/print/_helpers.scss +5 -2
- data/app/assets/stylesheets/lcms/engine/print/_lesson-base.scss +2 -14
- data/app/assets/stylesheets/lcms/engine/print/_material-base.scss +1 -3
- data/app/assets/stylesheets/lcms/engine/print/_print.scss +15 -8
- data/app/assets/stylesheets/lcms/engine/print/_toc.scss +24 -9
- data/app/assets/stylesheets/lcms/engine/print/gdoc/_base-typography.scss +24 -6
- data/app/assets/stylesheets/lcms/engine/print/gdoc/_base.scss +10 -3
- data/app/assets/stylesheets/lcms/engine/print/gdoc/_colors.scss +3 -3
- data/app/assets/stylesheets/lcms/engine/print/gdoc/_header.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/print/gdoc/_helpers.scss +1 -0
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_activity.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_agenda.scss +8 -2
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_callout.scss +16 -6
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_def.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_dialogue.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_expand.scss +5 -2
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_image-wrap.scss +5 -3
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_image.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_optbreak.scss +1 -0
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_section.scss +4 -1
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_smp.scss +1 -0
- data/app/assets/stylesheets/lcms/engine/print/gdoc/lesson/_tables.scss +11 -3
- data/app/assets/stylesheets/lcms/engine/print/gdoc/material/_header.scss +5 -2
- data/app/assets/stylesheets/lcms/engine/print/lesson/_base-typography.scss +33 -9
- data/app/assets/stylesheets/lcms/engine/print/lesson/_group.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/print/lesson/_image.scss +3 -1
- data/app/assets/stylesheets/lcms/engine/print/lesson/_materials.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/print/lesson/_pd.scss +8 -4
- data/app/assets/stylesheets/lcms/engine/print/lesson/_section.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/print/material/_header.scss +4 -1
- data/app/assets/stylesheets/lcms/engine/themes/_material.scss +11 -11
- data/app/assets/stylesheets/lcms/engine/utils/_colorcodes.scss +15 -5
- data/app/assets/stylesheets/lcms/engine/utils/_functions.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/utils/_helpers.scss +23 -11
- data/app/assets/stylesheets/lcms/engine/utils/_placeholders.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/utils/_variables.scss +11 -11
- data/app/assets/stylesheets/lcms/engine/vendors/{mathjax.css → mathjax.scss} +0 -0
- data/app/assets/stylesheets/lcms/engine/vendors/react-tagsinput.css +48 -0
- data/app/controllers/concerns/lcms/engine/reimportable.rb +12 -2
- data/app/controllers/lcms/engine/admin/access_codes_controller.rb +8 -3
- data/app/controllers/lcms/engine/admin/admin_controller.rb +6 -40
- data/app/controllers/lcms/engine/admin/association_picker_controller.rb +4 -1
- data/app/controllers/lcms/engine/admin/batch_reimports_controller.rb +2 -2
- data/app/controllers/lcms/engine/admin/curriculums_controller.rb +21 -2
- data/app/controllers/lcms/engine/admin/documents_controller.rb +41 -14
- data/app/controllers/lcms/engine/admin/materials_controller.rb +32 -13
- data/app/controllers/lcms/engine/admin/resource_bulk_edits_controller.rb +2 -2
- data/app/controllers/lcms/engine/admin/resources_controller.rb +9 -7
- data/app/controllers/lcms/engine/admin/settings_controller.rb +1 -1
- data/app/controllers/lcms/engine/admin/standards_controller.rb +7 -2
- data/app/controllers/lcms/engine/admin/users_controller.rb +15 -7
- data/app/controllers/lcms/engine/application_controller.rb +1 -1
- data/app/controllers/lcms/engine/resources_controller.rb +5 -5
- data/app/controllers/lcms/engine/welcome_controller.rb +11 -0
- data/app/entities/lcms/engine/grades.rb +17 -6
- data/app/entities/lcms/engine/hierarchical_position.rb +1 -2
- data/app/entities/lcms/engine/media_embed.rb +2 -2
- data/app/entities/lcms/engine/pagination.rb +14 -10
- data/app/entities/lcms/engine/roman_numerals.rb +2 -2
- data/app/exceptions/lcms/engine/document_error.rb +8 -0
- data/app/exceptions/lcms/engine/material_error.rb +8 -0
- data/app/forms/lcms/engine/document_form.rb +19 -14
- data/app/forms/lcms/engine/material_form.rb +3 -2
- data/app/helpers/admin/components_helper.rb +3 -3
- data/app/helpers/lcms/engine/path_helper.rb +32 -0
- data/app/helpers/lcms/engine/resource_helper.rb +1 -1
- data/app/helpers/lcms/engine/view_helper.rb +1 -9
- data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +2 -2
- data/app/javascript/components/admin/ImportStatus.jsx +90 -56
- data/app/javascript/components/admin/Initializer.jsx +33 -35
- data/app/javascript/components/admin/MultiSelectedOperation.jsx +43 -18
- data/app/javascript/components/admin/association-picker/AssociationPicker.jsx +68 -47
- data/app/javascript/components/admin/association-picker/AssociationPickerItem.jsx +18 -7
- data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +42 -17
- data/app/javascript/components/admin/association-picker/AssociationPickerWindow.jsx +47 -27
- data/app/javascript/components/admin/curriculum/CurriculumEditor.jsx +54 -32
- data/app/javascript/components/admin/curriculum/DirectoryPicker.jsx +80 -53
- data/app/javascript/components/admin/picker/PickerButton.jsx +16 -11
- data/app/javascript/components/admin/picker/pickerModal.jsx +6 -6
- data/app/javascript/components/admin/picker/pickerWindowWrapper.jsx +61 -40
- data/app/javascript/components/admin/resource-picker/ResourcePicker.jsx +54 -39
- data/app/javascript/components/admin/resource-picker/ResourcePickerResource.jsx +14 -3
- data/app/javascript/components/admin/resource-picker/ResourcePickerWindow.jsx +50 -21
- data/app/javascript/components/paginate/PageView.jsx +20 -8
- data/app/javascript/components/paginate/PaginationBoxView.jsx +78 -66
- data/app/javascript/components/paginate/PaginationListView.jsx +59 -45
- data/app/javascript/packs/lcms_engine_admin.js +15 -0
- data/app/javascript/packs/{application.js → lcms_engine_application.js} +5 -4
- data/app/javascript/packs/server_rendering.js +1 -0
- data/app/javascript/vendor/jstree/jstree.min.js +6 -0
- data/app/javascript/vendor/jstree/themes/default/32px.png +0 -0
- data/app/javascript/vendor/jstree/themes/default/40px.png +0 -0
- data/app/javascript/vendor/jstree/themes/default/style.css +1106 -0
- data/app/javascript/vendor/jstree/themes/default/style.min.css +1 -0
- data/app/javascript/vendor/jstree/themes/default/throbber.gif +0 -0
- data/app/javascript/vendor/jstree/themes/default-dark/32px.png +0 -0
- data/app/javascript/vendor/jstree/themes/default-dark/40px.png +0 -0
- data/app/javascript/vendor/jstree/themes/default-dark/style.css +1150 -0
- data/app/javascript/vendor/jstree/themes/default-dark/style.min.css +1 -0
- data/app/javascript/vendor/jstree/themes/default-dark/throbber.gif +0 -0
- data/app/jobs/concerns/lcms/engine/nested_resque_job.rb +1 -4
- data/app/jobs/lcms/engine/document_generate_gdoc_job.rb +2 -2
- data/app/jobs/lcms/engine/document_generate_job.rb +2 -2
- data/app/jobs/lcms/engine/document_generate_pdf_job.rb +5 -5
- data/app/jobs/lcms/engine/document_parse_job.rb +1 -1
- data/app/jobs/lcms/engine/material_generate_pdf_job.rb +4 -4
- data/app/models/concerns/lcms/engine/navigable.rb +6 -10
- data/app/models/concerns/lcms/engine/searchable.rb +7 -0
- data/app/models/lcms/engine/document.rb +1 -1
- data/app/models/lcms/engine/download.rb +1 -1
- data/app/models/lcms/engine/resource.rb +1 -1
- data/app/models/lcms/engine/search/document.rb +4 -3
- data/app/models/lcms/engine/search/repository.rb +1 -1
- data/app/presenters/lcms/engine/content_presenter.rb +1 -1
- data/app/presenters/lcms/engine/curriculum_presenter.rb +21 -18
- data/app/presenters/lcms/engine/document_presenter.rb +5 -3
- data/app/presenters/lcms/engine/resource_presenter.rb +6 -3
- data/app/queries/lcms/engine/admin_documents_query.rb +2 -2
- data/app/queries/lcms/engine/admin_materials_query.rb +11 -2
- data/app/queries/lcms/engine/base_query.rb +1 -1
- data/app/serializers/lcms/engine/previews_material_serializer.rb +1 -0
- data/app/services/lcms/engine/document_build_service.rb +6 -0
- data/app/services/lcms/engine/document_generator.rb +2 -2
- data/app/services/lcms/engine/google/drive_service.rb +7 -15
- data/app/services/lcms/engine/google/script_service.rb +7 -3
- data/app/services/lcms/engine/html_sanitizer.rb +6 -6
- data/app/services/lcms/engine/lessons_gdoc_bundler.rb +1 -1
- data/app/services/lcms/engine/lti_exporter.rb +1 -1
- data/app/services/lcms/engine/material_build_service.rb +6 -2
- data/app/services/lcms/engine/material_preview_generator.rb +3 -3
- data/app/services/lcms/engine/react_materials_resolver.rb +3 -2
- data/app/services/lcms/engine/s3_service.rb +14 -2
- data/app/tasks/resource_tasks.rb +2 -2
- data/app/views/layouts/lcms/engine/admin.html.erb +3 -3
- data/app/views/layouts/lcms/engine/application.html.erb +2 -2
- data/app/views/layouts/lcms/engine/lti.html.erb +1 -1
- data/app/views/lcms/engine/admin/access_codes/_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/access_codes/index.html.erb +3 -3
- data/app/views/lcms/engine/admin/batch_reimports/_search_form.html.erb +2 -2
- data/app/views/lcms/engine/admin/curriculums/edit.html.erb +5 -5
- data/app/views/lcms/engine/admin/documents/_materials_links.html.erb +2 -2
- data/app/views/lcms/engine/admin/documents/_reimport.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/_search_form.html.erb +2 -2
- data/app/views/lcms/engine/admin/documents/import.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/index.html.erb +7 -5
- data/app/views/lcms/engine/admin/documents/new.html.erb +6 -2
- data/app/views/lcms/engine/admin/materials/_reimport.html.erb +1 -1
- data/app/views/lcms/engine/admin/materials/_search_form.html.erb +2 -2
- data/app/views/lcms/engine/admin/materials/import.html.erb +1 -1
- data/app/views/lcms/engine/admin/materials/index.html.erb +26 -22
- data/app/views/lcms/engine/admin/materials/new.html.erb +5 -1
- data/app/views/lcms/engine/admin/resource_bulk_edits/new.html.erb +2 -2
- data/app/views/lcms/engine/admin/resources/_fields.html.erb +4 -0
- data/app/views/lcms/engine/admin/resources/_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/resources/_search_form.html.erb +2 -2
- data/app/views/lcms/engine/admin/resources/index.html.erb +7 -5
- data/app/views/lcms/engine/admin/shared/_header.html.erb +12 -12
- data/app/views/lcms/engine/admin/standards/_form.html.erb +3 -1
- data/app/views/lcms/engine/admin/standards/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/users/_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/users/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/users/index.html.erb +6 -6
- data/app/views/lcms/engine/documents/gdoc/_agenda.html.erb +1 -1
- data/app/views/lcms/engine/documents/show.html.erb +1 -1
- data/app/views/lcms/engine/materials/show.html.erb +1 -1
- data/app/views/lcms/engine/pages/not_found.html.erb +5 -0
- data/app/views/lcms/engine/resources/_download.html.erb +2 -2
- data/app/views/lcms/engine/resources/_unit_bundles.html.erb +2 -2
- data/app/views/lcms/engine/resources/generic.html.erb +0 -4
- data/app/views/lcms/engine/resources/media.html.erb +0 -4
- data/app/views/lcms/engine/resources/show.html.erb +0 -2
- data/config/initializers/airbrake.rb +62 -10
- data/config/initializers/bitly.rb +1 -1
- data/config/initializers/carrier_wave.rb +6 -4
- data/config/initializers/ckeditor.rb +6 -0
- data/config/initializers/elasticsearch.rb +1 -1
- data/config/initializers/resque.rb +2 -2
- data/config/locales/admin/en.yml +1 -2
- data/config/locales/ui/en.yml +1 -0
- data/config/routes.rb +5 -2
- data/db/migrate/.keep +0 -0
- data/db/schema.rb +280 -312
- data/db/seeds.rb +0 -1
- data/docker-compose.ror4.yml +32 -0
- data/docker-compose.yml +6 -3
- data/docs/env-variables.md +40 -40
- data/docs/google-cloud-platform-setup.md +45 -17
- data/docs/how-to-build-and-publish.md +1 -0
- data/lcms-engine.gemspec +28 -20
- data/lib/doc_template/document.rb +3 -4
- data/lib/doc_template/document_toc.rb +2 -2
- data/lib/doc_template/objects/activity_metadata.rb +1 -1
- data/lib/doc_template/objects/agenda_metadata.rb +1 -1
- data/lib/doc_template/objects/metadata_helpers.rb +1 -1
- data/lib/doc_template/objects/toc_helpers.rb +4 -4
- data/lib/doc_template/objects/toc_metadata.rb +4 -6
- data/lib/doc_template/tables/base.rb +3 -2
- data/lib/doc_template/tags/activity_metadata_type_tag.rb +1 -1
- data/lib/doc_template/tags/answer_space_tag.rb +2 -2
- data/lib/doc_template/tags/base_tag.rb +5 -5
- data/lib/doc_template/tags/block_tag.rb +1 -1
- data/lib/doc_template/tags/columns_tag.rb +1 -1
- data/lib/doc_template/tags/def_tag.rb +1 -1
- data/lib/doc_template/tags/expand_tag.rb +1 -0
- data/lib/doc_template/tags/heading_tag.rb +1 -1
- data/lib/doc_template/tags/inset_tag.rb +2 -2
- data/lib/doc_template/tags/latex_tag.rb +1 -1
- data/lib/doc_template/tags/page_break_tag.rb +1 -1
- data/lib/doc_template/tags/pd_tag.rb +4 -4
- data/lib/doc_template/tags/section_tag.rb +2 -2
- data/lib/doc_template/tags/standard_tag.rb +3 -3
- data/lib/doc_template/tags/table_preserve_alignment_tag.rb +1 -1
- data/lib/doc_template/tags/table_tag.rb +1 -1
- data/lib/doc_template/template.rb +1 -1
- data/lib/doc_template.rb +9 -9
- data/lib/document_exporter/gdoc/base.rb +6 -3
- data/lib/document_exporter/pdf/base.rb +1 -1
- data/lib/document_exporter/pdf/document.rb +2 -2
- data/lib/document_exporter/pdf/material.rb +2 -2
- data/lib/document_exporter/pdf/student_material.rb +2 -2
- data/lib/document_exporter/pdf/teacher_material.rb +2 -2
- data/lib/document_renderer/part.rb +4 -6
- data/lib/elasticsearch/persistence/repository/response/results.rb +1 -1
- data/lib/lcms/engine/engine.rb +10 -9
- data/lib/lcms/engine/version.rb +1 -1
- data/lib/lcms/engine.rb +0 -1
- data/lib/lt/lcms/metadata/base_service.rb +2 -1
- data/lib/lt/lcms/metadata/context.rb +58 -54
- data/lib/lt/lcms/metadata/service.rb +6 -3
- data/lib/resque_job.rb +3 -6
- data/lib/standard_importer.rb +4 -4
- data/lib/tasks/cloud66.rake +8 -6
- data/lib/tasks/document.rake +7 -7
- data/lib/tasks/google.rake +29 -14
- data/lib/tasks/lcms/engine_tasks.rake +1 -1
- data/package.json +31 -9
- data/postcss.config.js +12 -0
- data/spec/controllers/admin/association_picker_controller_spec.rb +6 -8
- data/spec/controllers/admin/curriculums_controller_spec.rb +23 -0
- data/spec/controllers/admin/documents_controller_spec.rb +25 -3
- data/spec/controllers/admin/materials_controller_spec.rb +17 -4
- data/spec/controllers/admin/resource_bulk_edit_controller_spec.rb +1 -1
- data/spec/controllers/admin/resources_controller_spec.rb +3 -3
- data/spec/controllers/admin/settings_controller_spec.rb +1 -1
- data/spec/controllers/admin/standards_controller_spec.rb +1 -1
- data/spec/controllers/admin/welcome_controller_spec.rb +12 -10
- data/spec/controllers/resources_controller_spec.rb +3 -3
- data/spec/controllers/welcome_controller_spec.rb +38 -0
- data/spec/dummy/.env.docker +5 -0
- data/spec/dummy/.traceroute.yaml +0 -2
- data/spec/dummy/bin/webpack +18 -0
- data/spec/dummy/bin/webpack-dev-server +18 -0
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +6 -0
- data/spec/dummy/config/lcms-admin.yml +3 -7
- data/spec/dummy/config/puma.rb +3 -3
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/db/schema.rb +5 -5
- data/spec/entities/grades_spec.rb +12 -0
- data/spec/factories/documents.rb +1 -0
- data/spec/factories/downloads.rb +1 -1
- data/spec/factories/resources.rb +2 -2
- data/spec/features/admin/lessons/add_lesson_spec.rb +3 -3
- data/spec/features/admin/materials/add_material_spec.rb +5 -3
- data/spec/features/admin/users_spec.rb +2 -2
- data/spec/forms/document_form_spec.rb +11 -1
- data/spec/{controllers/admin/admin_controller_spec.rb → helpers/path_helper_spec.rb} +6 -6
- data/spec/lib/doc_template/objects/activity_metadata_spec.rb +1 -1
- data/spec/lib/doc_template/objects/agenda_metadata_spec.rb +2 -0
- data/spec/lib/doc_template/objects/toc_metadata_spec.rb +1 -1
- data/spec/lib/doc_template/tables/shared_examples/remove_table.rb +1 -1
- data/spec/lib/doc_template/tags/page_break_tag_spec.rb +1 -1
- data/spec/lib/doc_template/tags/pd_tag_spec.rb +1 -1
- data/spec/models/document_spec.rb +1 -1
- data/spec/models/standard_spec.rb +2 -0
- data/spec/queries/lcms/engine/admin_materials_query_spec.rb +34 -0
- data/spec/rails_helper.rb +8 -2
- data/spec/services/document_build_service_spec.rb +4 -11
- data/spec/services/s3_service_spec.rb +31 -0
- data/spec/support/concerns/navigable.rb +2 -0
- data/spec/support/routes.rb +4 -0
- data/spec/support/shared_examples/content_tag.rb +4 -4
- data/templates/routes.rb +0 -1
- data/yarn.lock +3447 -2993
- metadata +208 -303
- data/app/assets/stylesheets/lcms/engine/application.scss +0 -36
- data/app/assets/stylesheets/lcms/engine/vendors/jquery.tagsinput.css +0 -1
- data/app/exceptions/components_api_error.rb +0 -4
- data/app/exceptions/document_error.rb +0 -4
- data/app/exceptions/material_error.rb +0 -4
- data/app/javascript/packs/admin.js +0 -14
- data/app/models/lcms/engine/component.rb +0 -88
- data/app/presenters/lcms/engine/social_media_presenter.rb +0 -83
- data/app/views/lcms/engine/shared/_social_sharing.html.erb +0 -22
- data/db/migrate/20200217160930_change_document_parts_to_polymorphic.rb +0 -36
- data/db/migrate/20200218144849_drop_material_parts_table.rb +0 -7
- data/db/migrate/20200422130652_add_reimported_at_to_documents.rb +0 -7
- data/db/migrate/20200429130353_drop_pages.rb +0 -13
- data/db/seeds/pages.seeds.rb +0 -26
- data/lib/document_exporter.rb +0 -6
- data/lib/lcms/engine/migration.rb +0 -16
- data/spec/models/component_spec.rb +0 -60
- data/vendor/assets/javascripts/jquery.tagsinput.js +0 -1
@@ -5,10 +5,10 @@ require 'sanitize'
|
|
5
5
|
module Lcms
|
6
6
|
module Engine
|
7
7
|
class HtmlSanitizer # rubocop:disable Metrics/ClassLength
|
8
|
-
LIST_STYLE_RE = /\.lst-(\S+)[^{}]+>\s*(?:li:before)\s*{\s*content[^{}]+counter\(lst-ctn-\1,([^)]+)\)
|
8
|
+
LIST_STYLE_RE = /\.lst-(\S+)[^{}]+>\s*(?:li:before)\s*{\s*content[^{}]+counter\(lst-ctn-\1,([^)]+)\)/.freeze
|
9
9
|
CLEAN_ELEMENTS = %w(a div h1 h2 h3 h4 h5 h6 p table).join(',')
|
10
10
|
GDOC_REMOVE_EMPTY_SELECTOR = '.o-ld-activity'
|
11
|
-
LINK_UNDERLINE_REGEX = /text-decoration\s*:\s*underline/i
|
11
|
+
LINK_UNDERLINE_REGEX = /text-decoration\s*:\s*underline/i.freeze
|
12
12
|
SKIP_P_CHECK = %w(ul ol table).freeze
|
13
13
|
STRIP_ELEMENTS = %w(a div h1 h2 h3 h4 h5 h6 p span table).freeze
|
14
14
|
|
@@ -169,7 +169,7 @@ module Lcms
|
|
169
169
|
].freeze
|
170
170
|
private_constant :FONT_STYLES_RE
|
171
171
|
|
172
|
-
BORDER_RE = /border-\w+-width:\s*0\w
|
172
|
+
BORDER_RE = /border-\w+-width:\s*0\w+;?/.freeze
|
173
173
|
private_constant :BORDER_RE
|
174
174
|
|
175
175
|
BORDER_REPLACE_RE = {
|
@@ -186,7 +186,7 @@ module Lcms
|
|
186
186
|
].freeze
|
187
187
|
private_constant :SUB_SUP_RE
|
188
188
|
|
189
|
-
SUB_SUP_STYLE_RE = /vertical-align:\s*(sub|super);?/i
|
189
|
+
SUB_SUP_STYLE_RE = /vertical-align:\s*(sub|super);?/i.freeze
|
190
190
|
private_constant :SUB_SUP_STYLE_RE
|
191
191
|
|
192
192
|
def add_css_class(el, *classes)
|
@@ -242,7 +242,7 @@ module Lcms
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def fix_table_styles(nodes, param, selector)
|
245
|
-
attr_regex = /(^|;\s*)#{param}\s*:\s*([\w
|
245
|
+
attr_regex = /(^|;\s*)#{param}\s*:\s*([\w.]+)\s*($|;)*/
|
246
246
|
nodes.css(selector).each do |node|
|
247
247
|
node[param] = node['style'].match(attr_regex)&.[](2)
|
248
248
|
end
|
@@ -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)
|
@@ -67,7 +67,7 @@ module Lcms
|
|
67
67
|
|
68
68
|
def dirname(res)
|
69
69
|
subject = res.subject.casecmp('math').zero? ? 'Math' : 'ELA'
|
70
|
-
Breadcrumbs.new(res).short_pieces[1
|
70
|
+
Breadcrumbs.new(res).short_pieces[1..].unshift(subject).join('-')
|
71
71
|
end
|
72
72
|
|
73
73
|
def drive_id(url)
|
@@ -7,10 +7,13 @@ module Lcms
|
|
7
7
|
module Engine
|
8
8
|
class MaterialBuildService
|
9
9
|
EVENT_BUILT = 'material:built'
|
10
|
-
PDF_EXT_RE = /\.pdf
|
10
|
+
PDF_EXT_RE = /\.pdf$/.freeze
|
11
|
+
|
12
|
+
attr_reader :errors
|
11
13
|
|
12
14
|
def initialize(credentials, opts = {})
|
13
15
|
@credentials = credentials
|
16
|
+
@errors = []
|
14
17
|
@options = opts
|
15
18
|
end
|
16
19
|
|
@@ -25,7 +28,7 @@ module Lcms
|
|
25
28
|
|
26
29
|
attr_reader :credentials, :material, :downloader, :options, :url
|
27
30
|
|
28
|
-
def build_from_pdf
|
31
|
+
def build_from_pdf # rubocop:disable Metrics/AbcSize
|
29
32
|
@downloader = ::Lt::Lcms::Lesson::Downloader::PDF.new(credentials, url)
|
30
33
|
create_material
|
31
34
|
title = @downloader.file.name.sub(PDF_EXT_RE, '')
|
@@ -60,6 +63,7 @@ module Lcms
|
|
60
63
|
create_material
|
61
64
|
content = @downloader.download.content
|
62
65
|
template = DocTemplate::Template.parse(content, type: :material)
|
66
|
+
@errors = template.metadata_service.errors
|
63
67
|
|
64
68
|
metadata = template.metadata_service.options_for(:default)[:metadata]
|
65
69
|
material.update!(
|
@@ -6,8 +6,8 @@ module Lcms
|
|
6
6
|
# Generates and uploads PDF/GDoc files for material
|
7
7
|
#
|
8
8
|
class MaterialPreviewGenerator
|
9
|
-
GDOC_RE = %r{docs.google.com/document/d/([^/]*)}i
|
10
|
-
GDOC_BROKEN_RE = %r{/open\?id=$}i
|
9
|
+
GDOC_RE = %r{docs.google.com/document/d/([^/]*)}i.freeze
|
10
|
+
GDOC_BROKEN_RE = %r{/open\?id=$}i.freeze
|
11
11
|
PDF_S3_FOLDER = 'temp-materials-pdf'
|
12
12
|
|
13
13
|
attr_reader :error, :url
|
@@ -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::
|
57
|
+
pdf = DocumentExporter::Pdf::Material.new(material).export
|
58
58
|
@url = S3Service.upload pdf_filename, pdf
|
59
59
|
true
|
60
60
|
end
|
@@ -14,8 +14,9 @@ module Lcms
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def replace_react(node, document)
|
17
|
+
def replace_react(node, document) # rubocop:disable Metrics/PerceivedComplexity
|
18
18
|
node.remove && return if (data = node.attr('data-react-props')).blank?
|
19
|
+
|
19
20
|
raw_props = if data.match?(/^\d+(?:,\s*\d+)*$/)
|
20
21
|
# comma separated list of numbers, i.e: '123' or '123,432' or '123, 42, 12'
|
21
22
|
{ 'material_ids' => data.split(',').map(&:strip), 'activity' => {} }
|
@@ -25,7 +26,7 @@ module Lcms
|
|
25
26
|
node.remove && return if (raw_props['material_ids']).empty?
|
26
27
|
|
27
28
|
props = PreviewsMaterialSerializer.new(raw_props, document)
|
28
|
-
node.remove && return if props.data
|
29
|
+
node.remove && return if props.data && props.data.empty?
|
29
30
|
|
30
31
|
node.replace(component(props, document))
|
31
32
|
end
|
@@ -12,9 +12,21 @@ module Lcms
|
|
12
12
|
.object(key)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
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
|
-
|
26
|
+
options = options.merge(
|
27
|
+
body: data
|
28
|
+
)
|
29
|
+
object.put(options)
|
18
30
|
object.public_url
|
19
31
|
end
|
20
32
|
|
data/app/tasks/resource_tasks.rb
CHANGED
@@ -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.
|
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.
|
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/
|
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/
|
15
|
-
<%= lcms_engine_javascript_pack_tag '
|
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/
|
13
|
-
<%= javascript_include_tag 'lcms/engine/
|
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/
|
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
|
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'),
|
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:
|
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>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
required: false,
|
18
18
|
as: :select,
|
19
19
|
include_blank: true,
|
20
|
-
collection: Lcms::Engine::Grades
|
20
|
+
collection: Lcms::Engine::Grades.grades,
|
21
21
|
label_method: :humanize %>
|
22
22
|
</div>
|
23
23
|
|
@@ -1,16 +1,16 @@
|
|
1
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css"/>
|
2
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
|
1
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
|
3
2
|
|
4
3
|
<% set_page_title 'Curriculum Tree Manager' %>
|
5
4
|
|
6
5
|
<div class="o-page">
|
7
6
|
|
8
|
-
<h1 class="text-center">Import Curriculum Tree</h1>
|
9
|
-
|
10
7
|
<% if @curriculum.present? %>
|
11
8
|
<h1 class="text-center">Curriculum Tree</h1>
|
12
9
|
<div class="row">
|
13
|
-
<%= react_component('admin/curriculum/CurriculumEditor',
|
10
|
+
<%= react_component('admin/curriculum/CurriculumEditor',
|
11
|
+
@curriculum.editor_props.merge(
|
12
|
+
form_token: form_authenticity_token,
|
13
|
+
path: lcms_engine.children_admin_curriculum_path)) %>
|
14
14
|
</div>
|
15
15
|
<% end %>
|
16
16
|
</div>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
<% urls = material_urls(m, lesson) %>
|
4
4
|
<li class="u-text--small">
|
5
5
|
<% if urls[:gdoc].present? %>
|
6
|
-
<a class="lessons-table__materials--file" href="<%= urls[:gdoc] %>" target="_blank"> <i class="
|
6
|
+
<a class="lessons-table__materials--file" href="<%= urls[:gdoc] %>" target="_blank"> <i class="fab fa-google"></i></a>
|
7
7
|
<% end %>
|
8
8
|
<% if urls[:pdf].present? %>
|
9
|
-
<a class="lessons-table__materials--file" href="<%= urls[:pdf] %>" target="_blank"> <i class="
|
9
|
+
<a class="lessons-table__materials--file" href="<%= urls[:pdf] %>" target="_blank"> <i class="far fa-file-pdf"></i></a>
|
10
10
|
<% end %>
|
11
11
|
<%= link_to(m.identifier, m, target: '_blank') %>
|
12
12
|
</li>
|
@@ -3,5 +3,5 @@
|
|
3
3
|
<%= hidden_field_tag('document_form[link_fs]', lesson.file_fs_url) %>
|
4
4
|
<%= hidden_field_tag('document_form[reimport]', 1) %>
|
5
5
|
<%= hidden_field_tag('document_form[with_materials]', 0, class: 'c-reimport-with-materials__field') %>
|
6
|
-
<%= submit_tag 'Reimport', class: local_assigns.fetch(:btn_class, 'button small primary') %>
|
6
|
+
<%= submit_tag 'Reimport', class: local_assigns.fetch(:btn_class, 'button small primary'), data: { disable_with: false } %>
|
7
7
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= simple_form_for :query, url:
|
1
|
+
<%= simple_form_for :query, url: lcms_engine.admin_documents_path, html: { class: 'form-inline well o-admin-lessons-search', method: :get } 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="lesson-subject">Select Subject</button>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
required: false,
|
19
19
|
as: :select,
|
20
20
|
include_blank: true,
|
21
|
-
collection: Lcms::Engine::Grades
|
21
|
+
collection: Lcms::Engine::Grades.grades,
|
22
22
|
label_method: :humanize %>
|
23
23
|
</div>
|
24
24
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h2 class="text-center">Import Documents</h2>
|
5
5
|
|
6
6
|
<div class="row">
|
7
|
-
<%= link_to '<- Back', admin_documents_path, class: 'button primary' %>
|
7
|
+
<%= link_to '<- Back', lcms_engine.admin_documents_path, class: 'button primary' %>
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<%= react_component('admin/ImportStatus', @props) %>
|
@@ -16,15 +16,15 @@
|
|
16
16
|
<%= react_component 'admin/MultiSelectedOperation', {
|
17
17
|
text: t('.reimport_selected'),
|
18
18
|
operation: 'reimport',
|
19
|
-
path: reimport_selected_admin_documents_path(query:
|
19
|
+
path: reimport_selected_admin_documents_path(query: @query_params),
|
20
20
|
btn_style: 'primary' } %>
|
21
21
|
<%= react_component 'admin/MultiSelectedOperation', {
|
22
22
|
text: t('.delete_selected'),
|
23
23
|
operation: 'delete',
|
24
|
-
path: delete_selected_admin_documents_path(query:
|
24
|
+
path: delete_selected_admin_documents_path(query: @query_params),
|
25
25
|
btn_style: 'alert'} %>
|
26
26
|
|
27
|
-
<%= link_to t('.new_lesson'),
|
27
|
+
<%= link_to t('.new_lesson'), lcms_engine.new_admin_document_path, class: 'button primary' %>
|
28
28
|
</div>
|
29
29
|
<table class="lessons-table table">
|
30
30
|
<tr>
|
@@ -40,11 +40,12 @@
|
|
40
40
|
</tr>
|
41
41
|
|
42
42
|
<% @documents.each do |lesson| %>
|
43
|
-
|
43
|
+
<% cache lesson do %>
|
44
|
+
<tr id=lesson_<%= lesson.id %>>
|
44
45
|
<td><%= check_box_tag 'selected_ids[]', lesson.id, selected_id?(lesson.id), class: 'c-selected-ids' %></td>
|
45
46
|
<td class="u-text--right"><%= lesson.id %></td>
|
46
47
|
<td><%= Lcms::Engine::Breadcrumbs.new(lesson.resource).short_title if lesson.resource %></td>
|
47
|
-
<td><%= link_to lesson.resource&.title,
|
48
|
+
<td><%= link_to lesson.resource&.title, dynamic_document_path(lesson, request.query_parameters), target: '_blank' %></td>
|
48
49
|
<td>
|
49
50
|
<% if lesson.math? %>
|
50
51
|
<% if lesson.file_url.present? %>
|
@@ -73,6 +74,7 @@
|
|
73
74
|
<%= button_to t('ui.delete'), admin_document_path(lesson), class: 'button small alert', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :delete %>
|
74
75
|
</td>
|
75
76
|
</tr>
|
77
|
+
<% end %>
|
76
78
|
<% end %>
|
77
79
|
</table>
|
78
80
|
</div>
|
@@ -1,8 +1,12 @@
|
|
1
1
|
<div class="o-page">
|
2
2
|
<h2 class=text-center><%= t('.page_title') %></h2>
|
3
3
|
|
4
|
-
<%= simple_form_for @document, url:
|
5
|
-
|
4
|
+
<%= simple_form_for @document || DocumentForm.new, url: lcms_engine.admin_documents_path do |f| %>
|
5
|
+
<%= f.input :link, error: f.object.errors[:link].first.try(:html_safe), label: t('ui.url') %>
|
6
|
+
<p>
|
7
|
+
<%= f.check_box :async, checked: true %>
|
8
|
+
<span><small><%= t('ui.async') %></small></span>
|
9
|
+
</p>
|
6
10
|
<%= f.button :submit, t('.submit') %>
|
7
11
|
<% end %>
|
8
12
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= form_tag(lcms_engine.admin_materials_path, method: :post, class: 'inline-form-btn', target: '_blank') do %>
|
2
2
|
<%= hidden_field_tag('material_form[source_type]', material.source_type) %>
|
3
3
|
<%= hidden_field_tag('material_form[link]', material.file_url) %>
|
4
|
-
<%= submit_tag 'Reimport', class: "button primary #{local_assigns.fetch(:btn_size, 'small')}" %>
|
4
|
+
<%= submit_tag 'Reimport', class: "button primary #{local_assigns.fetch(:btn_size, 'small')}", data: { disable_with: false } %>
|
5
5
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= simple_form_for :query, url:
|
1
|
+
<%= simple_form_for :query, url: lcms_engine.admin_materials_path, html: { class: 'form-inline well o-admin-lessons-search', method: :get } do |f| %>
|
2
2
|
|
3
3
|
<div class="row align-bottom align-justify">
|
4
4
|
<%= f.input :search_term, label: 'Identifier', required: false,
|
@@ -31,7 +31,7 @@
|
|
31
31
|
required: false,
|
32
32
|
as: :select,
|
33
33
|
include_blank: true,
|
34
|
-
collection: Lcms::Engine::Grades
|
34
|
+
collection: Lcms::Engine::Grades.grades_abbrevs.zip(Lcms::Engine::Grades.grades.map(&:humanize)).last(4),
|
35
35
|
label_method: :last,
|
36
36
|
value_method: :first %>
|
37
37
|
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h2 class="text-center">Import Materials</h2>
|
5
5
|
|
6
6
|
<div class="row">
|
7
|
-
<%= link_to '<- Back', admin_materials_path, class: 'button primary' %>
|
7
|
+
<%= link_to '<- Back', lcms_engine.admin_materials_path, class: 'button primary' %>
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<%= react_component('admin/ImportStatus', @props) %>
|
@@ -16,15 +16,15 @@
|
|
16
16
|
<%= react_component 'admin/MultiSelectedOperation', {
|
17
17
|
text: t('.reimport_selected'),
|
18
18
|
operation: 'reimport',
|
19
|
-
path: reimport_selected_admin_materials_path(query:
|
19
|
+
path: reimport_selected_admin_materials_path(query: @query_params),
|
20
20
|
btn_style: 'primary' } %>
|
21
21
|
<%= react_component 'admin/MultiSelectedOperation', {
|
22
22
|
text: t('.delete_selected'),
|
23
23
|
operation: 'delete',
|
24
|
-
path: delete_selected_admin_materials_path(query:
|
24
|
+
path: delete_selected_admin_materials_path(query: @query_params),
|
25
25
|
btn_style: 'alert'} %>
|
26
26
|
<%# link_to t('.new_material_pdf'), new_admin_material_path(source_type: 'pdf'), class: 'button primary' %>
|
27
|
-
<%= link_to t('.new_material'),
|
27
|
+
<%= link_to t('.new_material'), lcms_engine.new_admin_material_path, class: 'button primary' %>
|
28
28
|
</div>
|
29
29
|
<div class="materials-table materials-table__wrapper">
|
30
30
|
<table class="table u-text--centered">
|
@@ -49,41 +49,45 @@
|
|
49
49
|
</tr>
|
50
50
|
|
51
51
|
<% @materials.each do |material| %>
|
52
|
-
<% material
|
53
|
-
|
52
|
+
<% cache material do %>
|
53
|
+
<% material = ::Lcms::Engine::DocumentGenerator.material_presenter.new material %>
|
54
|
+
<tr id="material_<%= material.id %>">
|
54
55
|
<td><%= check_box_tag 'selected_ids[]', material.id, selected_id?(material.id), class: 'c-selected-ids' %></td>
|
55
|
-
<td><%= material.id
|
56
|
-
<td class="u-text--right"><%= link_to material.metadata['identifier'],
|
57
|
-
<td><%= link_to material.name, material.file_url, target: '_blank'
|
58
|
-
<td><%= material.metadata['type']
|
59
|
-
<td><%= material.metadata['title']
|
60
|
-
<td><%= material.metadata['grade']
|
61
|
-
<td><%= material.metadata['guidebook']
|
62
|
-
<td><%= material.metadata['section']
|
63
|
-
<td><%= material.metadata['lesson']
|
64
|
-
<td><%= material.metadata['activity']
|
65
|
-
<td><%= material.metadata['orientation']
|
66
|
-
<td><%= material.metadata['name_date']
|
67
|
-
<td><%= material.metadata['header_footer']
|
56
|
+
<td><%= material.id %></td>
|
57
|
+
<td class="u-text--right"><%= link_to material.metadata['identifier'], dynamic_material_path(material, request.query_parameters), target: '_blank' %></td>
|
58
|
+
<td><%= link_to material.name, material.file_url, target: '_blank' %></td>
|
59
|
+
<td><%= material.metadata['type'] %></td>
|
60
|
+
<td><%= material.metadata['title'] %></td>
|
61
|
+
<td><%= material.metadata['grade'] %></td>
|
62
|
+
<td><%= material.metadata['guidebook'] %></td>
|
63
|
+
<td><%= material.metadata['section'] %></td>
|
64
|
+
<td><%= material.metadata['lesson'] %></td>
|
65
|
+
<td><%= material.metadata['activity'] %></td>
|
66
|
+
<td><%= material.metadata['orientation'] %></td>
|
67
|
+
<td><%= material.metadata['name_date'] %></td>
|
68
|
+
<td><%= material.metadata['header_footer'] %></td>
|
68
69
|
<td>
|
69
70
|
<ul class="materials-table__lessons">
|
70
71
|
<% material.documents.each do |lesson| %>
|
71
72
|
<% lesson = ::Lcms::Engine::DocumentGenerator.document_presenter.new lesson %>
|
72
73
|
<li class="u-text--small">
|
73
|
-
<a href="<%= lesson.file_url%>" target="_blank" class="materials-table__lessons--file"><i class="
|
74
|
-
<%= link_to lesson.title,
|
74
|
+
<a href="<%= lesson.file_url%>" target="_blank" class="materials-table__lessons--file"><i class="fab fa-google"></i></a>
|
75
|
+
<%= link_to lesson.title, dynamic_path(:material_path, lesson, request.query_parameters), target: '_blank' %>
|
75
76
|
</li>
|
76
77
|
<% end %>
|
77
78
|
</ul>
|
78
|
-
|
79
|
+
</td>
|
80
|
+
<td class="u-txt--small"><%= material.reimported_at.to_s.presence || material.updated_at.to_s %></td>
|
79
81
|
<td class="materials-table__btns text-left">
|
80
82
|
<%= render partial: 'lcms/engine/admin/materials/reimport', locals: { material: material } %>
|
81
|
-
<%= button_to t('ui.delete'), admin_material_path(material, query:
|
83
|
+
<%= button_to t('ui.delete'), admin_material_path(material, query: @query_params), class: 'button small alert', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :delete %>
|
82
84
|
<% unless material.pdf? %>
|
83
85
|
<%# link_to material.pdf_preview_title, preview_pdf_material_path(material), class: 'button warning', target: '_blank' %>
|
84
86
|
<%# link_to material.gdoc_preview_title, preview_gdoc_material_path(material), class: 'button warning', target: '_blank' %>
|
85
87
|
<% end %>
|
88
|
+
</td>
|
86
89
|
</tr>
|
90
|
+
<% end %>
|
87
91
|
<% end %>
|
88
92
|
</table>
|
89
93
|
</div>
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<div class="o-page">
|
2
2
|
<h2 class="text-center"><%= t('.page_header', type: @material_form.source_type) %></h2>
|
3
3
|
|
4
|
-
<%= simple_form_for @material_form, url:
|
4
|
+
<%= simple_form_for @material_form || MaterialForm.new, url: lcms_engine.admin_materials_path do |f| %>
|
5
5
|
<%= f.hidden_field :source_type, value: @material_form.source_type %>
|
6
6
|
<%= f.input :link, label: t('ui.url') %>
|
7
|
+
<p>
|
8
|
+
<%= f.check_box :async, checked: true %>
|
9
|
+
<span><small><%= t('ui.async') %></small></span>
|
10
|
+
</p>
|
7
11
|
<%= f.button :submit, t('.submit') %>
|
8
12
|
<% end %>
|
9
13
|
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class=o-page>
|
2
2
|
<h2 class=text-center><%= t('.page_title') %></h2>
|
3
3
|
|
4
|
-
<%= simple_form_for @resource, url:
|
4
|
+
<%= simple_form_for @resource, url: lcms_engine.admin_resource_bulk_edits_path do |f| %>
|
5
5
|
|
6
6
|
<% @resources.each do |resource| %>
|
7
7
|
<%= hidden_field_tag 'ids[]', resource.id %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
<%= f.association :standards, as: :select, input_html: { class: 'selectize', multiple: true } %>
|
11
11
|
|
12
|
-
<%= f.input :grades, collection: Lcms::Engine::Grades
|
12
|
+
<%= f.input :grades, collection: Lcms::Engine::Grades.grades, as: :select, value_method: :humanize, input_html: { class: 'selectize', id: 'grades_select', multiple: true } %>
|
13
13
|
|
14
14
|
<%= f.input :tag_list, collection: Lcms::Engine::Tag.where_context('tags').select(:id, :name).distinct(:name), as: :select, value_method: :name, input_html: { class: 'selectize', id: 'subjects_select', multiple: true } %>
|
15
15
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% url = @resource.new_record? ?
|
1
|
+
<% url = @resource.new_record? ? lcms_engine.admin_resources_path : lcms_engine.admin_resource_path(@resource) %>
|
2
2
|
|
3
3
|
<%= simple_nested_form_for @resource, url: url, html: { id: 'resource_form' } do |f| %>
|
4
4
|
<div class="large-10 columns">
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= simple_form_for @query, url:
|
1
|
+
<%= simple_form_for @query, url: lcms_engine.admin_resources_path, html: { class: 'form-inline well admin-resource-search', method: :get } do |f| %>
|
2
2
|
|
3
3
|
<div class='row align-justify'>
|
4
|
-
<%= f.input :grades, as: :select, collection: Lcms::Engine::Grades
|
4
|
+
<%= f.input :grades, as: :select, collection: Lcms::Engine::Grades.grades, input_html: { class: 'selectize resource-search-select', multiple: true }, label: t('.grades'), label_method: :humanize, required: false, wrapper_html: { class: 'resource-search-wrap' } %>
|
5
5
|
|
6
6
|
<%= f.input :resource_standards_standard_id_in, as: :select, collection: Lcms::Engine::Standard.all, input_html: { class: 'selectize resource-search-select', multiple: true }, label: t('.standards'), required: false, wrapper_html: { class: 'resource-search-wrap' } %>
|
7
7
|
|
@@ -28,11 +28,12 @@
|
|
28
28
|
</tr>
|
29
29
|
|
30
30
|
<% @resources.each do |resource| %>
|
31
|
-
|
31
|
+
<% cache resource do %>
|
32
|
+
<tr>
|
32
33
|
<% check_box_id = "ids_#{resource.id}" %>
|
33
34
|
<td><%= check_box_tag 'ids[]', resource.id, false, class: 'resource-checkbox', id: check_box_id %>
|
34
35
|
<td><%= label_tag check_box_id, resource.id, class: 'resource-id-label' %>
|
35
|
-
<td><%= link_to resource.title,
|
36
|
+
<td><%= link_to resource.title, lcms_engine.edit_admin_resource_path(resource) %>
|
36
37
|
<td class="resource-tag-col"><%= strip_tags resource.teaser %>
|
37
38
|
<td class="resource-tag-col"><%= resource.standards.map(&:name).select(&:present?).join(', ') %>
|
38
39
|
<td class="resource-tag-col"><%= resource.resource_type %>
|
@@ -41,14 +42,15 @@
|
|
41
42
|
<td class="resource-tag-col"><%= resource.tree? ? 'yes' : 'no' %>
|
42
43
|
<td><%= resource_status(resource) %>
|
43
44
|
<td class="resource-btns-col">
|
44
|
-
<%= link_to t('ui.edit'),
|
45
|
+
<%= link_to t('ui.edit'), lcms_engine.edit_admin_resource_path(resource), class: 'button small' %>
|
45
46
|
<% if can_bundle? resource %>
|
46
|
-
<%= link_to t('.bundle'),
|
47
|
+
<%= link_to t('.bundle'), lcms_engine.bundle_admin_resource_path(resource), class: 'button small primary', method: :post %>
|
47
48
|
<% end %>
|
48
49
|
<% if resource.module? %>
|
49
|
-
<%= link_to t('.export_lti_cartridge'),
|
50
|
+
<%= link_to t('.export_lti_cartridge'), lcms_engine.export_to_lti_cc_admin_resource_path(resource), class: 'button small primary', method: :post %>
|
50
51
|
<% end %>
|
51
52
|
</tr>
|
53
|
+
<% end %>
|
52
54
|
<% end %>
|
53
55
|
</table>
|
54
56
|
|