adapt-authoring-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc +14 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +55 -0
- package/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
- package/.github/dependabot.yml +11 -0
- package/.github/pull_request_template.md +25 -0
- package/.github/workflows/labelled_prs.yml +16 -0
- package/.github/workflows/new.yml +19 -0
- package/adapt-authoring.json +11 -0
- package/app/core/app.js +43 -0
- package/app/core/assets/adapt-learning-logo-outline.png +0 -0
- package/app/core/assets/adapt-learning-logo-white.png +0 -0
- package/app/core/assets/ajax-loader.gif +0 -0
- package/app/core/assets/favicon.png +0 -0
- package/app/core/assets/transparency-light.png +0 -0
- package/app/core/browserStorage.js +45 -0
- package/app/core/collections/apiCollection.js +74 -0
- package/app/core/collections/contentCollection.js +33 -0
- package/app/core/collections/contentPluginCollection.js +24 -0
- package/app/core/collections/tagsCollection.js +4 -0
- package/app/core/constants.js +10 -0
- package/app/core/helpers.js +375 -0
- package/app/core/index.hbs +192 -0
- package/app/core/l10n.js +33 -0
- package/app/core/less/_reset.less +43 -0
- package/app/core/less/app.less +100 -0
- package/app/core/less/buttons.less +268 -0
- package/app/core/less/colourLabels.less +14 -0
- package/app/core/less/colours.less +132 -0
- package/app/core/less/columns.less +190 -0
- package/app/core/less/fonts.less +30 -0
- package/app/core/less/forms.less +77 -0
- package/app/core/less/sharedStyles.less +73 -0
- package/app/core/less/tables.less +29 -0
- package/app/core/less/tags.less +194 -0
- package/app/core/loading.hbs +27 -0
- package/app/core/models/articleModel.js +19 -0
- package/app/core/models/blockModel.js +25 -0
- package/app/core/models/clipboardModel.js +10 -0
- package/app/core/models/componentModel.js +18 -0
- package/app/core/models/configModel.js +22 -0
- package/app/core/models/contentModel.js +26 -0
- package/app/core/models/contentObjectModel.js +19 -0
- package/app/core/models/contentPluginModel.js +10 -0
- package/app/core/models/courseModel.js +24 -0
- package/app/core/models/sessionModel.js +86 -0
- package/app/core/origin.js +189 -0
- package/app/core/router.js +135 -0
- package/app/core/views/originView.js +92 -0
- package/app/libraries/babel-polyfill.min.js +1 -0
- package/app/libraries/backbone-forms-lists.js +669 -0
- package/app/libraries/backbone-forms.js +2604 -0
- package/app/libraries/backbone.js +1581 -0
- package/app/libraries/ckeditor.js +6 -0
- package/app/libraries/handlebars.js +4902 -0
- package/app/libraries/imageReady.js +2 -0
- package/app/libraries/inview.js +140 -0
- package/app/libraries/jquery-ui.min.js +6 -0
- package/app/libraries/jquery.form.js +1277 -0
- package/app/libraries/jquery.js +10346 -0
- package/app/libraries/jquery.tagsinput.min.js +1 -0
- package/app/libraries/moment.min.js +7 -0
- package/app/libraries/polyglot.min.js +2922 -0
- package/app/libraries/require.js +36 -0
- package/app/libraries/scrollTo.js +11 -0
- package/app/libraries/selectize/css/selectize.less +403 -0
- package/app/libraries/selectize/js/selectize.js +4500 -0
- package/app/libraries/spectrum/spectrum.js +2323 -0
- package/app/libraries/spectrum/spectrum.less +507 -0
- package/app/libraries/underscore.js +1692 -0
- package/app/libraries/velocity.js +4773 -0
- package/app/modules/appHeader/assets/top-bar-1080.jpg +0 -0
- package/app/modules/appHeader/assets/top-bar-2560.jpg +0 -0
- package/app/modules/appHeader/index.js +5 -0
- package/app/modules/appHeader/less/appHeader.less +72 -0
- package/app/modules/appHeader/templates/appHeader.hbs +17 -0
- package/app/modules/appHeader/views/appHeaderView.js +63 -0
- package/app/modules/assetManagement/collections/assetCollection.js +16 -0
- package/app/modules/assetManagement/index.js +65 -0
- package/app/modules/assetManagement/less/asset.less +229 -0
- package/app/modules/assetManagement/less/assetManagementModalTags.less +34 -0
- package/app/modules/assetManagement/less/assetManagementNew.less +60 -0
- package/app/modules/assetManagement/models/assetModel.js +11 -0
- package/app/modules/assetManagement/templates/assetManagement.hbs +12 -0
- package/app/modules/assetManagement/templates/assetManagementCollection.hbs +2 -0
- package/app/modules/assetManagement/templates/assetManagementEditAsset.hbs +9 -0
- package/app/modules/assetManagement/templates/assetManagementEditAssetSidebar.hbs +10 -0
- package/app/modules/assetManagement/templates/assetManagementListItem.hbs +35 -0
- package/app/modules/assetManagement/templates/assetManagementModalAutofill.hbs +1 -0
- package/app/modules/assetManagement/templates/assetManagementModalEditAsset.hbs +11 -0
- package/app/modules/assetManagement/templates/assetManagementModalFilters.hbs +16 -0
- package/app/modules/assetManagement/templates/assetManagementModalTags.hbs +26 -0
- package/app/modules/assetManagement/templates/assetManagementPreview.hbs +53 -0
- package/app/modules/assetManagement/templates/assetManagementSidebar.hbs +93 -0
- package/app/modules/assetManagement/templates/assetPicker.hbs +45 -0
- package/app/modules/assetManagement/views/assetManagementCollectionView.js +216 -0
- package/app/modules/assetManagement/views/assetManagementEditAssetSidebarView.js +25 -0
- package/app/modules/assetManagement/views/assetManagementEditAssetView.js +123 -0
- package/app/modules/assetManagement/views/assetManagementItemView.js +68 -0
- package/app/modules/assetManagement/views/assetManagementModalAutofillView.js +51 -0
- package/app/modules/assetManagement/views/assetManagementModalEditAssetView.js +38 -0
- package/app/modules/assetManagement/views/assetManagementModalFiltersView.js +132 -0
- package/app/modules/assetManagement/views/assetManagementModalTagsView.js +169 -0
- package/app/modules/assetManagement/views/assetManagementModalView.js +62 -0
- package/app/modules/assetManagement/views/assetManagementPreviewView.js +69 -0
- package/app/modules/assetManagement/views/assetManagementSidebarView.js +126 -0
- package/app/modules/assetManagement/views/assetManagementView.js +43 -0
- package/app/modules/colorLabel/index.js +48 -0
- package/app/modules/colorLabel/less/colorLabels.less +102 -0
- package/app/modules/colorLabel/models/colors.js +31 -0
- package/app/modules/colorLabel/templates/colorLabelPopUpView.hbs +21 -0
- package/app/modules/colorLabel/views/colorLabelPopupView.js +75 -0
- package/app/modules/contentHeader/index.js +6 -0
- package/app/modules/contentHeader/less/contentHeader.less +152 -0
- package/app/modules/contentHeader/less/options.less +51 -0
- package/app/modules/contentHeader/templates/actionsButton.hbs +3 -0
- package/app/modules/contentHeader/templates/contentHeader.hbs +38 -0
- package/app/modules/contentHeader/templates/contentHeaderToggleButton.hbs +11 -0
- package/app/modules/contentHeader/templates/filterItem.hbs +23 -0
- package/app/modules/contentHeader/templates/options.hbs +14 -0
- package/app/modules/contentHeader/templates/partials/part_headerButtonContent.hbs +2 -0
- package/app/modules/contentHeader/templates/sortItem.hbs +9 -0
- package/app/modules/contentHeader/views/actionsButtonView.js +14 -0
- package/app/modules/contentHeader/views/contentHeaderButtonView.js +42 -0
- package/app/modules/contentHeader/views/contentHeaderToggleButtonView.js +52 -0
- package/app/modules/contentHeader/views/contentHeaderView.js +96 -0
- package/app/modules/contentHeader/views/filtersButtonView.js +31 -0
- package/app/modules/contentHeader/views/optionsView.js +88 -0
- package/app/modules/contentHeader/views/sortsButtonView.js +45 -0
- package/app/modules/contentPane/index.js +20 -0
- package/app/modules/contentPane/less/contentPane.less +8 -0
- package/app/modules/contentPane/templates/contentPane.hbs +2 -0
- package/app/modules/contentPane/views/contentPaneView.js +77 -0
- package/app/modules/contextMenu/index.js +85 -0
- package/app/modules/contextMenu/less/contextMenu.less +54 -0
- package/app/modules/contextMenu/templates/contextMenu.hbs +6 -0
- package/app/modules/contextMenu/templates/contextMenuItem.hbs +8 -0
- package/app/modules/contextMenu/views/contextMenuItemView.js +37 -0
- package/app/modules/contextMenu/views/contextMenuView.js +76 -0
- package/app/modules/editor/article/index.js +18 -0
- package/app/modules/editor/article/templates/editorArticleEdit.hbs +2 -0
- package/app/modules/editor/article/templates/editorArticleEditSidebar.hbs +19 -0
- package/app/modules/editor/article/views/editorArticleEditSidebarView.js +32 -0
- package/app/modules/editor/article/views/editorArticleEditView.js +19 -0
- package/app/modules/editor/block/index.js +18 -0
- package/app/modules/editor/block/templates/editorBlockEdit.hbs +2 -0
- package/app/modules/editor/block/templates/editorBlockEditSidebar.hbs +19 -0
- package/app/modules/editor/block/views/editorBlockEditSidebarView.js +28 -0
- package/app/modules/editor/block/views/editorBlockEditView.js +19 -0
- package/app/modules/editor/component/index.js +22 -0
- package/app/modules/editor/component/templates/editorComponentEdit.hbs +2 -0
- package/app/modules/editor/component/templates/editorComponentEditSidebar.hbs +19 -0
- package/app/modules/editor/component/views/editorComponentEditSidebarView.js +32 -0
- package/app/modules/editor/component/views/editorComponentEditView.js +23 -0
- package/app/modules/editor/config/index.js +15 -0
- package/app/modules/editor/config/templates/editorConfigEdit.hbs +1 -0
- package/app/modules/editor/config/templates/editorConfigEditSidebar.hbs +10 -0
- package/app/modules/editor/config/views/editorConfigEditSidebarView.js +28 -0
- package/app/modules/editor/config/views/editorConfigEditView.js +28 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-accordion.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-assessment.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-blank.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-default.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-gmcq.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-graphic.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-hot-graphic.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-matching.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-mcq.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-media.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-narrative.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-slider.png +0 -0
- package/app/modules/editor/contentObject/assets/component-icons/icon-text.png +0 -0
- package/app/modules/editor/contentObject/index.js +68 -0
- package/app/modules/editor/contentObject/less/editing-overlay-component-list.less +60 -0
- package/app/modules/editor/contentObject/less/editing-overlay-panel.less +25 -0
- package/app/modules/editor/contentObject/less/editorMenu.less +84 -0
- package/app/modules/editor/contentObject/less/editorMenuItem.less +114 -0
- package/app/modules/editor/contentObject/less/editorMenuLayer.less +70 -0
- package/app/modules/editor/contentObject/less/editorPage.less +162 -0
- package/app/modules/editor/contentObject/less/editorPageArticle.less +40 -0
- package/app/modules/editor/contentObject/less/editorPageBlock.less +33 -0
- package/app/modules/editor/contentObject/less/editorPageComponent.less +47 -0
- package/app/modules/editor/contentObject/less/editorPageComponentList.less +234 -0
- package/app/modules/editor/contentObject/templates/editorMenu.hbs +1 -0
- package/app/modules/editor/contentObject/templates/editorMenuItem.hbs +23 -0
- package/app/modules/editor/contentObject/templates/editorMenuLayer.hbs +12 -0
- package/app/modules/editor/contentObject/templates/editorMenuSidebar.hbs +1 -0
- package/app/modules/editor/contentObject/templates/editorPage.hbs +15 -0
- package/app/modules/editor/contentObject/templates/editorPageArticle.hbs +15 -0
- package/app/modules/editor/contentObject/templates/editorPageBlock.hbs +14 -0
- package/app/modules/editor/contentObject/templates/editorPageComponent.hbs +9 -0
- package/app/modules/editor/contentObject/templates/editorPageComponentList.hbs +33 -0
- package/app/modules/editor/contentObject/templates/editorPageComponentListItem.hbs +24 -0
- package/app/modules/editor/contentObject/templates/editorPageComponentPasteZone.hbs +4 -0
- package/app/modules/editor/contentObject/templates/editorPageEdit.hbs +1 -0
- package/app/modules/editor/contentObject/templates/editorPageEditSidebar.hbs +10 -0
- package/app/modules/editor/contentObject/templates/editorPageSidebar.hbs +1 -0
- package/app/modules/editor/contentObject/views/editorMenuItemView.js +174 -0
- package/app/modules/editor/contentObject/views/editorMenuLayerView.js +212 -0
- package/app/modules/editor/contentObject/views/editorMenuSidebarView.js +13 -0
- package/app/modules/editor/contentObject/views/editorMenuView.js +211 -0
- package/app/modules/editor/contentObject/views/editorPageArticleView.js +278 -0
- package/app/modules/editor/contentObject/views/editorPageBlockView.js +280 -0
- package/app/modules/editor/contentObject/views/editorPageComponentListItemView.js +80 -0
- package/app/modules/editor/contentObject/views/editorPageComponentListView.js +131 -0
- package/app/modules/editor/contentObject/views/editorPageComponentPasteZoneView.js +47 -0
- package/app/modules/editor/contentObject/views/editorPageComponentView.js +202 -0
- package/app/modules/editor/contentObject/views/editorPageEditSidebarView.js +28 -0
- package/app/modules/editor/contentObject/views/editorPageEditView.js +19 -0
- package/app/modules/editor/contentObject/views/editorPageSidebarView.js +13 -0
- package/app/modules/editor/contentObject/views/editorPageView.js +183 -0
- package/app/modules/editor/course/index.js +26 -0
- package/app/modules/editor/course/templates/editorCourseEdit.hbs +2 -0
- package/app/modules/editor/course/templates/editorCourseEditSidebar.hbs +19 -0
- package/app/modules/editor/course/views/editorCourseEditSidebarView.js +28 -0
- package/app/modules/editor/course/views/editorCourseEditView.js +56 -0
- package/app/modules/editor/extensions/index.js +26 -0
- package/app/modules/editor/extensions/less/extensions.less +22 -0
- package/app/modules/editor/extensions/templates/editorExtensionsEdit.hbs +85 -0
- package/app/modules/editor/extensions/templates/editorExtensionsEditSidebar.hbs +1 -0
- package/app/modules/editor/extensions/views/editorExtensionsEditSidebarView.js +10 -0
- package/app/modules/editor/extensions/views/editorExtensionsEditView.js +85 -0
- package/app/modules/editor/global/collections/editorCollection.js +24 -0
- package/app/modules/editor/global/editorDataLoader.js +91 -0
- package/app/modules/editor/global/helpers.js +99 -0
- package/app/modules/editor/global/less/colorLabels.less +55 -0
- package/app/modules/editor/global/less/editor.less +204 -0
- package/app/modules/editor/global/templates/editor.hbs +1 -0
- package/app/modules/editor/global/templates/editorPasteZone.hbs +4 -0
- package/app/modules/editor/global/templates/partials/part_editorCommon.hbs +70 -0
- package/app/modules/editor/global/templates/partials/part_editorItemSidebar.hbs +40 -0
- package/app/modules/editor/global/templates/partials/part_editorMenu.hbs +4 -0
- package/app/modules/editor/global/templates/partials/part_settingsGeneral.hbs +27 -0
- package/app/modules/editor/global/views/editorOriginView.js +255 -0
- package/app/modules/editor/global/views/editorPasteZoneView.js +69 -0
- package/app/modules/editor/global/views/editorView.js +288 -0
- package/app/modules/editor/index.js +52 -0
- package/app/modules/editor/menuSettings/index.js +27 -0
- package/app/modules/editor/menuSettings/less/menusettings.less +55 -0
- package/app/modules/editor/menuSettings/templates/editorMenuSettingsEdit.hbs +1 -0
- package/app/modules/editor/menuSettings/templates/editorMenuSettingsEditSidebar.hbs +5 -0
- package/app/modules/editor/menuSettings/templates/editorMenuSettingsItem.hbs +4 -0
- package/app/modules/editor/menuSettings/views/editorMenuSettingsEditSidebarView.js +21 -0
- package/app/modules/editor/menuSettings/views/editorMenuSettingsEditView.js +71 -0
- package/app/modules/editor/menuSettings/views/editorMenuSettingsView.js +44 -0
- package/app/modules/editor/themeEditor/collections/editorPresetCollection.js +13 -0
- package/app/modules/editor/themeEditor/index.js +15 -0
- package/app/modules/editor/themeEditor/less/editorPresetEdit.less +78 -0
- package/app/modules/editor/themeEditor/less/editorTheming.less +73 -0
- package/app/modules/editor/themeEditor/models/editorModel.js +62 -0
- package/app/modules/editor/themeEditor/models/editorPresetModel.js +6 -0
- package/app/modules/editor/themeEditor/templates/editorPresetEdit.hbs +31 -0
- package/app/modules/editor/themeEditor/templates/editorTheming.hbs +35 -0
- package/app/modules/editor/themeEditor/templates/editorThemingSidebar.hbs +23 -0
- package/app/modules/editor/themeEditor/views/editorPresetEditView.js +98 -0
- package/app/modules/editor/themeEditor/views/editorThemingSidebarView.js +62 -0
- package/app/modules/editor/themeEditor/views/editorThemingView.js +304 -0
- package/app/modules/frameworkImport/index.js +32 -0
- package/app/modules/frameworkImport/less/frameworkImport.less +101 -0
- package/app/modules/frameworkImport/templates/frameworkImport.hbs +58 -0
- package/app/modules/frameworkImport/templates/frameworkImportSidebar.hbs +12 -0
- package/app/modules/frameworkImport/templates/frameworkImportSummary.hbs +40 -0
- package/app/modules/frameworkImport/templates/partials/part_frameworkImportButton.hbs +3 -0
- package/app/modules/frameworkImport/templates/partials/part_frameworkImportStatusMessages.hbs +22 -0
- package/app/modules/frameworkImport/views/frameworkImportSidebarView.js +31 -0
- package/app/modules/frameworkImport/views/frameworkImportView.js +109 -0
- package/app/modules/globalMenu/index.js +86 -0
- package/app/modules/globalMenu/less/globalMenu.less +117 -0
- package/app/modules/globalMenu/templates/globalMenu.hbs +6 -0
- package/app/modules/globalMenu/templates/globalMenuItem.hbs +10 -0
- package/app/modules/globalMenu/templates/partials/part_globalMenuButton.hbs +7 -0
- package/app/modules/globalMenu/views/globalMenuItemView.js +108 -0
- package/app/modules/globalMenu/views/globalMenuView.js +45 -0
- package/app/modules/limiteduser/index.js +17 -0
- package/app/modules/limiteduser/less/limitedUser.less +29 -0
- package/app/modules/limiteduser/templates/limitedUser.hbs +8 -0
- package/app/modules/limiteduser/views/limitedUserView.js +12 -0
- package/app/modules/modal/index.js +13 -0
- package/app/modules/modal/less/modal.less +61 -0
- package/app/modules/modal/models/modalModel.js +14 -0
- package/app/modules/modal/templates/modal.hbs +34 -0
- package/app/modules/modal/views/modalView.js +102 -0
- package/app/modules/notify/index.js +32 -0
- package/app/modules/notify/plugins/alert/assets/sweetalert.css +932 -0
- package/app/modules/notify/plugins/alert/index.js +117 -0
- package/app/modules/notify/plugins/alert/less/alert.less +74 -0
- package/app/modules/notify/plugins/alert/sweetalert2-11.1.7.all.min.js +2 -0
- package/app/modules/notify/plugins/console/index.js +18 -0
- package/app/modules/notify/plugins/snackbar/index.js +69 -0
- package/app/modules/notify/plugins/snackbar/less/snackbar.less +40 -0
- package/app/modules/notify/plugins/toast/index.js +70 -0
- package/app/modules/notify/plugins/toast/less/toast.less +62 -0
- package/app/modules/pluginManagement/index.js +36 -0
- package/app/modules/pluginManagement/less/pluginManagement.less +23 -0
- package/app/modules/pluginManagement/less/pluginType.less +25 -0
- package/app/modules/pluginManagement/templates/pluginManagement.hbs +43 -0
- package/app/modules/pluginManagement/templates/pluginManagementSidebar.hbs +40 -0
- package/app/modules/pluginManagement/templates/pluginManagementUpload.hbs +12 -0
- package/app/modules/pluginManagement/templates/pluginManagementUploadSidebar.hbs +13 -0
- package/app/modules/pluginManagement/templates/pluginType.hbs +43 -0
- package/app/modules/pluginManagement/views/pluginManagementSidebarView.js +48 -0
- package/app/modules/pluginManagement/views/pluginManagementUploadSidebarView.js +25 -0
- package/app/modules/pluginManagement/views/pluginManagementUploadView.js +52 -0
- package/app/modules/pluginManagement/views/pluginManagementView.js +104 -0
- package/app/modules/pluginManagement/views/pluginTypeView.js +105 -0
- package/app/modules/projects/assets/origami-project.jpg +0 -0
- package/app/modules/projects/index.js +82 -0
- package/app/modules/projects/less/projects.less +152 -0
- package/app/modules/projects/less/qproject.less +143 -0
- package/app/modules/projects/templates/project.hbs +63 -0
- package/app/modules/projects/templates/projects.hbs +6 -0
- package/app/modules/projects/templates/projectsSidebar.hbs +42 -0
- package/app/modules/projects/views/projectView.js +167 -0
- package/app/modules/projects/views/projectsSidebarView.js +172 -0
- package/app/modules/projects/views/projectsView.js +271 -0
- package/app/modules/scaffold/backboneFormsOverrides.js +284 -0
- package/app/modules/scaffold/index.js +342 -0
- package/app/modules/scaffold/lang/en.json +9 -0
- package/app/modules/scaffold/less/codeEditor.less +6 -0
- package/app/modules/scaffold/less/colourPicker.less +141 -0
- package/app/modules/scaffold/less/displayTitle.less +17 -0
- package/app/modules/scaffold/less/forms.less +174 -0
- package/app/modules/scaffold/less/list.less +35 -0
- package/app/modules/scaffold/less/modal.less +45 -0
- package/app/modules/scaffold/less/scaffoldAsset.less +23 -0
- package/app/modules/scaffold/less/scaffoldAssetItem.less +50 -0
- package/app/modules/scaffold/less/selectize.less +29 -0
- package/app/modules/scaffold/less/textArea.less +9 -0
- package/app/modules/scaffold/less/users.less +6 -0
- package/app/modules/scaffold/templates/field.hbs +25 -0
- package/app/modules/scaffold/templates/fieldset.hbs +10 -0
- package/app/modules/scaffold/templates/form.hbs +6 -0
- package/app/modules/scaffold/templates/list.hbs +4 -0
- package/app/modules/scaffold/templates/listItem.hbs +5 -0
- package/app/modules/scaffold/templates/scaffoldAsset.hbs +65 -0
- package/app/modules/scaffold/templates/scaffoldAssetItem.hbs +35 -0
- package/app/modules/scaffold/templates/scaffoldDisplayTitle.hbs +8 -0
- package/app/modules/scaffold/templates/scaffoldEditHtml.hbs +1 -0
- package/app/modules/scaffold/templates/scaffoldFile.hbs +1 -0
- package/app/modules/scaffold/templates/scaffoldItemsModal.hbs +14 -0
- package/app/modules/scaffold/templates/scaffoldModalOverlay.hbs +1 -0
- package/app/modules/scaffold/templates/scaffoldUsersOption.hbs +8 -0
- package/app/modules/scaffold/views/scaffoldAssetItemView.js +203 -0
- package/app/modules/scaffold/views/scaffoldAssetView.js +157 -0
- package/app/modules/scaffold/views/scaffoldCodeEditorView.js +64 -0
- package/app/modules/scaffold/views/scaffoldColourPickerView.js +70 -0
- package/app/modules/scaffold/views/scaffoldDisplayTitleView.js +112 -0
- package/app/modules/scaffold/views/scaffoldFileView.js +18 -0
- package/app/modules/scaffold/views/scaffoldItemsModalView.js +100 -0
- package/app/modules/scaffold/views/scaffoldListView.js +158 -0
- package/app/modules/scaffold/views/scaffoldTagsView.js +71 -0
- package/app/modules/scaffold/views/scaffoldUsersView.js +89 -0
- package/app/modules/sidebar/index.js +22 -0
- package/app/modules/sidebar/less/sidebar.less +298 -0
- package/app/modules/sidebar/less/sidebarFilter.less +91 -0
- package/app/modules/sidebar/templates/sidebar.hbs +7 -0
- package/app/modules/sidebar/templates/sidebarBreadcrumb.hbs +3 -0
- package/app/modules/sidebar/templates/sidebarDivide.hbs +5 -0
- package/app/modules/sidebar/templates/sidebarFieldsetFilter.hbs +6 -0
- package/app/modules/sidebar/templates/sidebarFilter.hbs +30 -0
- package/app/modules/sidebar/templates/sidebarRowFilter.hbs +4 -0
- package/app/modules/sidebar/templates/sidebarUpdateButton.hbs +3 -0
- package/app/modules/sidebar/views/sidebarFieldsetFilterView.js +43 -0
- package/app/modules/sidebar/views/sidebarFilterView.js +132 -0
- package/app/modules/sidebar/views/sidebarItemView.js +172 -0
- package/app/modules/sidebar/views/sidebarView.js +71 -0
- package/app/modules/user/assets/adapt-learning-logo.png +0 -0
- package/app/modules/user/assets/adapt-logo.png +0 -0
- package/app/modules/user/assets/login_bg.jpg +0 -0
- package/app/modules/user/index.js +75 -0
- package/app/modules/user/less/forgotPassword.less +14 -0
- package/app/modules/user/less/login.less +138 -0
- package/app/modules/user/less/logout.less +3 -0
- package/app/modules/user/less/resetPassword.less +7 -0
- package/app/modules/user/less/userProfile.less +49 -0
- package/app/modules/user/models/userProfileModel.js +32 -0
- package/app/modules/user/templates/forgotPassword.hbs +36 -0
- package/app/modules/user/templates/login.hbs +29 -0
- package/app/modules/user/templates/resetPassword.hbs +29 -0
- package/app/modules/user/templates/userProfile.hbs +71 -0
- package/app/modules/user/templates/userProfileSidebar.hbs +16 -0
- package/app/modules/user/views/forgotPasswordView.js +63 -0
- package/app/modules/user/views/loginView.js +93 -0
- package/app/modules/user/views/resetPasswordView.js +78 -0
- package/app/modules/user/views/userProfileSidebarView.js +32 -0
- package/app/modules/user/views/userProfileView.js +107 -0
- package/app/modules/userManagement/collections/userCollection.js +65 -0
- package/app/modules/userManagement/helpers.js +46 -0
- package/app/modules/userManagement/index.js +67 -0
- package/app/modules/userManagement/less/userManagement.less +268 -0
- package/app/modules/userManagement/models/userModel.js +34 -0
- package/app/modules/userManagement/templates/addUser.hbs +35 -0
- package/app/modules/userManagement/templates/addUserSidebar.hbs +9 -0
- package/app/modules/userManagement/templates/user.hbs +126 -0
- package/app/modules/userManagement/templates/userManagement.hbs +49 -0
- package/app/modules/userManagement/templates/userManagementFilter.hbs +19 -0
- package/app/modules/userManagement/templates/userManagementSidebar.hbs +13 -0
- package/app/modules/userManagement/views/addUserSidebarView.js +25 -0
- package/app/modules/userManagement/views/addUserView.js +85 -0
- package/app/modules/userManagement/views/filterView.js +49 -0
- package/app/modules/userManagement/views/userManagementSidebarView.js +33 -0
- package/app/modules/userManagement/views/userManagementView.js +104 -0
- package/app/modules/userManagement/views/userView.js +324 -0
- package/conf/config.schema.json +18 -0
- package/docs/migrating-from-legacy.md +19 -0
- package/docs/plugins/index-ui.md +17 -0
- package/docs/plugins/uidocs.js +54 -0
- package/docs/ui-extensions.md +15 -0
- package/index.js +1 -0
- package/lib/UiBuild.js +391 -0
- package/lib/UiModule.js +158 -0
- package/npm_hooks/postinstall.js +4 -0
- package/package.json +27 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<input type="text" autocomplete="off">
|
|
2
|
+
<button class="scaffold-display-title-lock">
|
|
3
|
+
<i class="fa fa-lock" title="{{t 'app.titlelock'}}"></i>
|
|
4
|
+
<i class="fa fa-unlink" title="{{t 'app.titleunlock'}}"></i>
|
|
5
|
+
</button>
|
|
6
|
+
<button class="scaffold-display-title-clear">
|
|
7
|
+
<i class="fa fa-times-circle" title="{{t 'app.delete'}}"></i>
|
|
8
|
+
</button>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="ql-edit-html-overlay-inner" contenteditable=true></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<input class="scaffold-file" type="file" name="{{name}}"/>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div class="scaffold-items-modal-sidebar">
|
|
2
|
+
<div class="scaffold-items-modal-sidebar-inner">
|
|
3
|
+
{{#if title}}
|
|
4
|
+
<div class="scaffold-items-modal-header">
|
|
5
|
+
<h4>{{title}}</h4>
|
|
6
|
+
</div>
|
|
7
|
+
{{/if}}
|
|
8
|
+
<div class="scaffold-items-modal-body">{{content}}</div>
|
|
9
|
+
<div class="scaffold-items-modal-footer">
|
|
10
|
+
<a href="#" class="btn primary scaffold-items-modal-ok" data-action="ok">{{t 'app.ok'}}</a>
|
|
11
|
+
<a href="#" class="btn primary-hollow scaffold-items-modal-cancel" data-action="cancel">{{t 'app.cancel'}}</a>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="scaffold-modal-overlay"></div>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
define([
|
|
2
|
+
'core/origin',
|
|
3
|
+
'backboneForms',
|
|
4
|
+
'core/helpers',
|
|
5
|
+
'./scaffoldAssetView',
|
|
6
|
+
'modules/assetManagement/views/assetManagementModalView',
|
|
7
|
+
'modules/assetManagement/collections/assetCollection'
|
|
8
|
+
], function(Origin, BackboneForms, Helpers, ScaffoldAssetView, AssetManagementModalView, AssetCollection) {
|
|
9
|
+
|
|
10
|
+
var ScaffoldAssetItemView = ScaffoldAssetView.extend({
|
|
11
|
+
|
|
12
|
+
events: function() {
|
|
13
|
+
return _.extend({}, ScaffoldAssetView.prototype.events, {
|
|
14
|
+
'click .add-item': 'onAddItemClick',
|
|
15
|
+
'click .ui-draggable': 'onDragItemClick'
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
onAddItemClick: function(event) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
this.itemListView.addItem();
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
onDragItemClick: function(event) {
|
|
25
|
+
var item = _.find(this.dragItems, function(i) {
|
|
26
|
+
return i.$el[0] === event.currentTarget;
|
|
27
|
+
});
|
|
28
|
+
item.view.openEditor();
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
initialize: function(options) {
|
|
32
|
+
ScaffoldAssetView.prototype.initialize.apply(this, arguments);
|
|
33
|
+
this.init(options);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
init: function(options) {
|
|
37
|
+
var attrs = options.schema.inputType;
|
|
38
|
+
this.dragItems = [];
|
|
39
|
+
this.precision = attrs.precision || 3;
|
|
40
|
+
this.topAttr = attrs.topAttribute || '_top';
|
|
41
|
+
this.leftAttr = attrs.leftAttribute || '_left';
|
|
42
|
+
this.items = attrs.items || '_items';
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
postRender: function() {
|
|
46
|
+
if (!this.itemListView) {
|
|
47
|
+
this.itemListView = this.findItemView();
|
|
48
|
+
this.listenTo(this.itemListView, {
|
|
49
|
+
add: this.onItemListAdd,
|
|
50
|
+
remove: this.onItemListRemove,
|
|
51
|
+
change: this.onItemListChange
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// double defer:
|
|
55
|
+
// if external asset, postRender is triggered before el is injected into Dom
|
|
56
|
+
_.defer(function() {
|
|
57
|
+
var items = this.itemListView.items;
|
|
58
|
+
this.removeDragItems();
|
|
59
|
+
items && items.forEach(function(item) {
|
|
60
|
+
this.addDragItem(item.editor);
|
|
61
|
+
}, this);
|
|
62
|
+
}.bind(this));
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
findItemView: function() {
|
|
66
|
+
var form = Origin.scaffold.getCurrentForm();
|
|
67
|
+
var inputType = this.schema.inputType;
|
|
68
|
+
var targetAttr = inputType.targetAttribute;
|
|
69
|
+
|
|
70
|
+
var baseEditor;
|
|
71
|
+
|
|
72
|
+
switch (inputType.pluginType) {
|
|
73
|
+
case 'extension':
|
|
74
|
+
baseEditor = form.fields._extensions.editor.nestedForm.fields[targetAttr].editor;
|
|
75
|
+
break;
|
|
76
|
+
case 'menu':
|
|
77
|
+
baseEditor = form.fields.menuSettings.editor.nestedForm.fields[targetAttr].editor;
|
|
78
|
+
break;
|
|
79
|
+
case 'theme':
|
|
80
|
+
baseEditor = form.fields.themeSettings.editor.nestedForm.fields[targetAttr].editor;
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
baseEditor = form.fields.properties.editor;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return baseEditor.nestedForm.fields[this.items].editor;
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
removeDragItems: function() {
|
|
91
|
+
this.dragItems.forEach(this.removeDragItem, this);
|
|
92
|
+
this.dragItems = [];
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
addDragItem: function(itemView) {
|
|
96
|
+
var value = itemView.value;
|
|
97
|
+
var index = itemView.$el.closest('.list-item').index();
|
|
98
|
+
var elm = $('<div></div>', {
|
|
99
|
+
css: {
|
|
100
|
+
top: parseInt(value[this.topAttr]).toFixed(this.precision)+'%',
|
|
101
|
+
left: parseInt(value[this.leftAttr]).toFixed(this.precision)+'%',
|
|
102
|
+
position: 'absolute'
|
|
103
|
+
},
|
|
104
|
+
text: index + 1
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
this.dragItems.push({
|
|
108
|
+
$el: elm,
|
|
109
|
+
view: itemView
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
elm.appendTo('.scaffold-asset-item-img-holder').draggable({
|
|
113
|
+
containment: 'parent',
|
|
114
|
+
stop: this.onDragStop.bind(this)
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
updateDragItem: function(item) {
|
|
119
|
+
var index = item.view.$el.closest('.list-item').index();
|
|
120
|
+
item.$el.css({
|
|
121
|
+
top: parseInt(item.view.value[this.topAttr]).toFixed(this.precision)+'%',
|
|
122
|
+
left: parseInt(item.view.value[this.leftAttr]).toFixed(this.precision)+'%',
|
|
123
|
+
}).text(index + 1);
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
removeDragItem: function(item) {
|
|
127
|
+
if (!item.$el.hasClass('ui-draggable')) return;
|
|
128
|
+
item.$el.draggable('destroy').remove();
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
onItemListRemove: function(listView, listItemView) {
|
|
132
|
+
var index = -1;
|
|
133
|
+
for (var i = 0; i < this.dragItems.length; i++) {
|
|
134
|
+
if (this.dragItems[i].view === listItemView) {
|
|
135
|
+
index = i;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
this.removeDragItem(this.dragItems[index]);
|
|
140
|
+
this.dragItems.splice(index, 1);
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
onItemListAdd: function(listView, listItemView) {
|
|
144
|
+
this.addDragItem(listItemView);
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
onItemListChange: function(listView) {
|
|
148
|
+
this.dragItems.forEach(this.updateDragItem, this);
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
onDragStop: function(event, ui) {
|
|
152
|
+
var $dragHandle = $(event.target);
|
|
153
|
+
var $parent = this.$('.scaffold-asset-item-img-holder');
|
|
154
|
+
var left = (parseInt($dragHandle.css("left")) / ($parent.width() / 100)).toFixed(this.precision);
|
|
155
|
+
var top = (parseInt($dragHandle.css("top")) / ($parent.height() / 100)).toFixed(this.precision);
|
|
156
|
+
var child = _.find(this.dragItems, i => i.$el[0] === event.target);
|
|
157
|
+
|
|
158
|
+
if (!child) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
child.view.setValue(_.extend({}, child.view.value, { [this.leftAttr]: left, [this.topAttr]: top }));
|
|
162
|
+
child.view.renderSummary();
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
onAssetButtonClicked: function(event) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
|
|
168
|
+
Origin.trigger('modal:open', AssetManagementModalView, {
|
|
169
|
+
collection: new AssetCollection,
|
|
170
|
+
assetType: 'image',
|
|
171
|
+
_shouldShowScrollbar: false,
|
|
172
|
+
onUpdate: data => data && this.setValue(data.assetId)
|
|
173
|
+
}, this);
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
renderData: function(id) {
|
|
177
|
+
var dataUrl = Helpers.isAssetExternal(this.value) ? this.value : '';
|
|
178
|
+
|
|
179
|
+
this.$el.html(Handlebars.templates[this.constructor.template]({
|
|
180
|
+
value: this.value,
|
|
181
|
+
type: 'image',
|
|
182
|
+
url: id ? `api/asset/serve/${id}` : dataUrl,
|
|
183
|
+
addLabel: this.schema.inputType.addLabel || Origin.l10n.t('app.add')
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
_.defer(this.postRender.bind(this));
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
remove: function() {
|
|
190
|
+
this.removeDragItems();
|
|
191
|
+
this.dragItems = [];
|
|
192
|
+
ScaffoldAssetView.prototype.remove.apply(this, arguments);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
}, { template: 'scaffoldAssetItem' });
|
|
196
|
+
|
|
197
|
+
Origin.on('origin:dataReady', function() {
|
|
198
|
+
Origin.scaffold.addCustomField('AssetItem', ScaffoldAssetItemView);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return ScaffoldAssetItemView;
|
|
202
|
+
|
|
203
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
define([
|
|
2
|
+
'modules/assetManagement/collections/assetCollection',
|
|
3
|
+
'modules/assetManagement/views/assetManagementModalView',
|
|
4
|
+
'core/helpers',
|
|
5
|
+
'core/origin'
|
|
6
|
+
], function(AssetCollection, AssetManagementModalView, Helpers, Origin) {
|
|
7
|
+
var ScaffoldAssetView = Backbone.Form.editors.Base.extend({
|
|
8
|
+
assetType: null,
|
|
9
|
+
events: {
|
|
10
|
+
'change input': function() { this.trigger('change', this); },
|
|
11
|
+
'focus input': function() { this.trigger('focus', this); },
|
|
12
|
+
'blur input': function() { this.trigger('blur', this); },
|
|
13
|
+
'click .scaffold-asset-picker': 'onAssetButtonClicked',
|
|
14
|
+
'click .scaffold-asset-clear': 'onClearButtonClicked',
|
|
15
|
+
'click .scaffold-asset-external': 'onExternalAssetButtonClicked',
|
|
16
|
+
'click .scaffold-asset-external-input-save': 'onExternalAssetSaveClicked',
|
|
17
|
+
'click .scaffold-asset-external-input-cancel': 'onExternalAssetCancelClicked',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
initialize: function(options) {
|
|
21
|
+
Backbone.Form.editors.Base.prototype.initialize.call(this, options);
|
|
22
|
+
this.listenTo(Origin, 'scaffold:assets:autofill', this.setValue);
|
|
23
|
+
this.setValue(this.value);
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
render: function() {
|
|
27
|
+
this.renderData();
|
|
28
|
+
return this;
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
renderData: async function() {
|
|
32
|
+
this.assetType = this.schema.inputType.media || this.schema.inputType.replace(/Asset|:/g, '');
|
|
33
|
+
|
|
34
|
+
let url = thumbUrl = this.value;
|
|
35
|
+
|
|
36
|
+
if(!Helpers.isAssetExternal(this.value)) {
|
|
37
|
+
url = `api/assets/serve/${this.value}`;
|
|
38
|
+
thumbUrl = `${url}?thumb=true`;
|
|
39
|
+
}
|
|
40
|
+
const template = Handlebars.templates[this.constructor.template];
|
|
41
|
+
this.$el.html(template({ value: this.value, type: this.assetType, url, thumbUrl }));
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
checkValueHasChanged: function() {
|
|
45
|
+
var value = this.getValue();
|
|
46
|
+
if (this.key === 'heroImage') return this.saveModel({ heroImage: value });
|
|
47
|
+
if (Helpers.isAssetExternal(value)) return this.saveModel();
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
saveModel: function(attributesToSave) {
|
|
51
|
+
var currentModel = Origin.scaffold.getCurrentModel();
|
|
52
|
+
var alternativeModel = Origin.scaffold.getAlternativeModel();
|
|
53
|
+
var alternativeAttribute = Origin.scaffold.getAlternativeAttribute();
|
|
54
|
+
// Check if alternative model should be used
|
|
55
|
+
if (alternativeModel) {
|
|
56
|
+
currentModel = alternativeModel;
|
|
57
|
+
}
|
|
58
|
+
// run schema validation
|
|
59
|
+
Origin.scaffold.getCurrentForm().commit({ validate: false });
|
|
60
|
+
// Check if alternative attribute should be used
|
|
61
|
+
if (alternativeAttribute) {
|
|
62
|
+
attributesToSave[alternativeAttribute] = Origin.scaffold.getCurrentModel().attributes;
|
|
63
|
+
}
|
|
64
|
+
if (!attributesToSave) {
|
|
65
|
+
currentModel.pruneAttributes();
|
|
66
|
+
}
|
|
67
|
+
currentModel.save(attributesToSave, {
|
|
68
|
+
patch: attributesToSave !== undefined,
|
|
69
|
+
success: () => this.trigger('change', this),
|
|
70
|
+
error: () => Origin.Notify.alert({ type: 'error', text: Origin.l10n.t('app.errorsaveasset') })
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
setValue: function(value) {
|
|
75
|
+
Backbone.Form.editors.Base.prototype.setValue.call(this, value);
|
|
76
|
+
this.render();
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
getValue: function() {
|
|
80
|
+
return Backbone.Form.editors.Base.prototype.getValue.call(this) || undefined;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Event handling
|
|
84
|
+
|
|
85
|
+
focus: function() {
|
|
86
|
+
if (!this.hasFocus) this.$('input').focus();
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
blur: function() {
|
|
90
|
+
if (this.hasFocus) this.$('input').blur();
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
onAssetButtonClicked: function(event) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
|
|
96
|
+
Origin.trigger('modal:open', AssetManagementModalView, {
|
|
97
|
+
collection: new AssetCollection,
|
|
98
|
+
assetType: this.assetType,
|
|
99
|
+
_shouldShowScrollbar: false,
|
|
100
|
+
onUpdate: function(data) {
|
|
101
|
+
if(data) {
|
|
102
|
+
this.setValue(data.assetId);
|
|
103
|
+
if(data._shouldAutofill) {
|
|
104
|
+
Origin.trigger('scaffold:assets:autofill', data.assetId);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, this);
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
onClearButtonClicked: function(event) {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
|
|
114
|
+
this.checkValueHasChanged();
|
|
115
|
+
this.setValue('');
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
onExternalAssetButtonClicked: function(event) {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
|
|
121
|
+
this.toggleExternalAssetField(true);
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
onExternalAssetSaveClicked: function(event) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
|
|
127
|
+
var inputValue = this.$('.scaffold-asset-external-input-field').val();
|
|
128
|
+
|
|
129
|
+
if (!inputValue.length) return this.toggleExternalAssetField(false);
|
|
130
|
+
|
|
131
|
+
this.setValue(inputValue);
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
onExternalAssetCancelClicked: function(event) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
|
|
137
|
+
this.toggleExternalAssetField(false);
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
toggleExternalAssetField: function(shouldShow) {
|
|
141
|
+
this.$('.scaffold-asset-external-input').toggleClass('display-none', !shouldShow);
|
|
142
|
+
this.$('.scaffold-asset-buttons').toggleClass('display-none', shouldShow);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
}, { template: 'scaffoldAsset' });
|
|
146
|
+
|
|
147
|
+
Origin.on('origin:dataReady', function() {
|
|
148
|
+
Origin.scaffold.addCustomField('Asset:image', ScaffoldAssetView);
|
|
149
|
+
Origin.scaffold.addCustomField('Asset:audio', ScaffoldAssetView);
|
|
150
|
+
Origin.scaffold.addCustomField('Asset:video', ScaffoldAssetView);
|
|
151
|
+
Origin.scaffold.addCustomField('Asset:other', ScaffoldAssetView);
|
|
152
|
+
Origin.scaffold.addCustomField('Asset', ScaffoldAssetView);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return ScaffoldAssetView;
|
|
156
|
+
|
|
157
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
define(['core/origin', 'backboneForms'], function(Origin) {
|
|
2
|
+
var ScaffoldCodeEditorView = Backbone.Form.editors.Base.extend({
|
|
3
|
+
defaultValue: '',
|
|
4
|
+
className: 'scaffold-code-editor',
|
|
5
|
+
editor: null,
|
|
6
|
+
mode: 'text',
|
|
7
|
+
session: null,
|
|
8
|
+
|
|
9
|
+
initialize: function(options) {
|
|
10
|
+
Backbone.Form.editors.Base.prototype.initialize.call(this, options);
|
|
11
|
+
|
|
12
|
+
var inputType = options.schema.inputType;
|
|
13
|
+
var mode = inputType.mode || inputType.split(':')[1];
|
|
14
|
+
|
|
15
|
+
if(mode) this.mode = mode;
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
render: function() {
|
|
19
|
+
this.editor = window.ace.edit(this.$el[0], {
|
|
20
|
+
maxLines: 50,
|
|
21
|
+
minLines: 14,
|
|
22
|
+
mode: `ace/mode/${this.mode}`,
|
|
23
|
+
});
|
|
24
|
+
this.editor.on('change', () => this.trigger('change', this));
|
|
25
|
+
this.setValue(this.value);
|
|
26
|
+
|
|
27
|
+
return this;
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
setValue: function(value) {
|
|
31
|
+
this.editor.setValue(this.mode === 'json' ? JSON.stringify(value, null, '\t') : value);
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
getValue: function() {
|
|
35
|
+
var value = this.editor.getValue();
|
|
36
|
+
|
|
37
|
+
if(this.mode !== 'json') return value;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(value);
|
|
41
|
+
} catch(e) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
validate: function() {
|
|
47
|
+
var error = Backbone.Form.editors.Base.prototype.validate.call(this);
|
|
48
|
+
if(error) return error;
|
|
49
|
+
if(this.isSyntaxError()) return { message: Origin.l10n.t('app.errorsyntax') };
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
isSyntaxError: function() {
|
|
53
|
+
return this.editor.getSession().getAnnotations().some(a => a.type === 'error');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
Origin.on('origin:dataReady', function() {
|
|
58
|
+
Origin.scaffold.addCustomField('CodeEditor', ScaffoldCodeEditorView);
|
|
59
|
+
Origin.scaffold.addCustomField('CodeEditor:javascript', ScaffoldCodeEditorView);
|
|
60
|
+
Origin.scaffold.addCustomField('CodeEditor:less', ScaffoldCodeEditorView);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return ScaffoldCodeEditorView;
|
|
64
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
define(['core/origin', 'libraries/spectrum/spectrum'], function(Origin) {
|
|
2
|
+
var ScaffoldColourPickerView = Backbone.Form.editors.Base.extend({
|
|
3
|
+
tagName: 'input',
|
|
4
|
+
className: 'scaffold-colour-picker',
|
|
5
|
+
events: {
|
|
6
|
+
'change': function() { this.trigger('change', this) },
|
|
7
|
+
'focus': function() { this.trigger('focus', this) },
|
|
8
|
+
'blur': function() { this.trigger('blur', this) }
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
render: function() {
|
|
12
|
+
_.defer(this.postRender.bind(this));
|
|
13
|
+
return this;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
postRender: function() {
|
|
17
|
+
this.$el.spectrum({
|
|
18
|
+
color: this.value,
|
|
19
|
+
showAlpha: true,
|
|
20
|
+
showInitial: true,
|
|
21
|
+
showInput: true,
|
|
22
|
+
showPalette: true,
|
|
23
|
+
showButtons: true,
|
|
24
|
+
cancelText: Origin.l10n.t('app.scaffold.colourPickerCancel'),
|
|
25
|
+
allowEmpty: true, // to allow empty strings in schema default value
|
|
26
|
+
palette: [],
|
|
27
|
+
preferredFormat: "hex3",
|
|
28
|
+
showSelectionPalette: true,
|
|
29
|
+
maxSelectionSize: 24,
|
|
30
|
+
localStorageKey: "adapt-authoring.spectrum.colourpicker",
|
|
31
|
+
show: () => Origin.contentPane.disableScroll(),
|
|
32
|
+
hide: () => Origin.contentPane.enableScroll()
|
|
33
|
+
});
|
|
34
|
+
// remove class beacuse we aren't using the clear button
|
|
35
|
+
$('.sp-container').removeClass('sp-clear-enabled');
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
getValue: function() {
|
|
39
|
+
var colour = this.$el.spectrum('get');
|
|
40
|
+
|
|
41
|
+
if(!colour || !colour.getAlpha) {
|
|
42
|
+
return this.value;
|
|
43
|
+
}
|
|
44
|
+
return (colour.getAlpha() < 1) ? colour.toRgbString() : colour.toHexString();
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
setValue: function(value) {
|
|
48
|
+
this.$el.spectrum('set', value);
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
focus: function() {
|
|
52
|
+
if(!this.hasFocus) this.$el.focus();
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
blur: function() {
|
|
56
|
+
if(this.hasFocus) this.$el.blur();
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
remove: function() {
|
|
60
|
+
this.$el.spectrum('destroy');
|
|
61
|
+
Backbone.Form.editors.Text.prototype.remove.call(this);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
Origin.on('origin:dataReady', function() {
|
|
66
|
+
Origin.scaffold.addCustomField('ColourPicker', ScaffoldColourPickerView);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return ScaffoldColourPickerView;
|
|
70
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
define([ 'core/origin', 'backboneForms' ], function(Origin, BackboneForms) {
|
|
2
|
+
|
|
3
|
+
var ScaffoldDisplayTitleView = Backbone.Form.editors.Text.extend({
|
|
4
|
+
|
|
5
|
+
tagName: 'div',
|
|
6
|
+
|
|
7
|
+
form: null,
|
|
8
|
+
|
|
9
|
+
isLocked: null,
|
|
10
|
+
|
|
11
|
+
events: {
|
|
12
|
+
'change input': 'triggerChange',
|
|
13
|
+
'keyup input': 'triggerChange',
|
|
14
|
+
'focus input': function() {
|
|
15
|
+
this.trigger('focus', this);
|
|
16
|
+
},
|
|
17
|
+
'blur input': function() {
|
|
18
|
+
this.trigger('blur', this);
|
|
19
|
+
},
|
|
20
|
+
'click .scaffold-display-title-clear': function(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
|
|
23
|
+
this.isLocked = false;
|
|
24
|
+
this.setValue('');
|
|
25
|
+
},
|
|
26
|
+
'click .scaffold-display-title-lock': function(event) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
|
|
29
|
+
this.isLocked = !this.isLocked;
|
|
30
|
+
this.toggleLockButton();
|
|
31
|
+
|
|
32
|
+
if (this.isLocked) {
|
|
33
|
+
this.setValue(this.form.fields.title.editor.getValue());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
initialize: function(options) {
|
|
39
|
+
Backbone.Form.editors.Text.prototype.initialize.call(this, options);
|
|
40
|
+
|
|
41
|
+
this.form = options.form;
|
|
42
|
+
this.listenTo(this, 'change', this.onDisplayTitleChange);
|
|
43
|
+
this.listenTo(this.form, 'title:change', this.onTitleChange);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
render: function() {
|
|
47
|
+
this.$el.append(Handlebars.templates[this.constructor.template]({ field: '' }));
|
|
48
|
+
this.setValue(this.value);
|
|
49
|
+
this.isLocked = this.form.fields.title.editor.getValue() === this.getValue();
|
|
50
|
+
_.defer(this.postRender.bind(this));
|
|
51
|
+
|
|
52
|
+
return this;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
postRender: function() {
|
|
56
|
+
this.toggleLockButton();
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
triggerChange: function() {
|
|
60
|
+
this.trigger('change', this);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
onDisplayTitleChange: function() {
|
|
64
|
+
this.toggleLockButton();
|
|
65
|
+
this.toggleClearButton();
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
onTitleChange: function(form, titleEditor) {
|
|
69
|
+
if (this.isLocked) {
|
|
70
|
+
this.setValue(titleEditor.getValue());
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
getValue: function() {
|
|
75
|
+
return this.$('input').val();
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
setValue: function(value) {
|
|
79
|
+
this.$('input').val(value).trigger('change');
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
focus: function() {
|
|
83
|
+
if (!this.hasFocus) {
|
|
84
|
+
this.$('input').focus();
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
blur: function() {
|
|
89
|
+
if (this.hasFocus) {
|
|
90
|
+
this.$('input').blur();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
toggleLockButton: function() {
|
|
95
|
+
this.$el.parents('.field').toggleClass('unlocked', !this.isLocked);
|
|
96
|
+
this.$('input').prop('disabled', this.isLocked);
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
toggleClearButton: function() {
|
|
100
|
+
this.$('.scaffold-display-title-clear')
|
|
101
|
+
.toggleClass('display-none', !this.getValue());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}, { template: 'scaffoldDisplayTitle' });
|
|
105
|
+
|
|
106
|
+
Origin.on('origin:dataReady', function() {
|
|
107
|
+
Origin.scaffold.addCustomField('DisplayTitle', ScaffoldDisplayTitleView);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return ScaffoldDisplayTitleView;
|
|
111
|
+
|
|
112
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
define([
|
|
2
|
+
'backboneForms',
|
|
3
|
+
'core/origin'
|
|
4
|
+
], function(BackboneForms, Origin) {
|
|
5
|
+
var ScaffoldFileView = Backbone.Form.editors.Base.extend({
|
|
6
|
+
render: function() {
|
|
7
|
+
this.$el.html(Handlebars.templates[this.constructor.template]({ name: this.getName() }));
|
|
8
|
+
return this;
|
|
9
|
+
},
|
|
10
|
+
getValue: function() {
|
|
11
|
+
return this.$el ? this.$el.val() : undefined;
|
|
12
|
+
},
|
|
13
|
+
}, { template: 'scaffoldFile' });
|
|
14
|
+
|
|
15
|
+
Origin.on('origin:dataReady', () => Origin.scaffold.addCustomField('File', ScaffoldFileView));
|
|
16
|
+
|
|
17
|
+
return ScaffoldFileView;
|
|
18
|
+
});
|