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 +0,0 @@
|
|
1
|
-
@charset "utf-8";
|
2
|
-
|
3
|
-
@import
|
4
|
-
'utils/variables',
|
5
|
-
'utils/mixins',
|
6
|
-
'utils/placeholders',
|
7
|
-
'base/colors',
|
8
|
-
'base/ld-colors';
|
9
|
-
|
10
|
-
@import
|
11
|
-
'themes/settings',
|
12
|
-
'themes/material';
|
13
|
-
|
14
|
-
@import
|
15
|
-
'font-awesome-sprockets',
|
16
|
-
'font-awesome',
|
17
|
-
'vendors/foundation_and_overrides',
|
18
|
-
'vendors/mathjax.css';
|
19
|
-
|
20
|
-
@import
|
21
|
-
'utils/styles_override',
|
22
|
-
'utils/helpers',
|
23
|
-
'utils/colorcodes',
|
24
|
-
'utils/functions';
|
25
|
-
|
26
|
-
@import
|
27
|
-
'base/typography',
|
28
|
-
'print/print';
|
29
|
-
|
30
|
-
@import 'components/assoc-picker';
|
31
|
-
|
32
|
-
@import
|
33
|
-
'layout/footer',
|
34
|
-
'layout/header',
|
35
|
-
'layout/navigation',
|
36
|
-
'layout/page';
|
@@ -1 +0,0 @@
|
|
1
|
-
div.tagsinput{border:1px solid #CCC;background:#FFF;padding:5px;width:300px;height:100px;overflow-y:auto}div.tagsinput span.tag{border:1px solid #a5d24a;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;float:left;padding:5px;text-decoration:none;background:#cde69c;color:#638421;margin-right:5px;margin-bottom:5px;font-family:helvetica;font-size:13px}div.tagsinput span.tag a{font-weight:700;color:#82ad2b;text-decoration:none;font-size:11px}div.tagsinput input{width:80px;margin:0 5px 5px 0;font-family:helvetica;font-size:13px;border:1px solid transparent;padding:5px;background:0 0;color:#000;outline:0}div.tagsinput div{display:block;float:left}.tags_clear{clear:both;width:100%;height:0}.not_valid{background:#FBD8DB!important;color:#90111A!important}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import Initializer from '../components/admin/Initializer'
|
2
|
-
|
3
|
-
document.addEventListener('turbolinks:load', () => {
|
4
|
-
Initializer.initializeResourcesForm()
|
5
|
-
Initializer.initializeResourcesList()
|
6
|
-
Initializer.initializeSelectAll()
|
7
|
-
})
|
8
|
-
|
9
|
-
// Support component names relative to this directory:
|
10
|
-
// eslint-disable-next-line no-undef
|
11
|
-
const componentRequireContext = require.context('components', true)
|
12
|
-
// eslint-disable-next-line no-undef
|
13
|
-
const ReactRailsUJS = require('react_ujs')
|
14
|
-
ReactRailsUJS.useContext(componentRequireContext)
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lcms
|
4
|
-
module Engine
|
5
|
-
# Component is a simple abstraction for accessing the unbounded-component-search API
|
6
|
-
class Component < OpenStruct
|
7
|
-
class << self
|
8
|
-
def component_types
|
9
|
-
@component_types ||= api_request('/types')
|
10
|
-
end
|
11
|
-
|
12
|
-
def find(id)
|
13
|
-
resp = api_request "/#{id}"
|
14
|
-
new resp
|
15
|
-
end
|
16
|
-
|
17
|
-
def search(params = {})
|
18
|
-
resp = api_request '/', params
|
19
|
-
paginated_results(resp)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def api_request(path, params = {})
|
25
|
-
res = HTTParty.get api_url(path),
|
26
|
-
query: params,
|
27
|
-
headers: { 'Authorization' => "Token token=\"#{api_token}\"" }
|
28
|
-
parse_response(res)
|
29
|
-
rescue URI::InvalidURIError, ComponentsAPIError => e
|
30
|
-
Rails.logger.error("Error requesting the components API: path=#{path} params=#{params}")
|
31
|
-
raise ComponentsAPIError, e.message
|
32
|
-
end
|
33
|
-
|
34
|
-
def api_token
|
35
|
-
@api_token ||= ENV.fetch('UB_COMPONENTS_API_TOKEN')
|
36
|
-
end
|
37
|
-
|
38
|
-
def api_url(path)
|
39
|
-
@base ||= ENV.fetch('UB_COMPONENTS_API_URL')
|
40
|
-
@base + path
|
41
|
-
end
|
42
|
-
|
43
|
-
# We must build an ES response so we can reuse the pagination engine we
|
44
|
-
# already have in place for the UI
|
45
|
-
# The API response has the following attributes:
|
46
|
-
# page : The current page
|
47
|
-
# per_page : Number of results per page
|
48
|
-
# total : Total of results on the db for this query
|
49
|
-
# results: : The search results
|
50
|
-
# max_score: : The maximum score obtained for this query
|
51
|
-
def paginated_results(resp)
|
52
|
-
resp = resp.with_indifferent_access
|
53
|
-
Elasticsearch::Persistence::Repository::Response::Results.new(
|
54
|
-
repo,
|
55
|
-
hits: {
|
56
|
-
total: resp[:total],
|
57
|
-
max_score: resp[:max_score],
|
58
|
-
hits: resp[:results]
|
59
|
-
}
|
60
|
-
).paginate(resp.slice(:page, :per_page))
|
61
|
-
end
|
62
|
-
|
63
|
-
def parse_response(response)
|
64
|
-
if response.success?
|
65
|
-
JSON.parse(response.body)
|
66
|
-
else
|
67
|
-
msg = "API error: status=#{response.code} message=#{response.message}"
|
68
|
-
raise ComponentsAPIError, msg
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# The ES response requires a persistence-repository so we
|
73
|
-
# can define how to deserialize the results
|
74
|
-
def repo
|
75
|
-
@repo ||= Elasticsearch::Persistence::Repository.new do
|
76
|
-
def deserialize(document)
|
77
|
-
Component.new(document)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def initialize(attrs)
|
84
|
-
super(**attrs.symbolize_keys)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lcms
|
4
|
-
module Engine
|
5
|
-
class SocialMediaPresenter
|
6
|
-
attr_reader :target, :view
|
7
|
-
|
8
|
-
def initialize(target:, view:)
|
9
|
-
@target = target
|
10
|
-
@view = view
|
11
|
-
end
|
12
|
-
|
13
|
-
def title
|
14
|
-
title_ = target.try(:title).try(:html_safe)
|
15
|
-
clean(title_) || clean(view.content_for(:og_title)) || view.page_title
|
16
|
-
end
|
17
|
-
|
18
|
-
def description
|
19
|
-
desc = target.try(:teaser).try(:html_safe)
|
20
|
-
clean(desc) || clean(view.content_for(:og_description)) || view.page_description
|
21
|
-
end
|
22
|
-
|
23
|
-
def default
|
24
|
-
OpenStruct.new(
|
25
|
-
# use facebook image as default
|
26
|
-
image: thumbnails[:facebook] || view.page_og_image,
|
27
|
-
title: title,
|
28
|
-
description: description
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def facebook
|
33
|
-
@facebook ||= extend_with_default(
|
34
|
-
image: thumbnails[:facebook] || view.page_og_image
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def twitter
|
39
|
-
@twitter ||= extend_with_default(
|
40
|
-
# use same image as facebook for twitter
|
41
|
-
image: thumbnails[:facebook] || view.page_og_image
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
def pinterest
|
46
|
-
@pinterest ||= extend_with_default(
|
47
|
-
image: thumbnails[:pinterest] || view.page_og_image
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def thumbnails
|
52
|
-
# @thumbnails ||= begin
|
53
|
-
# if target
|
54
|
-
# target.social_thumbnails.reduce({}) do |dict, thumb|
|
55
|
-
# dict[thumb.media] = thumb.image.url + "?ts=#{Time.now.to_i}#{Random.rand(1_000_000)}"
|
56
|
-
# dict
|
57
|
-
# end.with_indifferent_access
|
58
|
-
# else
|
59
|
-
# {}
|
60
|
-
# end
|
61
|
-
# end
|
62
|
-
|
63
|
-
# According to issue 140 (https://github.com/learningtapestry/unbounded/issues/140)
|
64
|
-
# we are commenting out social_thumbnails for now, until we can fix the titles and reparse the images.
|
65
|
-
{}
|
66
|
-
end
|
67
|
-
|
68
|
-
def clean(str)
|
69
|
-
view.strip_tags_and_squish(str)
|
70
|
-
end
|
71
|
-
|
72
|
-
def quick_reference_guide?
|
73
|
-
(target.is_a?(Resource) || target.is_a?(ResourcePresenter)) && target.quick_reference_guide?
|
74
|
-
end
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
def extend_with_default(data)
|
79
|
-
OpenStruct.new default.to_h.merge(data.compact)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<ul class="o-social-sharing <%= cl %> addthis_toolbox" addthis:title="<%= social_media.default.title %>" addthis:description="<%= social_media.default.description %>" addthis:url="<%= request.original_url %>" data-turbolinks="false">
|
2
|
-
<li>
|
3
|
-
<a class="addthis_button_twitter" rel="nofollow" data-turbolinks="false" addthis:title="<%= social_media.twitter.title %>" addthis:description="<%= social_media.twitter.description %>" addthis:media="<%= social_media.twitter.image %>">
|
4
|
-
<i class="fa-2x ub-twitter"></i>
|
5
|
-
</a>
|
6
|
-
</li>
|
7
|
-
<li>
|
8
|
-
<a class="addthis_button_facebook" rel="nofollow" data-turbolinks="false" addthis:title="<%= social_media.facebook.title %>" addthis:description="<%= social_media.facebook.description %>" addthis:media="<%= social_media.facebook.image %>">
|
9
|
-
<i class="fa-2x ub-facebook"></i>
|
10
|
-
</a>
|
11
|
-
</li>
|
12
|
-
<li>
|
13
|
-
<a class="addthis_button_pinterest_share" rel="nofollow" data-turbolinks="false" addthis:title="<%= social_media.pinterest.title %>" addthis:description="<%= social_media.pinterest.description %>" addthis:media="<%= social_media.pinterest.image %>">
|
14
|
-
<i class="fa-2x ub-pinterest"></i>
|
15
|
-
</a>
|
16
|
-
</li>
|
17
|
-
<li>
|
18
|
-
<a class="addthis_button_email" rel="nofollow" data-turbolinks="false">
|
19
|
-
<i class="fa-2x ub-arrow-share"></i>
|
20
|
-
</a>
|
21
|
-
</li>
|
22
|
-
</ul>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class ChangeDocumentPartsToPolymorphic < Lcms::Engine::Migration
|
4
|
-
def up
|
5
|
-
add_reference :document_parts, :renderer, polymorphic: true, index: true
|
6
|
-
Lcms::Engine::DocumentPart.update_all("renderer_id = document_id, renderer_type = 'Lcms::Engine::Document'")
|
7
|
-
Lcms::Engine::MaterialPart.find_each do |material_part|
|
8
|
-
Lcms::Engine::DocumentPart.create!(
|
9
|
-
active: material_part.active,
|
10
|
-
content: material_part.content,
|
11
|
-
context_type: material_part.context_type,
|
12
|
-
part_type: material_part.part_type,
|
13
|
-
renderer_id: material_part.material_id,
|
14
|
-
renderer_type: 'Lcms::Engine::Material'
|
15
|
-
)
|
16
|
-
end
|
17
|
-
remove_column :document_parts, :document_id
|
18
|
-
end
|
19
|
-
|
20
|
-
def down
|
21
|
-
Lcms::Engine::MaterialPart.delete_all
|
22
|
-
Lcms::Engine::DocumentPart.where(renderer_type: 'Lcms::Engine::Material').find_each do |material_part|
|
23
|
-
Lcms::Engine::MaterialPart.create!(
|
24
|
-
active: material_part.active,
|
25
|
-
content: material_part.content,
|
26
|
-
context_type: material_part.context_type,
|
27
|
-
part_type: material_part.part_type,
|
28
|
-
material_id: material_part.renderer_id
|
29
|
-
)
|
30
|
-
end
|
31
|
-
Lcms::Engine::DocumentPart.where(renderer_type: 'Lcms::Engine::Material').delete_all
|
32
|
-
add_reference :document_parts, :document, index: true, foreign_key: true
|
33
|
-
Lcms::Engine::DocumentPart.update_all('document_id = renderer_id')
|
34
|
-
remove_reference :document_parts, :renderer, polymorphic: true
|
35
|
-
end
|
36
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class DropPages < Lcms::Engine::Migration
|
4
|
-
def change
|
5
|
-
drop_table :pages do |t|
|
6
|
-
t.text :body, null: false
|
7
|
-
t.string :slug, null: false
|
8
|
-
t.string :title, null: false
|
9
|
-
|
10
|
-
t.timestamps null: false
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/db/seeds/pages.seeds.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
about_body = <<-HTML
|
4
|
-
<p>This is an experimental curriculum project designed to learn about how teachers can make effective use of well organized materials. We relied on ELA and math OER curriculum in grades 9–12 heavily for this pilot project. If you have any questions or feedback about the materials on this site, please contact us. We hope you enjoy using this site!</p>
|
5
|
-
HTML
|
6
|
-
|
7
|
-
Lcms::Engine::Page.create_with(body: about_body, title: 'About').find_or_create_by(slug: 'about')
|
8
|
-
Lcms::Engine::Page.create_with(body: about_body, title: 'Our People').find_or_create_by(slug: 'about_people')
|
9
|
-
|
10
|
-
pd_body = <<-HTML
|
11
|
-
Professional Development
|
12
|
-
HTML
|
13
|
-
|
14
|
-
Lcms::Engine::Page
|
15
|
-
.create_with(body: pd_body, title: 'Professional Development').find_or_create_by(slug: 'professional_development')
|
16
|
-
|
17
|
-
tos_body = <<-HTML
|
18
|
-
<p>ToS here</p>
|
19
|
-
HTML
|
20
|
-
|
21
|
-
Lcms::Engine::Page.create_with(body: tos_body, title: 'Terms of Service').find_or_create_by(slug: 'tos')
|
22
|
-
|
23
|
-
privacy_body = <<-HTML
|
24
|
-
<p>Privacy here</p>
|
25
|
-
HTML
|
26
|
-
Lcms::Engine::Page.create_with(body: privacy_body, title: 'Privacy Policy').find_or_create_by(slug: 'privacy')
|
data/lib/document_exporter.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'version'
|
4
|
-
|
5
|
-
module Lcms
|
6
|
-
module Engine
|
7
|
-
if Rails::VERSION::MAJOR >= 5
|
8
|
-
class Migration < ActiveRecord::Migration[RAILS_5_VERSION]
|
9
|
-
end
|
10
|
-
else
|
11
|
-
# Rails 4 migrations are not versioned.
|
12
|
-
class Migration < ActiveRecord::Migration
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
describe Lcms::Engine::Component do
|
6
|
-
let(:object) { Lcms::Engine::Component.new params: 'test' }
|
7
|
-
|
8
|
-
it 'can be created' do
|
9
|
-
expect(object).to be_present
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '.component_types' do
|
13
|
-
subject { described_class.component_types }
|
14
|
-
|
15
|
-
it 'makes API request to types end-point' do
|
16
|
-
expect(described_class).to receive(:api_request).with('/types')
|
17
|
-
subject
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '.find' do
|
22
|
-
let(:id) { 'id' }
|
23
|
-
let(:response) { { key: 'value' } }
|
24
|
-
|
25
|
-
before { allow(described_class).to receive(:api_request).and_return(response) }
|
26
|
-
|
27
|
-
subject { described_class.find id }
|
28
|
-
|
29
|
-
it 'makes API request' do
|
30
|
-
expect(described_class).to receive(:api_request).with("/#{id}")
|
31
|
-
subject
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'returns new object instance based on API response' do
|
35
|
-
expect(subject[:key]).to eq response[:key]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '.search' do
|
40
|
-
let(:params) { { key: 'value' } }
|
41
|
-
let(:response) { { key: 'value' } }
|
42
|
-
|
43
|
-
before do
|
44
|
-
allow(described_class).to receive(:api_request).and_return(response)
|
45
|
-
allow(described_class).to receive(:paginated_results)
|
46
|
-
end
|
47
|
-
|
48
|
-
subject { described_class.search params }
|
49
|
-
|
50
|
-
it 'makes API request' do
|
51
|
-
expect(described_class).to receive(:api_request).with('/', params)
|
52
|
-
subject
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'returns paginated results' do
|
56
|
-
expect(described_class).to receive(:paginated_results).with(response)
|
57
|
-
subject
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(a){var b=new Array,c=new Array;a.fn.doAutosize=function(b){var c=a(this).data("minwidth"),d=a(this).data("maxwidth"),e="",f=a(this),g=a("#"+a(this).data("tester_id"));if(e!==(e=f.val())){var h=e.replace(/&/g,"&").replace(/\s/g," ").replace(/</g,"<").replace(/>/g,">");g.html(h);var i=g.width(),j=i+b.comfortZone>=c?i+b.comfortZone:c,k=f.width(),l=k>j&&j>=c||j>c&&d>j;l&&f.width(j)}},a.fn.resetAutosize=function(b){var c=a(this).data("minwidth")||b.minInputWidth||a(this).width(),d=a(this).data("maxwidth")||b.maxInputWidth||a(this).closest(".tagsinput").width()-b.inputPadding,e=a(this),f=a("<tester/>").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:e.css("fontSize"),fontFamily:e.css("fontFamily"),fontWeight:e.css("fontWeight"),letterSpacing:e.css("letterSpacing"),whiteSpace:"nowrap"}),g=a(this).attr("id")+"_autosize_tester";!a("#"+g).length>0&&(f.attr("id",g),f.appendTo("body")),e.data("minwidth",c),e.data("maxwidth",d),e.data("tester_id",g),e.css("width",c)},a.fn.addTag=function(d,e){return e=jQuery.extend({focus:!1,callback:!0},e),this.each(function(){var f=a(this).attr("id"),g=a(this).val().split(b[f]);if(""==g[0]&&(g=new Array),d=jQuery.trim(d),e.unique){var h=a(this).tagExist(d);1==h&&a("#"+f+"_tag").addClass("not_valid")}else var h=!1;if(""!=d&&1!=h){if(a("<span>").addClass("tag").append(a("<span>").text(d).append(" "),a("<a>",{href:"#",title:"Removing tag",text:"x"}).click(function(){return a("#"+f).removeTag(escape(d))})).insertBefore("#"+f+"_addTag"),g.push(d),a("#"+f+"_tag").val(""),e.focus?a("#"+f+"_tag").focus():a("#"+f+"_tag").blur(),a.fn.tagsInput.updateTagsField(this,g),e.callback&&c[f]&&c[f].onAddTag){var i=c[f].onAddTag;i.call(this,d)}if(c[f]&&c[f].onChange){var j=g.length,i=c[f].onChange;i.call(this,a(this),g[j-1])}}}),!1},a.fn.removeTag=function(d){return d=unescape(d),this.each(function(){var e=a(this).attr("id"),f=a(this).val().split(b[e]);for(a("#"+e+"_tagsinput .tag").remove(),str="",i=0;i<f.length;i++)f[i]!=d&&(str=str+b[e]+f[i]);if(a.fn.tagsInput.importTags(this,str),c[e]&&c[e].onRemoveTag){var g=c[e].onRemoveTag;g.call(this,d)}}),!1},a.fn.tagExist=function(c){var d=a(this).attr("id"),e=a(this).val().split(b[d]);return jQuery.inArray(c,e)>=0},a.fn.importTags=function(b){var c=a(this).attr("id");a("#"+c+"_tagsinput .tag").remove(),a.fn.tagsInput.importTags(this,b)},a.fn.tagsInput=function(e){var f=jQuery.extend({interactive:!0,defaultText:"add a tag",minChars:0,width:"300px",height:"100px",autocomplete:{selectFirst:!1},hide:!0,delimiter:",",unique:!0,removeWithBackspace:!0,placeholderColor:"#666666",autosize:!0,comfortZone:20,inputPadding:12},e),g=0;return this.each(function(){if("undefined"==typeof a(this).attr("data-tagsinput-init")){a(this).attr("data-tagsinput-init",!0),f.hide&&a(this).hide();var e=a(this).attr("id");(!e||b[a(this).attr("id")])&&(e=a(this).attr("id","tags"+(new Date).getTime()+g++).attr("id"));var h=jQuery.extend({pid:e,real_input:"#"+e,holder:"#"+e+"_tagsinput",input_wrapper:"#"+e+"_addTag",fake_input:"#"+e+"_tag"},f);b[e]=h.delimiter,(f.onAddTag||f.onRemoveTag||f.onChange)&&(c[e]=new Array,c[e].onAddTag=f.onAddTag,c[e].onRemoveTag=f.onRemoveTag,c[e].onChange=f.onChange);var i='<div id="'+e+'_tagsinput" class="tagsinput"><div id="'+e+'_addTag">';if(f.interactive&&(i=i+'<input id="'+e+'_tag" value="" data-default="'+f.defaultText+'" />'),i+='</div><div class="tags_clear"></div></div>',a(i).insertAfter(this),a(h.holder).css("width",f.width),a(h.holder).css("min-height",f.height),a(h.holder).css("height",f.height),""!=a(h.real_input).val()&&a.fn.tagsInput.importTags(a(h.real_input),a(h.real_input).val()),f.interactive){if(a(h.fake_input).val(a(h.fake_input).attr("data-default")),a(h.fake_input).css("color",f.placeholderColor),a(h.fake_input).resetAutosize(f),a(h.holder).bind("click",h,function(b){a(b.data.fake_input).focus()}),a(h.fake_input).bind("focus",h,function(b){a(b.data.fake_input).val()==a(b.data.fake_input).attr("data-default")&&a(b.data.fake_input).val(""),a(b.data.fake_input).css("color","#000000")}),void 0!=f.autocomplete_url){autocomplete_options={source:f.autocomplete_url};for(attrname in f.autocomplete)autocomplete_options[attrname]=f.autocomplete[attrname];void 0!==jQuery.Autocompleter?(a(h.fake_input).autocomplete(f.autocomplete_url,f.autocomplete),a(h.fake_input).bind("result",h,function(b,c,d){c&&a("#"+e).addTag(c[0]+"",{focus:!0,unique:f.unique})})):void 0!==jQuery.ui.autocomplete&&(a(h.fake_input).autocomplete(autocomplete_options),a(h.fake_input).bind("autocompleteselect",h,function(b,c){return a(b.data.real_input).addTag(c.item.value,{focus:!0,unique:f.unique}),!1}))}else a(h.fake_input).bind("blur",h,function(b){var c=a(this).attr("data-default");return""!=a(b.data.fake_input).val()&&a(b.data.fake_input).val()!=c?b.data.minChars<=a(b.data.fake_input).val().length&&(!b.data.maxChars||b.data.maxChars>=a(b.data.fake_input).val().length)&&a(b.data.real_input).addTag(a(b.data.fake_input).val(),{focus:!0,unique:f.unique}):(a(b.data.fake_input).val(a(b.data.fake_input).attr("data-default")),a(b.data.fake_input).css("color",f.placeholderColor)),!1});a(h.fake_input).bind("keypress",h,function(b){return d(b)?(b.preventDefault(),b.data.minChars<=a(b.data.fake_input).val().length&&(!b.data.maxChars||b.data.maxChars>=a(b.data.fake_input).val().length)&&a(b.data.real_input).addTag(a(b.data.fake_input).val(),{focus:!0,unique:f.unique}),a(b.data.fake_input).resetAutosize(f),!1):void(b.data.autosize&&a(b.data.fake_input).doAutosize(f))}),h.removeWithBackspace&&a(h.fake_input).bind("keydown",function(b){if(8==b.keyCode&&""==a(this).val()){b.preventDefault();var c=a(this).closest(".tagsinput").find(".tag:last").text(),d=a(this).attr("id").replace(/_tag$/,"");c=c.replace(/[\s]+x$/,""),a("#"+d).removeTag(escape(c)),a(this).trigger("focus")}}),a(h.fake_input).blur(),h.unique&&a(h.fake_input).keydown(function(b){(8==b.keyCode||String.fromCharCode(b.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/))&&a(this).removeClass("not_valid")})}}}),this},a.fn.tagsInput.updateTagsField=function(c,d){var e=a(c).attr("id");a(c).val(d.join(b[e]))},a.fn.tagsInput.importTags=function(d,e){a(d).val("");var f=a(d).attr("id"),g=e.split(b[f]);for(i=0;i<g.length;i++)a(d).addTag(g[i],{focus:!1,callback:!1});if(c[f]&&c[f].onChange){var h=c[f].onChange;h.call(d,d,g[i])}};var d=function(b){var c=!1;return 13==b.which?!0:("string"==typeof b.data.delimiter?b.which==b.data.delimiter.charCodeAt(0)&&(c=!0):a.each(b.data.delimiter,function(a,d){b.which==d.charCodeAt(0)&&(c=!0)}),c)}}(jQuery);
|