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
@@ -1,36 +1,46 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import _ from 'lodash';
|
3
4
|
|
4
5
|
function AssociationPickerResults(props) {
|
5
|
-
let items
|
6
|
+
let items;
|
6
7
|
|
7
|
-
const shouldAllowCreate =
|
8
|
-
&& props.allowCreate && props.items.length === 0
|
8
|
+
const shouldAllowCreate =
|
9
|
+
_.isString(props.value) && props.value.length > 0 && props.allowCreate && props.items.length === 0;
|
9
10
|
|
10
|
-
const selectedIds = _.map(props.selectedItems, 'id')
|
11
|
-
const isSelected =
|
12
|
-
return _.includes(selectedIds, item.id)
|
13
|
-
}
|
11
|
+
const selectedIds = _.map(props.selectedItems, 'id');
|
12
|
+
const isSelected = item => {
|
13
|
+
return _.includes(selectedIds, item.id);
|
14
|
+
};
|
14
15
|
|
15
16
|
if (shouldAllowCreate) {
|
16
|
-
let newItem = { id: props.value, name: props.value, _create: true }
|
17
|
-
items = [
|
17
|
+
let newItem = { id: props.value, name: props.value, _create: true };
|
18
|
+
items = [
|
19
|
+
/* eslint-disable react/jsx-no-bind */
|
18
20
|
<tr key={newItem.id}>
|
19
21
|
<td onClick={() => props.onSelectItem(newItem)}>
|
20
22
|
{props.value}
|
21
23
|
<span className="o-assocpicker-create">(Create)</span>
|
22
24
|
</td>
|
23
|
-
</tr
|
24
|
-
|
25
|
+
</tr>,
|
26
|
+
/* eslint-enable react/jsx-no-bind */
|
27
|
+
];
|
25
28
|
} else {
|
26
29
|
items = props.items.map(item => {
|
27
|
-
let newItem = {
|
30
|
+
let newItem = {
|
31
|
+
id: item.id,
|
32
|
+
name: item.name,
|
33
|
+
_create: false,
|
34
|
+
_selected: isSelected(item),
|
35
|
+
};
|
28
36
|
return (
|
37
|
+
/* eslint-disable react/jsx-no-bind */
|
29
38
|
<tr key={newItem.id} className={newItem._selected ? 'active' : ''}>
|
30
39
|
<td onClick={() => props.onSelectItem(newItem)}>{newItem.name}</td>
|
31
40
|
</tr>
|
32
|
-
|
33
|
-
|
41
|
+
/* eslint-enable react/jsx-no-bind */
|
42
|
+
);
|
43
|
+
});
|
34
44
|
}
|
35
45
|
|
36
46
|
return (
|
@@ -41,10 +51,24 @@ function AssociationPickerResults(props) {
|
|
41
51
|
</tr>
|
42
52
|
</thead>
|
43
53
|
<tbody>
|
44
|
-
{items.length ?
|
54
|
+
{items.length ? (
|
55
|
+
items
|
56
|
+
) : (
|
57
|
+
<tr>
|
58
|
+
<td>Nothing to select</td>
|
59
|
+
</tr>
|
60
|
+
)}
|
45
61
|
</tbody>
|
46
62
|
</table>
|
47
|
-
)
|
63
|
+
);
|
48
64
|
}
|
49
65
|
|
50
|
-
|
66
|
+
AssociationPickerResults.propTypes = {
|
67
|
+
value: PropTypes.string,
|
68
|
+
allowCreate: PropTypes.bool,
|
69
|
+
items: PropTypes.array,
|
70
|
+
selectedItems: PropTypes.array,
|
71
|
+
onSelectItem: PropTypes.func,
|
72
|
+
};
|
73
|
+
|
74
|
+
export default AssociationPickerResults;
|
@@ -1,36 +1,39 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import _ from 'lodash'
|
3
|
-
import
|
1
|
+
import React from 'react';
|
2
|
+
import _ from 'lodash';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import AssociationPickerResults from './AssociationPickerResults';
|
4
5
|
|
5
6
|
class AssociationPickerWindow extends React.Component {
|
6
7
|
constructor(props) {
|
7
|
-
super(props)
|
8
|
+
super(props);
|
8
9
|
|
9
|
-
this.state = { ...props, selectedItems: [] }
|
10
|
+
this.state = { ...props, selectedItems: [] };
|
11
|
+
|
12
|
+
this.selectItem = this.selectItem.bind(this);
|
10
13
|
}
|
11
14
|
|
12
15
|
selectItem(item) {
|
13
|
-
const operation = this.updateSelectedItems(item)
|
16
|
+
const operation = this.updateSelectedItems(item);
|
14
17
|
if ('onSelectItem' in this.props) {
|
15
|
-
this.props.onSelectItem(item, operation)
|
18
|
+
this.props.onSelectItem(item, operation);
|
16
19
|
}
|
17
20
|
}
|
18
21
|
|
19
22
|
updateSelectedItems(item) {
|
20
|
-
let operation, newItems
|
23
|
+
let operation, newItems;
|
21
24
|
if (item._selected) {
|
22
|
-
newItems = _.filter(this.state.selectedItems, r => r.id !== item.id)
|
23
|
-
operation = 'removed'
|
25
|
+
newItems = _.filter(this.state.selectedItems, r => r.id !== item.id);
|
26
|
+
operation = 'removed';
|
24
27
|
} else {
|
25
|
-
newItems = [...this.state.selectedItems, item]
|
26
|
-
operation = 'added'
|
28
|
+
newItems = [...this.state.selectedItems, item];
|
29
|
+
operation = 'added';
|
27
30
|
}
|
28
|
-
this.setState(...this.state, { selectedItems: newItems })
|
29
|
-
return operation
|
31
|
+
this.setState(...this.state, { selectedItems: newItems });
|
32
|
+
return operation;
|
30
33
|
}
|
31
34
|
|
32
35
|
render() {
|
33
|
-
const { q, results } = this.props
|
36
|
+
const { q, results } = this.props;
|
34
37
|
|
35
38
|
return (
|
36
39
|
<div className="o-assocpicker">
|
@@ -38,8 +41,15 @@ class AssociationPickerWindow extends React.Component {
|
|
38
41
|
<div className="o-page__module">
|
39
42
|
<h4 className="text-center">Select item</h4>
|
40
43
|
<div className="row">
|
41
|
-
<label className="medium-3 columns">
|
42
|
-
|
44
|
+
<label className="medium-3 columns">
|
45
|
+
Name
|
46
|
+
{/*
|
47
|
+
eslint-disable react/jsx-no-bind
|
48
|
+
*/}
|
49
|
+
<input type="text" value={q || ''} onChange={this.props.onFilterChange.bind(this, 'q')} />
|
50
|
+
{/*
|
51
|
+
eslint-enable react/jsx-no-bind
|
52
|
+
*/}
|
43
53
|
</label>
|
44
54
|
</div>
|
45
55
|
</div>
|
@@ -52,23 +62,32 @@ class AssociationPickerWindow extends React.Component {
|
|
52
62
|
items={results}
|
53
63
|
selectedItems={this.state.selectedItems}
|
54
64
|
allowCreate={this.props.allowCreate}
|
55
|
-
|
56
|
-
onSelectItem={this.selectItem.bind(this)}
|
65
|
+
onSelectItem={this.selectItem}
|
57
66
|
/>
|
58
67
|
|
59
|
-
{
|
68
|
+
{this.props.pagination()}
|
60
69
|
|
61
|
-
{
|
62
|
-
<button type="button"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
70
|
+
{this.props.allowMultiple ? (
|
71
|
+
<button type="button" className="button c-assocpicker-submit" onClick={this.props.onClickDone}>
|
72
|
+
Submit
|
73
|
+
</button>
|
74
|
+
) : null}
|
67
75
|
</div>
|
68
76
|
</div>
|
69
77
|
</div>
|
70
|
-
)
|
78
|
+
);
|
71
79
|
}
|
72
80
|
}
|
73
81
|
|
74
|
-
|
82
|
+
AssociationPickerWindow.propTypes = {
|
83
|
+
onSelectItem: PropTypes.func,
|
84
|
+
q: PropTypes.string,
|
85
|
+
results: PropTypes.array,
|
86
|
+
onFilterChange: PropTypes.func,
|
87
|
+
allowCreate: PropTypes.bool,
|
88
|
+
pagination: PropTypes.func,
|
89
|
+
allowMultiple: PropTypes.bool,
|
90
|
+
onClickDone: PropTypes.func,
|
91
|
+
};
|
92
|
+
|
93
|
+
export default AssociationPickerWindow;
|
@@ -1,39 +1,49 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import ReactDOM from 'react-dom'
|
3
|
-
import
|
1
|
+
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import _ from 'lodash';
|
5
|
+
import $ from 'jquery';
|
6
|
+
import '../../../vendor/jstree/jstree.min';
|
4
7
|
|
5
8
|
class CurriculumEditor extends React.Component {
|
6
9
|
constructor(props) {
|
7
|
-
super(props)
|
10
|
+
super(props);
|
8
11
|
this.state = {
|
9
|
-
data: props.tree,
|
10
12
|
changeLog: [],
|
11
13
|
createdIds: [],
|
12
|
-
}
|
14
|
+
};
|
15
|
+
|
16
|
+
this.onSubmit = this.onSubmit.bind(this);
|
13
17
|
}
|
14
18
|
|
15
19
|
componentDidMount() {
|
16
|
-
|
17
|
-
$this
|
20
|
+
// eslint-disable-next-line react/no-find-dom-node
|
21
|
+
const $this = $(ReactDOM.findDOMNode(this));
|
22
|
+
$this.parent().addClass('o-curriculum-tree-editor__container');
|
18
23
|
|
19
|
-
const editor = $this.find('#curriculum-tree-editor')
|
24
|
+
const editor = $this.find('#curriculum-tree-editor');
|
20
25
|
editor
|
21
26
|
.on('rename_node.jstree', this.onRenameNode.bind(this))
|
22
27
|
.on('move_node.jstree', this.onMoveNode.bind(this))
|
23
28
|
.on('create_node.jstree', this.onCreateNode.bind(this))
|
24
29
|
.on('delete_node.jstree', this.onDeleteNode.bind(this))
|
25
30
|
.jstree({
|
26
|
-
core
|
27
|
-
animation
|
31
|
+
core: {
|
32
|
+
animation: 0,
|
28
33
|
themes: { dots: true },
|
29
34
|
check_callback: true,
|
30
|
-
data
|
35
|
+
data: {
|
36
|
+
url: this.props.path,
|
37
|
+
data: node => {
|
38
|
+
return { id: node.id };
|
39
|
+
},
|
40
|
+
},
|
31
41
|
},
|
32
|
-
plugins
|
33
|
-
})
|
42
|
+
plugins: ['contextmenu', 'dnd', 'wholerow', 'changed'],
|
43
|
+
});
|
34
44
|
|
35
45
|
// preserve jsTree reference so we can call methods directly
|
36
|
-
this.jsTree = editor.data('jstree')
|
46
|
+
this.jsTree = editor.data('jstree');
|
37
47
|
}
|
38
48
|
|
39
49
|
onRenameNode(_e, data) {
|
@@ -45,9 +55,11 @@ class CurriculumEditor extends React.Component {
|
|
45
55
|
curriculum: this.hierarchy(data.node.parent),
|
46
56
|
op: 'create',
|
47
57
|
name: data.node.text,
|
48
|
-
})
|
49
|
-
this.setState({
|
50
|
-
|
58
|
+
});
|
59
|
+
this.setState({
|
60
|
+
...this.state,
|
61
|
+
createdIds: _.pull(this.state.createdIds, data.node.id),
|
62
|
+
});
|
51
63
|
} else {
|
52
64
|
this.appendToChangelog({
|
53
65
|
id: data.node.id,
|
@@ -55,7 +67,7 @@ class CurriculumEditor extends React.Component {
|
|
55
67
|
op: 'rename',
|
56
68
|
from: data.old,
|
57
69
|
to: data.text,
|
58
|
-
})
|
70
|
+
});
|
59
71
|
}
|
60
72
|
}
|
61
73
|
|
@@ -68,12 +80,12 @@ class CurriculumEditor extends React.Component {
|
|
68
80
|
curriculum: this.hierarchy(data.old_parent).concat(data.node.text),
|
69
81
|
parent_curriculum: this.hierarchy(data.parent),
|
70
82
|
position: data.position,
|
71
|
-
})
|
83
|
+
});
|
72
84
|
}
|
73
85
|
|
74
86
|
onCreateNode(_e, data) {
|
75
|
-
const createdIds = this.state.createdIds.concat(data.node.id)
|
76
|
-
this.setState({...this.state, createdIds: createdIds})
|
87
|
+
const createdIds = this.state.createdIds.concat(data.node.id);
|
88
|
+
this.setState({ ...this.state, createdIds: createdIds });
|
77
89
|
}
|
78
90
|
|
79
91
|
onDeleteNode(_e, data) {
|
@@ -82,45 +94,54 @@ class CurriculumEditor extends React.Component {
|
|
82
94
|
op: 'remove',
|
83
95
|
curriculum: this.hierarchy(data.node),
|
84
96
|
name: data.node.text,
|
85
|
-
})
|
97
|
+
});
|
86
98
|
}
|
87
99
|
|
88
100
|
hierarchy(node) {
|
89
101
|
if (typeof node === 'string') {
|
90
|
-
node = this.jsTree.get_node(node, false)
|
102
|
+
node = this.jsTree.get_node(node, false);
|
91
103
|
}
|
92
104
|
return node.parents
|
93
105
|
.map(el => this.jsTree.get_node(el, false).text)
|
94
106
|
.reverse()
|
95
107
|
.slice(1)
|
96
|
-
.concat(node.text)
|
108
|
+
.concat(node.text);
|
97
109
|
}
|
98
110
|
|
99
111
|
appendToChangelog(newEntry) {
|
100
|
-
const changeLog = this.state.changeLog.concat(newEntry)
|
101
|
-
this.setState({...this.state, changeLog: changeLog})
|
112
|
+
const changeLog = this.state.changeLog.concat(newEntry);
|
113
|
+
this.setState({ ...this.state, changeLog: changeLog });
|
102
114
|
}
|
103
115
|
|
104
116
|
onSubmit(_e) {
|
105
|
-
$(_e.target).find('input[type=submit]').prop('disabled', true)
|
117
|
+
$(_e.target).find('input[type=submit]').prop('disabled', true);
|
106
118
|
}
|
107
119
|
|
108
120
|
render() {
|
109
|
-
const jsonChangeLog = JSON.stringify(this.state.changeLog)
|
121
|
+
const jsonChangeLog = JSON.stringify(this.state.changeLog);
|
110
122
|
return (
|
111
123
|
<div>
|
112
|
-
<form action={this.props.form_url} acceptCharset="UTF-8" method="post" onSubmit={this.onSubmit
|
124
|
+
<form action={this.props.form_url} acceptCharset="UTF-8" method="post" onSubmit={this.onSubmit}>
|
113
125
|
<input name="utf8" value="✓" type="hidden" />
|
114
126
|
<input name="_method" value="patch" type="hidden" />
|
115
127
|
<input name="authenticity_token" value={this.props.form_token} type="hidden" />
|
116
128
|
<input name="curriculum[change_log]" type="hidden" value={jsonChangeLog} />
|
117
129
|
<input value="Save Changes" className="button primary" type="submit" />
|
118
130
|
</form>
|
119
|
-
<p className="o-curriculum-tree-editor__menu-info">
|
131
|
+
<p className="o-curriculum-tree-editor__menu-info">
|
132
|
+
(Click on a node with the right button to add/edit/remove)
|
133
|
+
</p>
|
120
134
|
<div id="curriculum-tree-editor" className="o-curriculum-tree-editor"></div>
|
121
135
|
</div>
|
122
|
-
)
|
136
|
+
);
|
123
137
|
}
|
124
138
|
}
|
125
139
|
|
126
|
-
|
140
|
+
CurriculumEditor.propTypes = {
|
141
|
+
tree: PropTypes.array,
|
142
|
+
form_url: PropTypes.string,
|
143
|
+
form_token: PropTypes.string,
|
144
|
+
path: PropTypes.string,
|
145
|
+
};
|
146
|
+
|
147
|
+
export default CurriculumEditor;
|
@@ -1,65 +1,68 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import ReactDOM from 'react-dom'
|
1
|
+
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { Foundation } from 'foundation-sites';
|
5
|
+
import TagsInput from 'react-tagsinput';
|
6
|
+
import $ from 'jquery';
|
7
|
+
import '../../../vendor/jstree/jstree.min';
|
3
8
|
|
4
9
|
class DirectoryPicker extends React.Component {
|
5
10
|
constructor(props) {
|
6
|
-
super(props)
|
11
|
+
super(props);
|
7
12
|
this.state = {
|
8
|
-
tree: props.tree,
|
9
13
|
directory: props.directory,
|
10
14
|
parent: props.parent,
|
11
|
-
}
|
15
|
+
};
|
16
|
+
|
17
|
+
this.onClick = this.onClick.bind(this);
|
18
|
+
this.handleDirChange = this.handleDirChange.bind(this);
|
12
19
|
}
|
13
20
|
|
14
21
|
componentDidMount() {
|
15
|
-
|
16
|
-
$this
|
22
|
+
// eslint-disable-next-line react/no-find-dom-node
|
23
|
+
const $this = $(ReactDOM.findDOMNode(this));
|
24
|
+
$this.parent().addClass('o-curriculum-tree-picker__container');
|
17
25
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
const editor = $this.find('#curriculum-tree-picker');
|
27
|
+
editor.on('changed.jstree', this.onChanged.bind(this)).jstree({
|
28
|
+
core: {
|
29
|
+
animation: 0,
|
30
|
+
themes: { dots: true },
|
31
|
+
check_callback: true,
|
32
|
+
data: {
|
33
|
+
url: this.props.path,
|
34
|
+
data: node => {
|
35
|
+
return { id: node.id };
|
36
|
+
},
|
28
37
|
},
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
this.jsTree = editor.data('jstree')
|
38
|
+
},
|
39
|
+
plugins: ['wholerow', 'changed'],
|
40
|
+
});
|
41
|
+
this.jsTree = editor.data('jstree');
|
34
42
|
|
35
|
-
|
36
|
-
this.
|
37
|
-
this.
|
38
|
-
height: '2.5em',
|
39
|
-
width:'65%',
|
40
|
-
})
|
41
|
-
|
42
|
-
// start modal
|
43
|
-
this.jqmodal = $this.find('#curriculum-picker-modal')
|
44
|
-
new Foundation.Reveal(this.jqmodal, null)
|
43
|
+
Foundation.addToJquery($);
|
44
|
+
this.jqmodal = $this.find('#curriculum-picker-modal');
|
45
|
+
new Foundation.Reveal(this.jqmodal, null);
|
45
46
|
}
|
46
47
|
|
47
48
|
closeModal() {
|
48
|
-
this.jqmodal.foundation('close')
|
49
|
+
this.jqmodal.foundation('close');
|
49
50
|
}
|
50
51
|
|
51
52
|
onChanged(_e, data) {
|
52
|
-
const dir = this.directory(data.node)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
const dir = this.directory(data.node);
|
54
|
+
const parent = {
|
55
|
+
id: data.node.id,
|
56
|
+
title: data.node.li_attr.title,
|
57
|
+
directory: dir,
|
58
|
+
};
|
59
|
+
this.setState({ directory: dir, parent: parent });
|
60
|
+
this.closeModal();
|
58
61
|
}
|
59
62
|
|
60
63
|
onClick(e) {
|
61
|
-
e.preventDefault()
|
62
|
-
this.jqmodal.foundation('open')
|
64
|
+
e.preventDefault();
|
65
|
+
this.jqmodal.foundation('open');
|
63
66
|
}
|
64
67
|
|
65
68
|
directory(node) {
|
@@ -67,32 +70,56 @@ class DirectoryPicker extends React.Component {
|
|
67
70
|
.map(el => this.jsTree.get_node(el, null).text)
|
68
71
|
.reverse()
|
69
72
|
.slice(1)
|
70
|
-
.concat(node.text)
|
73
|
+
.concat(node.text);
|
74
|
+
}
|
75
|
+
|
76
|
+
handleDirChange(tags) {
|
77
|
+
this.setState({ directory: tags });
|
71
78
|
}
|
72
79
|
|
73
80
|
render() {
|
74
|
-
const
|
75
|
-
const
|
76
|
-
const parent_aside = (curr.length > 0) ? `(${curr.join(' | ')}) : ` : ''
|
81
|
+
const curr = this.state.parent.directory;
|
82
|
+
const parent_aside = curr.length > 0 ? `(${curr.join(' | ')}) : ` : '';
|
77
83
|
return (
|
78
84
|
<div>
|
79
85
|
<div className="input text optional resource_parent_id">
|
80
|
-
<label className="text optional" htmlFor="resource_parent_id">
|
86
|
+
<label className="text optional" htmlFor="resource_parent_id">
|
87
|
+
Parent Resource
|
88
|
+
</label>
|
81
89
|
<input type="hidden" name="resource[parent_id]" id="resource_parent_id" value={this.state.parent.id || ''} />
|
82
|
-
|
83
|
-
<
|
90
|
+
{/* eslint-disable jsx-a11y/anchor-is-valid */}
|
91
|
+
<a href="#" className="button reveal-button" onClick={this.onClick}>
|
92
|
+
Select Parent
|
93
|
+
</a>
|
94
|
+
{/* eslint-enable jsx-a11y/anchor-is-valid */}
|
95
|
+
<div className="resource_parent">
|
96
|
+
<aside>{parent_aside}</aside> <strong>{this.state.parent.title}</strong>
|
97
|
+
</div>
|
84
98
|
</div>
|
85
99
|
<div className="input text optional resource_directory">
|
86
|
-
<label className="text optional" htmlFor="resource_directory">
|
87
|
-
|
100
|
+
<label className="text optional" htmlFor="resource_directory">
|
101
|
+
Curriculum directory{' '}
|
102
|
+
<aside>
|
103
|
+
(You can pick a parent above, or enter curriculum tags below; i.e.: subject, grade, unit, etc;)
|
104
|
+
</aside>
|
105
|
+
</label>
|
106
|
+
<TagsInput value={this.state.directory} onChange={this.handleDirChange} />
|
107
|
+
<input type="hidden" name="resource[directory]" value={this.state.directory} />
|
88
108
|
</div>
|
89
|
-
<div className="curriculum-picker-modal reveal" id="curriculum-picker-modal"
|
109
|
+
<div className="curriculum-picker-modal reveal" id="curriculum-picker-modal">
|
90
110
|
<h2>Select a Parent Resource</h2>
|
91
111
|
<div id="curriculum-tree-picker" className="o-curriculum-tree-picker"></div>
|
92
112
|
</div>
|
93
113
|
</div>
|
94
|
-
)
|
114
|
+
);
|
95
115
|
}
|
96
116
|
}
|
97
117
|
|
98
|
-
|
118
|
+
DirectoryPicker.propTypes = {
|
119
|
+
tree: PropTypes.array,
|
120
|
+
directory: PropTypes.array,
|
121
|
+
parent: PropTypes.object,
|
122
|
+
path: PropTypes.string,
|
123
|
+
};
|
124
|
+
|
125
|
+
export default DirectoryPicker;
|
@@ -1,22 +1,27 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import ResourcePicker from '../resource-picker/ResourcePicker'; // eslint-disable-line no-unused-vars
|
2
4
|
|
3
5
|
function PickerButton(props) {
|
4
6
|
return (
|
5
7
|
<div className="o-assocpicker-container">
|
6
|
-
<button
|
7
|
-
|
8
|
-
|
9
|
-
onClick={props.onClick}>Select</button>
|
8
|
+
<button type="button" className="o-assocpicker-add button" onClick={props.onClick}>
|
9
|
+
Select
|
10
|
+
</button>
|
10
11
|
<div className="o-assocpicker-selections">
|
11
12
|
{props.hiddenInputs}
|
12
13
|
{props.content}
|
13
14
|
</div>
|
14
|
-
<div
|
15
|
-
className="o-assocpicker-modal reveal"
|
16
|
-
ref={props.onRef}>
|
17
|
-
</div>
|
15
|
+
<div className="o-assocpicker-modal reveal" ref={props.onRef}></div>
|
18
16
|
</div>
|
19
|
-
)
|
17
|
+
);
|
20
18
|
}
|
21
19
|
|
22
|
-
|
20
|
+
PickerButton.propTypes = {
|
21
|
+
onClick: PropTypes.func,
|
22
|
+
hiddenInputs: PropTypes.node,
|
23
|
+
content: PropTypes.array,
|
24
|
+
onRef: PropTypes.func,
|
25
|
+
};
|
26
|
+
|
27
|
+
export default PickerButton;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import ReactDOM from 'react-dom'
|
1
|
+
import ReactDOM from 'react-dom';
|
2
2
|
|
3
3
|
function pickerModal() {
|
4
|
-
new Foundation.Reveal(this.jqmodal, null)
|
5
|
-
this.jqmodal.on('open.zf.reveal', () => this.jqmodal.css({ top: '15px' }))
|
4
|
+
new Foundation.Reveal(this.jqmodal, null);
|
5
|
+
this.jqmodal.on('open.zf.reveal', () => this.jqmodal.css({ top: '15px' }));
|
6
6
|
this.jqmodal.on('closed.zf.reveal', () => {
|
7
|
-
ReactDOM.unmountComponentAtNode(this.modal)
|
8
|
-
})
|
7
|
+
ReactDOM.unmountComponentAtNode(this.modal);
|
8
|
+
});
|
9
9
|
}
|
10
10
|
|
11
|
-
export default pickerModal
|
11
|
+
export default pickerModal;
|