lcms-engine 0.3.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +25 -0
- data/.eslintignore +2 -1
- data/.eslintrc +23 -73
- data/.nvmrc +1 -1
- data/.overcommit.yml +8 -2
- data/.prettierrc +7 -0
- data/.rubocop.yml +5 -2
- data/.ruby-version +1 -1
- data/.stylelintignore +9 -0
- data/.stylelintrc +8 -0
- data/CHANGELOG.md +42 -2
- data/Dockerfile +3 -3
- data/Gemfile.lock +345 -298
- data/README.md +21 -33
- 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 +1 -1
- data/app/controllers/lcms/engine/admin/access_codes_controller.rb +8 -3
- data/app/controllers/lcms/engine/admin/admin_controller.rb +5 -39
- 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 +26 -14
- data/app/controllers/lcms/engine/admin/materials_controller.rb +23 -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 +2 -2
- data/app/controllers/lcms/engine/admin/users_controller.rb +10 -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/hierarchical_position.rb +1 -2
- data/app/entities/lcms/engine/media_embed.rb +1 -1
- data/app/entities/lcms/engine/pagination.rb +14 -10
- data/app/entities/lcms/engine/roman_numerals.rb +1 -1
- data/app/exceptions/lcms/engine/document_error.rb +8 -0
- data/app/exceptions/lcms/engine/material_error.rb +8 -0
- data/app/helpers/admin/components_helper.rb +1 -1
- 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 +0 -8
- data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +1 -1
- data/app/javascript/components/admin/ImportStatus.jsx +88 -58
- data/app/javascript/components/admin/Initializer.jsx +33 -35
- data/app/javascript/components/admin/MultiSelectedOperation.jsx +43 -19
- data/app/javascript/components/admin/association-picker/AssociationPicker.jsx +68 -48
- data/app/javascript/components/admin/association-picker/AssociationPickerItem.jsx +18 -7
- data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +42 -18
- data/app/javascript/components/admin/association-picker/AssociationPickerWindow.jsx +47 -28
- data/app/javascript/components/admin/curriculum/CurriculumEditor.jsx +54 -33
- 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 -40
- 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/lcms/engine/document_generate_job.rb +1 -1
- data/app/jobs/lcms/engine/document_generate_pdf_job.rb +5 -5
- 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/resource.rb +1 -1
- 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 +3 -1
- data/app/presenters/lcms/engine/resource_presenter.rb +6 -3
- data/app/queries/lcms/engine/admin_documents_query.rb +1 -1
- data/app/queries/lcms/engine/admin_materials_query.rb +11 -2
- data/app/queries/lcms/engine/base_query.rb +1 -1
- data/app/services/lcms/engine/document_build_service.rb +2 -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 +1 -1
- data/app/services/lcms/engine/lti_exporter.rb +1 -1
- data/app/services/lcms/engine/material_preview_generator.rb +1 -1
- 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 +1 -1
- data/app/views/lcms/engine/admin/curriculums/edit.html.erb +4 -2
- data/app/views/lcms/engine/admin/documents/_reimport.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/import.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/index.html.erb +5 -3
- 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 +1 -1
- data/app/views/lcms/engine/admin/materials/import.html.erb +1 -1
- data/app/views/lcms/engine/admin/materials/index.html.erb +22 -18
- data/app/views/lcms/engine/admin/materials/new.html.erb +5 -1
- data/app/views/lcms/engine/admin/resource_bulk_edits/new.html.erb +1 -1
- data/app/views/lcms/engine/admin/resources/_fields.html.erb +4 -3
- data/app/views/lcms/engine/admin/resources/_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/resources/_search_form.html.erb +1 -1
- 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/pages/not_found.html.erb +5 -0
- 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 +0 -1
- data/config/locales/ui/en.yml +1 -0
- data/config/routes.rb +5 -2
- data/db/migrate/.keep +0 -0
- data/db/schema.rb +279 -311
- 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 +14 -0
- data/docs/pdf-generation.md +31 -0
- data/lcms-engine.gemspec +27 -15
- 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/toc_helpers.rb +4 -4
- data/lib/doc_template/objects/toc_metadata.rb +4 -6
- data/lib/doc_template/tags/answer_space_tag.rb +1 -1
- data/lib/doc_template/tags/base_tag.rb +2 -2
- data/lib/doc_template/tags/block_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 +5 -2
- 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 +1 -3
- 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/context.rb +56 -52
- data/lib/lt/lcms/metadata/service.rb +3 -2
- data/lib/tasks/cloud66.rake +2 -2
- data/lib/tasks/document.rake +4 -4
- data/lib/tasks/google.rake +29 -14
- data/lib/tasks/lcms/engine_tasks.rake +1 -1
- data/package.json +31 -10
- data/postcss.config.js +12 -0
- data/spec/controllers/admin/curriculums_controller_spec.rb +23 -0
- data/spec/controllers/admin/documents_controller_spec.rb +22 -2
- data/spec/controllers/admin/materials_controller_spec.rb +16 -3
- data/spec/controllers/admin/resource_bulk_edit_controller_spec.rb +1 -1
- data/spec/controllers/admin/resources_controller_spec.rb +1 -1
- 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/.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/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/routes.rb +6 -0
- data/spec/dummy/db/schema.rb +5 -5
- 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/materials/add_material_spec.rb +2 -0
- data/spec/features/admin/users_spec.rb +2 -2
- 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/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 +41 -0
- data/spec/rails_helper.rb +6 -17
- 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 +3412 -2933
- metadata +152 -289
- 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
@@ -11,7 +11,7 @@ $ub-material-card-margin: 2px;
|
|
11
11
|
@if $depth < 1 {
|
12
12
|
box-shadow: none;
|
13
13
|
} @else if $depth > 5 {
|
14
|
-
@warn
|
14
|
+
@warn 'Invalid $depth `#{$depth}` for mixin `card`.';
|
15
15
|
} @else {
|
16
16
|
box-shadow: bottom-shadow($depth), top-shadow($depth);
|
17
17
|
}
|
@@ -22,7 +22,7 @@ $ub-material-card-margin: 2px;
|
|
22
22
|
@function top-shadow($depth) {
|
23
23
|
$primary-offset: nth(1.5 3 10 14 19, $depth) * 1px;
|
24
24
|
$blur: nth(1.5 3 10 14 19, $depth) * 4px;
|
25
|
-
$color: rgba(#000, nth(.12 .16 .19 .25 3, $depth));
|
25
|
+
$color: rgba(#000, nth(0.12 0.16 0.19 0.25 3, $depth));
|
26
26
|
|
27
27
|
@return 0 $primary-offset $blur $color;
|
28
28
|
}
|
@@ -33,7 +33,7 @@ $ub-material-card-margin: 2px;
|
|
33
33
|
@function bottom-shadow($depth) {
|
34
34
|
$primary-offset: nth(1.5 3 6 10 15, $depth) * 1px;
|
35
35
|
$blur: nth(1 3 3 5 6, $depth) * 4px;
|
36
|
-
$color: rgba(#000, nth(.24 .23 .23 .22 .22, $depth));
|
36
|
+
$color: rgba(#000, nth(0.24 0.23 0.23 0.22 0.22, $depth));
|
37
37
|
|
38
38
|
@return 0 $primary-offset $blur $color;
|
39
39
|
}
|
@@ -41,37 +41,37 @@ $ub-material-card-margin: 2px;
|
|
41
41
|
%material-card {
|
42
42
|
//box-shadow: 0 $ub-material-card-margin $ub-material-card-margin rgba(0, 0, 0, .12);
|
43
43
|
border-radius: $ub-material-radius;
|
44
|
-
box-shadow: 1px 2px 8px rgba(0, 0, 0, .08);
|
44
|
+
box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.08);
|
45
45
|
margin-bottom: $ub-material-card-margin;
|
46
46
|
}
|
47
47
|
|
48
48
|
%map-transition {
|
49
|
-
transition-duration: .4s;
|
49
|
+
transition-duration: 0.4s;
|
50
50
|
transition-property: width, height, min-height, padding;
|
51
51
|
transition-timing-function: ease;
|
52
52
|
}
|
53
53
|
|
54
54
|
%btn-transition {
|
55
|
-
transition-duration: .4s;
|
55
|
+
transition-duration: 0.4s;
|
56
56
|
transition-property: min-width;
|
57
57
|
transition-timing-function: ease-out;
|
58
58
|
}
|
59
59
|
|
60
60
|
%btn-shadow {
|
61
61
|
//@include card(1);
|
62
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
|
62
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
|
63
63
|
}
|
64
64
|
|
65
65
|
%tooltip-shadow {
|
66
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
|
66
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
|
67
67
|
}
|
68
68
|
|
69
69
|
@mixin base-shadow {
|
70
|
-
box-shadow: 1px 2px 8px rgba(0, 0, 0, .08);
|
70
|
+
box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.08);
|
71
71
|
}
|
72
72
|
|
73
73
|
%popup-shadow {
|
74
|
-
box-shadow: 1px 2px 8px rgba(0, 0, 0, .35);
|
74
|
+
box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.35);
|
75
75
|
}
|
76
76
|
|
77
77
|
%base-shadow {
|
@@ -80,7 +80,7 @@ $ub-material-card-margin: 2px;
|
|
80
80
|
|
81
81
|
// fadeIn transition
|
82
82
|
.m-fadeIn-enter {
|
83
|
-
opacity: .01;
|
83
|
+
opacity: 0.01;
|
84
84
|
}
|
85
85
|
|
86
86
|
.m-fadeIn-enter.m-fadeIn-enter-active {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
.cs-rgba-bg {
|
16
16
|
@each $code, $color in $ub-colorcodes {
|
17
17
|
@include m(#{$code}) {
|
18
|
-
background-color: rgba($color, .8);
|
18
|
+
background-color: rgba($color, 0.8);
|
19
19
|
}
|
20
20
|
}
|
21
21
|
}
|
@@ -25,7 +25,10 @@
|
|
25
25
|
@include m(#{$code}) {
|
26
26
|
$tint-color: scale-color($color, $lightness: 90%);
|
27
27
|
background-color: $tint-color;
|
28
|
-
|
28
|
+
|
29
|
+
&::before {
|
30
|
+
border-bottom-color: $tint-color;
|
31
|
+
}
|
29
32
|
}
|
30
33
|
}
|
31
34
|
}
|
@@ -41,7 +44,9 @@
|
|
41
44
|
.cs-txt-link {
|
42
45
|
@each $code, $color in $ub-colorcodes {
|
43
46
|
@include m(#{$code}) {
|
44
|
-
&,
|
47
|
+
&,
|
48
|
+
&:hover,
|
49
|
+
&:focus {
|
45
50
|
color: $color;
|
46
51
|
}
|
47
52
|
}
|
@@ -51,10 +56,15 @@
|
|
51
56
|
.cs-link-bg {
|
52
57
|
@each $code, $color in $ub-colorcodes {
|
53
58
|
@include m(#{$code}) {
|
54
|
-
&,
|
59
|
+
&,
|
60
|
+
&:hover,
|
61
|
+
&:focus {
|
55
62
|
background: none;
|
56
63
|
color: $ub-white;
|
57
|
-
|
64
|
+
|
65
|
+
> div {
|
66
|
+
background-color: $color;
|
67
|
+
}
|
58
68
|
}
|
59
69
|
}
|
60
70
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
// stylelint-disable declaration-no-important
|
1
2
|
$text-sizes: (
|
2
3
|
'base': $global-font-size,
|
3
4
|
'large': $lead-font-size,
|
4
|
-
'small': $small-font-size
|
5
|
+
'small': $small-font-size,
|
5
6
|
);
|
6
7
|
|
7
8
|
.u-text {
|
@@ -12,7 +13,9 @@ $text-sizes: (
|
|
12
13
|
}
|
13
14
|
}
|
14
15
|
|
15
|
-
.u-color--base {
|
16
|
+
.u-color--base {
|
17
|
+
color: $ub-txt !important;
|
18
|
+
}
|
16
19
|
|
17
20
|
.u-text--capitalized {
|
18
21
|
text-transform: capitalize;
|
@@ -42,13 +45,21 @@ $text-sizes: (
|
|
42
45
|
font-weight: bold !important;
|
43
46
|
}
|
44
47
|
|
45
|
-
.u-flex {
|
48
|
+
.u-flex {
|
49
|
+
display: flex;
|
50
|
+
}
|
46
51
|
|
47
|
-
.u-show {
|
52
|
+
.u-show {
|
53
|
+
display: block !important;
|
54
|
+
}
|
48
55
|
|
49
|
-
.u-hidden {
|
56
|
+
.u-hidden {
|
57
|
+
display: none !important;
|
58
|
+
}
|
50
59
|
|
51
|
-
.u-float-none {
|
60
|
+
.u-float-none {
|
61
|
+
float: none !important;
|
62
|
+
}
|
52
63
|
|
53
64
|
$border-radius-aligns: (top-left, bottom-left, top-right, bottom-right);
|
54
65
|
@each $border-radius-align in $border-radius-aligns {
|
@@ -70,7 +81,7 @@ $border-radius-sides: (top, bottom);
|
|
70
81
|
|
71
82
|
$margins: (
|
72
83
|
'zero': 0,
|
73
|
-
'xs': $ub-small-margin * .7,
|
84
|
+
'xs': $ub-small-margin * 0.7,
|
74
85
|
'small': $ub-small-margin,
|
75
86
|
'base': $ub-base-margin,
|
76
87
|
'large': $ub-large-margin,
|
@@ -100,7 +111,7 @@ $margins-align: (top, bottom, right, left);
|
|
100
111
|
$paddings: (
|
101
112
|
'zero': 0,
|
102
113
|
'tiny': 5px,
|
103
|
-
'xs': $ub-small-margin * .7,
|
114
|
+
'xs': $ub-small-margin * 0.7,
|
104
115
|
'small': $ub-small-margin,
|
105
116
|
'base': $ub-base-margin,
|
106
117
|
'large': $ub-large-margin,
|
@@ -127,7 +138,7 @@ $align-types: (padding, margin);
|
|
127
138
|
@each $align-dir in $align-directions {
|
128
139
|
@each $align-type in $align-types {
|
129
140
|
.u-#{$align-type}-#{$align-dir}--gutter-half {
|
130
|
-
@include add-gutter($type: #{$align-type}, $subtype: #{$align-dir}, $x: .5);
|
141
|
+
@include add-gutter($type: #{$align-type}, $subtype: #{$align-dir}, $x: 0.5);
|
131
142
|
}
|
132
143
|
|
133
144
|
.u-#{$align-type}-#{$align-dir}--gutter {
|
@@ -162,7 +173,7 @@ $bg: (
|
|
162
173
|
.u-wrap {
|
163
174
|
@each $bg-type, $bg-color in $bg {
|
164
175
|
@include m($bg-type) {
|
165
|
-
@extend .u-bg--#{$bg-type};
|
176
|
+
@extend .u-bg--#{$bg-type}; // stylelint-disable-line scss/at-extend-no-missing-placeholder
|
166
177
|
padding: $ub-base-padding;
|
167
178
|
}
|
168
179
|
}
|
@@ -177,7 +188,8 @@ $bg: (
|
|
177
188
|
}
|
178
189
|
|
179
190
|
.u-link--disabled {
|
180
|
-
&,
|
191
|
+
&,
|
192
|
+
a {
|
181
193
|
color: $medium-gray;
|
182
194
|
cursor: not-allowed;
|
183
195
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%u-ph-img--light{
|
1
|
+
%u-ph-img--light {
|
2
2
|
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSIxNDBweCIgaGVpZ2h0PSIxNDBweCIgdmlld0JveD0iMCAwIDE0MCAxNDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8Zz4KCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2Y1ZjVmNSIgc3Ryb2tlLXdpZHRoPSIuNSIgeDE9IjAiIHkxPSIxNDAiIHgyPSIxNDAiIHkyPSIwIi8+CiAgPGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZjVmNWY1IiBzdHJva2Utd2lkdGg9Ii41IiB4MT0iMCIgeTE9IjAiIHgyPSIxNDAiIHkyPSIxNDAiLz4KPC9nPgo8L3N2Zz4K');
|
3
3
|
background-repeat: no-repeat;
|
4
4
|
background-size: 100% 100%;
|
@@ -15,18 +15,18 @@ $ub-base-padding: 1rem;
|
|
15
15
|
$ub-large-margin: $ub-base-margin * 1.5;
|
16
16
|
$ub-xlarge-margin: $ub-base-margin * 2;
|
17
17
|
$ub-xxlarge-margin: $ub-base-margin * 3;
|
18
|
-
$ub-small-margin: $ub-base-margin * .75;
|
19
|
-
$ub-tiny-margin: 1rem * .06;
|
18
|
+
$ub-small-margin: $ub-base-margin * 0.75;
|
19
|
+
$ub-tiny-margin: 1rem * 0.06;
|
20
20
|
$ub-large-padding: $ub-base-padding * 1.5;
|
21
21
|
$ub-xlarge-padding: $ub-base-padding * 2;
|
22
|
-
$ub-small-padding: $ub-base-padding * .75;
|
23
|
-
$ub-xs-padding: $ub-small-padding * .7;
|
24
|
-
$ub-tiny-padding: $ub-base-padding * .06;
|
22
|
+
$ub-small-padding: $ub-base-padding * 0.75;
|
23
|
+
$ub-xs-padding: $ub-small-padding * 0.7;
|
24
|
+
$ub-tiny-padding: $ub-base-padding * 0.06;
|
25
25
|
|
26
26
|
// Base element sizes
|
27
27
|
$curriculum-map-width: (
|
28
28
|
base: 230px,
|
29
|
-
medium: 180px
|
29
|
+
medium: 180px,
|
30
30
|
);
|
31
31
|
$curriculum-card-short-top: -6px;
|
32
32
|
|
@@ -37,24 +37,24 @@ $filterbar-xs-3: (($filterbar-square + 1) * 5 - 1) / 3;
|
|
37
37
|
$filterbar-rectangle-2: (
|
38
38
|
small: $filterbar-xs,
|
39
39
|
ipad: 218px,
|
40
|
-
large: 115px
|
40
|
+
large: 115px,
|
41
41
|
);
|
42
42
|
$filterbar-rectangle-3: (
|
43
43
|
small: $filterbar-xs-3 - 1px,
|
44
44
|
ipad: 108px,
|
45
|
-
large: 75px
|
45
|
+
large: 75px,
|
46
46
|
);
|
47
47
|
$filterbar-rectangle-big: (
|
48
48
|
small: $filterbar-xs - 1px,
|
49
|
-
ipad: 157px
|
49
|
+
ipad: 157px,
|
50
50
|
);
|
51
51
|
$ld-sticky-header-height: (
|
52
52
|
small: 75px,
|
53
|
-
large: $ub-nav-height
|
53
|
+
large: $ub-nav-height,
|
54
54
|
);
|
55
55
|
$ld-sticky-header-padding: (
|
56
56
|
small: 1rem,
|
57
|
-
large: .5rem
|
57
|
+
large: 0.5rem,
|
58
58
|
);
|
59
59
|
$ld-tooltip-offset: 1.5rem;
|
60
60
|
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
.react-tagsinput {
|
2
|
+
background-color: #fff;
|
3
|
+
border: 1px solid #ccc;
|
4
|
+
overflow: hidden;
|
5
|
+
padding-left: 5px;
|
6
|
+
padding-top: 5px;
|
7
|
+
}
|
8
|
+
|
9
|
+
.react-tagsinput--focused {
|
10
|
+
border-color: #a5d24a;
|
11
|
+
}
|
12
|
+
|
13
|
+
.react-tagsinput-tag {
|
14
|
+
background-color: #cde69c;
|
15
|
+
border-radius: 2px;
|
16
|
+
border: 1px solid #a5d24a;
|
17
|
+
color: #638421;
|
18
|
+
display: inline-block;
|
19
|
+
font-family: sans-serif;
|
20
|
+
font-size: 13px;
|
21
|
+
font-weight: 400;
|
22
|
+
margin-bottom: 5px;
|
23
|
+
margin-right: 5px;
|
24
|
+
padding: 5px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.react-tagsinput-remove {
|
28
|
+
cursor: pointer;
|
29
|
+
font-weight: bold;
|
30
|
+
}
|
31
|
+
|
32
|
+
.react-tagsinput-tag a::before {
|
33
|
+
content: " ×";
|
34
|
+
}
|
35
|
+
|
36
|
+
.react-tagsinput-input {
|
37
|
+
background: transparent;
|
38
|
+
border: 0;
|
39
|
+
color: #777;
|
40
|
+
font-family: sans-serif;
|
41
|
+
font-size: 13px;
|
42
|
+
font-weight: 400;
|
43
|
+
margin-bottom: 6px;
|
44
|
+
margin-top: 1px;
|
45
|
+
outline: none;
|
46
|
+
padding: 5px;
|
47
|
+
width: 80px;
|
48
|
+
}
|
@@ -9,7 +9,7 @@ module Lcms
|
|
9
9
|
def create
|
10
10
|
@access_code = AccessCode.new(permitted_params)
|
11
11
|
if @access_code.save
|
12
|
-
redirect_to
|
12
|
+
redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
|
13
13
|
else
|
14
14
|
render :new
|
15
15
|
end
|
@@ -17,7 +17,11 @@ module Lcms
|
|
17
17
|
|
18
18
|
def destroy
|
19
19
|
@access_code.destroy
|
20
|
-
redirect_to
|
20
|
+
redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
|
21
|
+
end
|
22
|
+
|
23
|
+
def edit
|
24
|
+
@url = lcms_engine.admin_access_code_path(@access_code)
|
21
25
|
end
|
22
26
|
|
23
27
|
def index
|
@@ -30,8 +34,9 @@ module Lcms
|
|
30
34
|
|
31
35
|
def update
|
32
36
|
if @access_code.update(permitted_params)
|
33
|
-
redirect_to
|
37
|
+
redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
|
34
38
|
else
|
39
|
+
@url = lcms_engine.admin_access_code_path(@access_code)
|
35
40
|
render :edit
|
36
41
|
end
|
37
42
|
end
|
@@ -4,6 +4,8 @@ module Lcms
|
|
4
4
|
module Engine
|
5
5
|
module Admin
|
6
6
|
class AdminController < Lcms::Engine::ApplicationController
|
7
|
+
include Lcms::Engine::PathHelper
|
8
|
+
|
7
9
|
CONFIG_PATH ||= Rails.root.join('config', 'lcms-admin.yml')
|
8
10
|
|
9
11
|
DEFAULTS ||= {
|
@@ -17,50 +19,14 @@ module Lcms
|
|
17
19
|
|
18
20
|
before_action :authenticate_admin!
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
@settings ||= DEFAULTS.merge((YAML.load_file(CONFIG_PATH) || {}).deep_symbolize_keys)
|
23
|
-
end
|
24
|
-
|
25
|
-
def engine_klass
|
26
|
-
@engine_klass ||= settings[:engine]&.constantize || ::Lcms::Engine::Engine
|
27
|
-
end
|
28
|
-
|
29
|
-
def document_path(*args)
|
30
|
-
host_engine_path(:document_path, *args).presence || url_helpers.document_path(*args)
|
31
|
-
end
|
32
|
-
|
33
|
-
def material_path(*args)
|
34
|
-
host_engine_path(:material_path, *args).presence || url_helpers.material_path(*args)
|
35
|
-
end
|
36
|
-
|
37
|
-
def root_path
|
38
|
-
host_engine_path(:root_path).presence || url_helpers.root_path
|
39
|
-
end
|
40
|
-
|
41
|
-
def host_engine_path(key, *args)
|
42
|
-
if (host_route = settings.dig(:redirect, :host, key)).present?
|
43
|
-
Rails.application.routes.url_helpers.send(host_route, *args)
|
44
|
-
elsif (engine_route = settings.dig(:redirect, :engine, key)).present?
|
45
|
-
engine_klass.routes.url_helpers.send(engine_route, *args)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def url_helpers
|
52
|
-
Rails.application.routes.url_helpers
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def whoami
|
57
|
-
render text: "stack=#{ENV['CLOUD66_STACK_NAME']}<br/>env=#{ENV['CLOUD66_STACK_ENVIRONMENT']}"
|
22
|
+
def self.settings
|
23
|
+
@settings ||= DEFAULTS.merge((YAML.load_file(CONFIG_PATH) || {}).deep_symbolize_keys)
|
58
24
|
end
|
59
25
|
|
60
26
|
private
|
61
27
|
|
62
28
|
def authenticate_admin!
|
63
|
-
redirect_to
|
29
|
+
redirect_to dynamic_path(:root_path), alert: 'Access denied' unless current_user&.admin?
|
64
30
|
end
|
65
31
|
|
66
32
|
def customized_layout
|
@@ -29,7 +29,10 @@ module Lcms
|
|
29
29
|
def index_params
|
30
30
|
@index_params ||=
|
31
31
|
begin
|
32
|
-
expected_params = params
|
32
|
+
expected_params = params
|
33
|
+
.permit(:association, :page, :pagination, :allowCreate, :allowMultiple,
|
34
|
+
:onClickDone, :onSelectItem, :q)
|
35
|
+
.to_h.symbolize_keys
|
33
36
|
index_p = { q: nil }.merge(expected_params)
|
34
37
|
|
35
38
|
raise StandardError unless VALID_ASSOCIATIONS.include?(index_p[:association])
|
@@ -5,11 +5,11 @@ module Lcms
|
|
5
5
|
module Admin
|
6
6
|
class BatchReimportsController < AdminController
|
7
7
|
def new
|
8
|
-
@query = OpenStruct.new(params[:query])
|
8
|
+
@query = OpenStruct.new(params[:query]) # rubocop:disable Style/OpenStructUse
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
@query = OpenStruct.new params[:query].except(:type)
|
12
|
+
@query = OpenStruct.new params[:query].except(:type) # rubocop:disable Style/OpenStructUse
|
13
13
|
entries = if materials?
|
14
14
|
DocTemplate.config['queries']['material'].constantize.call(@query)
|
15
15
|
else
|
@@ -8,15 +8,34 @@ module Lcms
|
|
8
8
|
@curriculum = CurriculumPresenter.new
|
9
9
|
end
|
10
10
|
|
11
|
+
def children
|
12
|
+
id = params[:id]
|
13
|
+
resources =
|
14
|
+
if id == '#'
|
15
|
+
Lcms::Engine::Resource.tree.ordered.roots
|
16
|
+
else
|
17
|
+
Array.wrap(Lcms::Engine::Resource.tree.find(id)&.children)
|
18
|
+
end
|
19
|
+
|
20
|
+
render json: resources.map { |res| CurriculumPresenter.new.parse_jstree_node(res) }
|
21
|
+
end
|
22
|
+
|
11
23
|
def update
|
12
|
-
@form = CurriculumForm.new(
|
24
|
+
@form = CurriculumForm.new(curriculum_update_params)
|
13
25
|
if @form.save
|
14
|
-
redirect_to
|
26
|
+
redirect_to lcms_engine.edit_admin_curriculum_path,
|
27
|
+
notice: t('.success')
|
15
28
|
else
|
16
29
|
@curriculum = CurriculumPresenter.new
|
17
30
|
render :edit, alert: t('.error')
|
18
31
|
end
|
19
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def curriculum_update_params
|
37
|
+
params.require(:curriculum).permit(:change_log)
|
38
|
+
end
|
20
39
|
end
|
21
40
|
end
|
22
41
|
end
|
@@ -1,44 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'lt/lcms/lesson/downloader/gdoc'
|
4
|
-
|
5
3
|
module Lcms
|
6
4
|
module Engine
|
7
5
|
module Admin
|
8
6
|
class DocumentsController < AdminController
|
9
7
|
include Lcms::Engine::GoogleCredentials
|
8
|
+
include Lcms::Engine::PathHelper
|
10
9
|
include Reimportable
|
11
10
|
|
12
11
|
before_action :find_selected, only: %i(destroy_selected reimport_selected)
|
13
12
|
before_action :set_query_params
|
14
13
|
|
15
14
|
def index
|
16
|
-
@query = OpenStruct.new @query_params
|
15
|
+
@query = OpenStruct.new @query_params # rubocop:disable Style/OpenStructUse
|
17
16
|
@documents = DocTemplate.config['queries']['document'].constantize.call(@query, page: params[:page])
|
18
17
|
render_customized_view
|
19
18
|
end
|
20
19
|
|
21
20
|
def create
|
22
|
-
|
21
|
+
@document = DocumentForm.new(form_params.except(:async, :with_materials))
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
notice: t('.success', name: @document.document.name, errors: collect_errors)
|
28
|
-
else
|
29
|
-
render :new
|
30
|
-
end
|
23
|
+
return create_multiple if form_params[:link].match?(RE_GOOGLE_FOLDER)
|
24
|
+
|
25
|
+
form_params[:async].to_i.zero? ? create_sync : create_async
|
31
26
|
end
|
32
27
|
|
33
28
|
def destroy
|
34
29
|
@document = Document.find(params[:id])
|
35
30
|
@document.destroy
|
36
|
-
redirect_to admin_documents_path(query: @query_params), notice: t('.success')
|
31
|
+
redirect_to lcms_engine.admin_documents_path(query: @query_params), notice: t('.success')
|
37
32
|
end
|
38
33
|
|
39
34
|
def destroy_selected
|
40
35
|
count = @documents.destroy_all.count
|
41
|
-
redirect_to admin_documents_path(query: @query_params), notice: t('.success', count: count)
|
36
|
+
redirect_to lcms_engine.admin_documents_path(query: @query_params), notice: t('.success', count: count)
|
42
37
|
end
|
43
38
|
|
44
39
|
def import_status
|
@@ -57,6 +52,23 @@ module Lcms
|
|
57
52
|
|
58
53
|
private
|
59
54
|
|
55
|
+
def create_async
|
56
|
+
bulk_import(Array.wrap(form_params[:link]))
|
57
|
+
render :import
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_sync
|
61
|
+
reimport_lesson_materials if form_params[:with_materials].present?
|
62
|
+
if @document.save
|
63
|
+
notice = t('lcms.engine.admin.documents.create.success',
|
64
|
+
name: @document.document.name,
|
65
|
+
errors: collect_errors)
|
66
|
+
redirect_to dynamic_document_path(@document.document), notice: notice
|
67
|
+
else
|
68
|
+
render :new
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
60
72
|
def bulk_import(docs)
|
61
73
|
reimport_materials = params[:with_materials].to_i.nonzero?
|
62
74
|
jobs = docs.each_with_object({}) do |doc, jobs_|
|
@@ -91,7 +103,7 @@ module Lcms
|
|
91
103
|
def form_params
|
92
104
|
@form_params ||=
|
93
105
|
begin
|
94
|
-
data = params.require(:document_form).permit(:link, :link_fs, :reimport, :with_materials).to_h
|
106
|
+
data = params.require(:document_form).permit(:async, :link, :link_fs, :reimport, :with_materials).to_h
|
95
107
|
data.delete(:with_materials) if data[:with_materials].to_i.zero?
|
96
108
|
data
|
97
109
|
end
|