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,49 @@
|
|
|
1
|
+
define(['core/origin'], function(Origin) {
|
|
2
|
+
var FilterView = Backbone.View.extend({
|
|
3
|
+
tagName: 'form',
|
|
4
|
+
className: 'user-management-filter',
|
|
5
|
+
events: {
|
|
6
|
+
'change input[type="checkbox"],select': 'onFormChange',
|
|
7
|
+
'input .search-email': 'onSearchInput'
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
initialize: function() {
|
|
11
|
+
this.listenTo(Origin, 'remove:views', this.remove);
|
|
12
|
+
this.render();
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
onSearchInput: function(event) {
|
|
16
|
+
this.collection.mailSearchTerm = $(event.currentTarget).val().toLowerCase();
|
|
17
|
+
this.collection.updateFilter();
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
onFormChange: function() {
|
|
21
|
+
var attributeMap = Array.from(this.$('input:checked')).reduce(function(memo, input) {
|
|
22
|
+
if(!memo[input.name]) memo[input.name] = [];
|
|
23
|
+
memo[input.name].push(input.value);
|
|
24
|
+
return memo;
|
|
25
|
+
}, {});
|
|
26
|
+
this.collection.updateFilter(attributeMap);
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
remove: function() {
|
|
30
|
+
this.tenantSelect && this.tenantSelect.destroy();
|
|
31
|
+
Backbone.View.prototype.remove.apply(this, arguments);
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
render: function() {
|
|
35
|
+
var template = Handlebars.templates['userManagementFilter'];
|
|
36
|
+
this.$el.html(template({ roles: this.model.get('allRoles').toJSON() }))
|
|
37
|
+
.appendTo('.sidebar-item');
|
|
38
|
+
return this;
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
reset: function() {
|
|
42
|
+
this.$('input[type="text"]').prop('disabled', false);
|
|
43
|
+
this.collection.filterGroups = {};
|
|
44
|
+
this.$('input[type="checkbox"]').prop('checked', false);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return FilterView;
|
|
49
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
define([
|
|
2
|
+
'core/origin',
|
|
3
|
+
'modules/sidebar/views/sidebarItemView',
|
|
4
|
+
'./filterView'
|
|
5
|
+
], function(Origin, SidebarItemView, FilterView) {
|
|
6
|
+
|
|
7
|
+
var UserManagementSidebarView = SidebarItemView.extend({
|
|
8
|
+
events: {
|
|
9
|
+
'click button.add': 'addUser'
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
initialize: function() {
|
|
13
|
+
SidebarItemView.prototype.initialize.apply(this, arguments);
|
|
14
|
+
this.listenTo(this.collection, { 'sync': this.render });
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
postRender: function() {
|
|
18
|
+
this.filterView = new FilterView({
|
|
19
|
+
collection: this.collection,
|
|
20
|
+
model: this.model
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
addUser: function(event) {
|
|
25
|
+
event && event.preventDefault();
|
|
26
|
+
Origin.router.navigateTo('userManagement/addUser');
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
template: 'userManagementSidebar'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return UserManagementSidebarView;
|
|
33
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
|
|
2
|
+
define(function(require){
|
|
3
|
+
var Origin = require('core/origin');
|
|
4
|
+
var OriginView = require('core/views/originView');
|
|
5
|
+
var UserView = require('../views/userView');
|
|
6
|
+
|
|
7
|
+
var UserManagementView = OriginView.extend({
|
|
8
|
+
className: 'userManagement',
|
|
9
|
+
settings: {
|
|
10
|
+
autoRender: false
|
|
11
|
+
},
|
|
12
|
+
users: null,
|
|
13
|
+
views: [],
|
|
14
|
+
selectedView: null,
|
|
15
|
+
showFilterScreen: false,
|
|
16
|
+
|
|
17
|
+
events: {
|
|
18
|
+
'click button.refresh-all': 'refreshUserViews',
|
|
19
|
+
'click button[data-sort]': 'onSortClick'
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
initialize: function() {
|
|
23
|
+
OriginView.prototype.initialize.apply(this, arguments);
|
|
24
|
+
this.users = this.collection;
|
|
25
|
+
|
|
26
|
+
this.listenTo(this.users, 'sort', function(a,b,c) {
|
|
27
|
+
this.removeChildViews();
|
|
28
|
+
this.renderChildViews();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
Origin.trigger('contentHeader:updateTitle', { title: Origin.l10n.t('app.usermanagementtitle') });
|
|
32
|
+
|
|
33
|
+
this.listenTo(this.users, { 'change': this.render });
|
|
34
|
+
|
|
35
|
+
this.render();
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
render: function() {
|
|
39
|
+
this.removeChildViews();
|
|
40
|
+
OriginView.prototype.render.apply(this, arguments);
|
|
41
|
+
this.renderChildViews();
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
renderChildViews: function() {
|
|
45
|
+
var fragment = document.createDocumentFragment();
|
|
46
|
+
this.users.each(function(user) {
|
|
47
|
+
var userView = new UserView({ model: user });
|
|
48
|
+
fragment.appendChild(userView.el);
|
|
49
|
+
this.views.push(userView);
|
|
50
|
+
|
|
51
|
+
if(this.selectedView && user.get('_id') === this.selectedView) {
|
|
52
|
+
userView.$el.addClass('selected').click();
|
|
53
|
+
}
|
|
54
|
+
}, this);
|
|
55
|
+
this.$('.users').append(fragment);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
removeChildViews: function() {
|
|
59
|
+
if(this.views.length) {
|
|
60
|
+
for(var i = 0, count = this.views.length; i < count; i++) {
|
|
61
|
+
var view = this.views[i];
|
|
62
|
+
if (view.isSelected) this.selectedView = view.model.get('_id');
|
|
63
|
+
view.remove();
|
|
64
|
+
}
|
|
65
|
+
this.views = [];
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
postRender: function() {
|
|
70
|
+
this.setViewToReady();
|
|
71
|
+
this.$('.users').fadeIn(300);
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
onSortClick: function(event) {
|
|
75
|
+
var $elm = $(event.currentTarget);
|
|
76
|
+
var sortBy = $elm.data('sort');
|
|
77
|
+
var sortAscending = $elm.hasClass('sort-down');
|
|
78
|
+
|
|
79
|
+
if ($elm.hasClass('active')) {
|
|
80
|
+
sortAscending = !sortAscending;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.$('.sort').removeClass('active sort-up').addClass('sort-down');
|
|
84
|
+
$elm.addClass('active');
|
|
85
|
+
|
|
86
|
+
$elm.toggleClass('sort-down', sortAscending);
|
|
87
|
+
$elm.toggleClass('sort-up', !sortAscending);
|
|
88
|
+
|
|
89
|
+
this.users.sortBy = sortBy;
|
|
90
|
+
this.users.direction = (sortAscending) ? 1 : -1;
|
|
91
|
+
this.users.updateFilter();
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
refreshUserViews: async function(event) {
|
|
95
|
+
event && event.preventDefault();
|
|
96
|
+
await this.collection.fetch();
|
|
97
|
+
this.render();
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
template: 'userManagement'
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return UserManagementView;
|
|
104
|
+
});
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
|
|
2
|
+
define(function(require){
|
|
3
|
+
var OriginView = require('core/views/originView');
|
|
4
|
+
var Origin = require('core/origin');
|
|
5
|
+
var Helpers = require('../helpers');
|
|
6
|
+
|
|
7
|
+
var UserView = OriginView.extend({
|
|
8
|
+
isSelected: false,
|
|
9
|
+
tagName: 'div',
|
|
10
|
+
className: function() {
|
|
11
|
+
const classes = ['user-item', 'tb-row', this.model.get('_id')];
|
|
12
|
+
if(this.model.get('_id') === Origin.sessionModel.get('user')._id) {
|
|
13
|
+
classes.push('me');
|
|
14
|
+
}
|
|
15
|
+
if(this.model.get('_isHidden')) {
|
|
16
|
+
classes.push('display-none');
|
|
17
|
+
}
|
|
18
|
+
return classes.join(' ');
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
events: {
|
|
22
|
+
'click': 'onClicked',
|
|
23
|
+
|
|
24
|
+
'click a.edit': 'onEditClicked',
|
|
25
|
+
'click a.save': 'onSaveClicked',
|
|
26
|
+
'click a.cancel': 'onCancelClicked',
|
|
27
|
+
|
|
28
|
+
'click a.saveRoles': 'onSaveRoleClicked',
|
|
29
|
+
|
|
30
|
+
'click button.invite': 'onInviteClicked',
|
|
31
|
+
'click button.resetPassword': 'onResetPasswordClicked',
|
|
32
|
+
'click button.changePassword': 'onChangePasswordClicked',
|
|
33
|
+
|
|
34
|
+
'click button.disable': 'onDisableClicked',
|
|
35
|
+
'click button.delete': 'onDeleteClicked',
|
|
36
|
+
'click button.restore': 'onRestoreClicked',
|
|
37
|
+
'click button.unlock': 'onRestoreClicked'
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
preRender: function() {
|
|
41
|
+
this.listenTo(Origin, 'userManagement:user:reset', this.resetView);
|
|
42
|
+
this.listenTo(this, 'remove', this.remove);
|
|
43
|
+
this.listenTo(this.model, {
|
|
44
|
+
'destroy': this.remove,
|
|
45
|
+
'change:_isHidden': this.toggleHidden
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
render: function() {
|
|
50
|
+
OriginView.prototype.render.apply(this, arguments);
|
|
51
|
+
this.applyStyles();
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
applyStyles: function() {
|
|
55
|
+
// disabled user styling
|
|
56
|
+
this.$el.toggleClass('inactive', !this.model.get('isEnabled'));
|
|
57
|
+
// locked user styling
|
|
58
|
+
this.$el.toggleClass('locked', (this.model.get('isTempLocked') || this.model.get('isPermLocked')));
|
|
59
|
+
// selected user styling
|
|
60
|
+
if(this.isSelected) {
|
|
61
|
+
this.$el.addClass('selected');
|
|
62
|
+
this.$('.edit-mode').removeClass('display-none');
|
|
63
|
+
this.$('.write').addClass('display-none');
|
|
64
|
+
} else {
|
|
65
|
+
this.$el.removeClass('selected');
|
|
66
|
+
this.$('.edit-mode').addClass('display-none');
|
|
67
|
+
this.$('.write').addClass('display-none');
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
resetView: function() {
|
|
72
|
+
if(this.isSelected) {
|
|
73
|
+
this.isSelected = false;
|
|
74
|
+
this.applyStyles();
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
getColumnFromDiv: function(div) {
|
|
79
|
+
return $(div).closest('.tb-col-inner');
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
getInputFromDiv: function(div) {
|
|
83
|
+
return $('.input', this.getColumnFromDiv(div));
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
disableFieldEdit: function(div) {
|
|
87
|
+
$('.read', div).removeClass('display-none');
|
|
88
|
+
$('.write', div).addClass('display-none');
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
toggleHidden: function(model, _isHidden) {
|
|
92
|
+
this.$el.toggleClass('display-none', _isHidden);
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
enableFieldEdit: function(div) {
|
|
96
|
+
$('.read', div).addClass('display-none');
|
|
97
|
+
$('.write', div).removeClass('display-none').children('input').focus();
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
enableUser: function(isEnable) {
|
|
101
|
+
Helpers.ajax(`api/auth/local/${isEnable ? 'enable' : 'disable'}`, { _id: this.model.get('_id') }, 'POST', () => this.model.fetch());
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
onEditClicked: function(event) {
|
|
105
|
+
event && event.preventDefault();
|
|
106
|
+
|
|
107
|
+
var $column = this.getColumnFromDiv(event.currentTarget);
|
|
108
|
+
// disable any existing inputs first
|
|
109
|
+
this.disableFieldEdit(this.$el);
|
|
110
|
+
this.enableFieldEdit($column);
|
|
111
|
+
var $input = this.getInputFromDiv($column);
|
|
112
|
+
var inputType = $input.attr('type');
|
|
113
|
+
if(inputType === "text" || inputType === "email") {
|
|
114
|
+
$input.val(this.model.get($input.attr('data-modelKey')));
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
onClicked: function(event) {
|
|
119
|
+
if(this.isSelected) return;
|
|
120
|
+
// will reset the old selection
|
|
121
|
+
Origin.trigger('userManagement:user:reset');
|
|
122
|
+
this.isSelected = true;
|
|
123
|
+
this.applyStyles();
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
onSaveClicked: function(event) {
|
|
127
|
+
event && event.preventDefault();
|
|
128
|
+
|
|
129
|
+
var $column = this.getColumnFromDiv(event.currentTarget);
|
|
130
|
+
this.disableFieldEdit($column);
|
|
131
|
+
// save if not the same as old value
|
|
132
|
+
var $input = this.getInputFromDiv($column);
|
|
133
|
+
this.updateModel($input.attr('data-modelKey'), $input.val());
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
onCancelClicked: function(event) {
|
|
137
|
+
event && event.preventDefault();
|
|
138
|
+
this.disableFieldEdit(this.getColumnFromDiv(event.currentTarget));
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
onSaveRoleClicked: async function(event) {
|
|
142
|
+
event && event.preventDefault();
|
|
143
|
+
|
|
144
|
+
var $column = this.getColumnFromDiv(event.currentTarget);
|
|
145
|
+
var $input = this.getInputFromDiv($column);
|
|
146
|
+
var oldRoleId = this.model.get('roles')[0];
|
|
147
|
+
var newRole = $input.val();
|
|
148
|
+
|
|
149
|
+
this.disableFieldEdit($column);
|
|
150
|
+
|
|
151
|
+
if(!newRole || newRole === oldRoleId) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const newData = await $.ajax({ url: `api/users/${this.model.get('_id')}`, method: 'PATCH', data: { roles: [newRole] } });
|
|
156
|
+
this.model.set(newData);
|
|
157
|
+
} catch(e) {
|
|
158
|
+
this.onError(e);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
onInviteClicked: function(e) {
|
|
163
|
+
Origin.Notify.confirm({
|
|
164
|
+
text: Origin.l10n.t('app.confirmsendinvite', { email: this.model.get('email') }),
|
|
165
|
+
callback: result => {
|
|
166
|
+
if(!result.isConfirmed) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
var $btn = $(e.target);
|
|
170
|
+
$btn.addClass('submitted');
|
|
171
|
+
Helpers.ajax('api/auth/local/invite', { email: this.model.get('email') }, 'POST', () => {
|
|
172
|
+
$btn.removeClass('submitted');
|
|
173
|
+
Origin.Notify.alert({
|
|
174
|
+
type: 'success',
|
|
175
|
+
text: Origin.l10n.t('app.invitesent', { email: this.model.get('email') })
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
onResetPasswordClicked: function(e) {
|
|
183
|
+
Origin.Notify.confirm({
|
|
184
|
+
text: Origin.l10n.t('app.confirmsendreset', { email: this.model.get('email') }),
|
|
185
|
+
callback: result => {
|
|
186
|
+
if (!result.isConfirmed) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
var $btn = $(e.currentTarget);
|
|
190
|
+
$btn.addClass('submitted');
|
|
191
|
+
Helpers.ajax('api/auth/local/forgotpass', { email: this.model.get('email') }, 'POST', () => {
|
|
192
|
+
$btn.removeClass('submitted');
|
|
193
|
+
Origin.Notify.alert({
|
|
194
|
+
type: 'success',
|
|
195
|
+
text: Origin.l10n.t('app.resetsent', { email: this.model.get('email') })
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
onChangePasswordClicked: function() {
|
|
203
|
+
Origin.Notify.confirm({
|
|
204
|
+
type: 'input',
|
|
205
|
+
title: Origin.l10n.t('app.resetpasswordtitle'),
|
|
206
|
+
text: Origin.l10n.t('app.resetpasswordinstruction', { email: this.model.get('email') }),
|
|
207
|
+
input: 'password',
|
|
208
|
+
confirmButtonText: 'Save',
|
|
209
|
+
callback: ({ isConfirmed, value: password }) => {
|
|
210
|
+
if(!isConfirmed) return;
|
|
211
|
+
else if(password === "") return swal.showInputError(Origin.l10n.t('app.invalidempty'));
|
|
212
|
+
const email = this.model.get('email');
|
|
213
|
+
Helpers.ajax('api/auth/local/changepass', { email, password }, 'POST', () => {
|
|
214
|
+
this.model.fetch();
|
|
215
|
+
Origin.Notify.alert({ type: 'success', text: Origin.l10n.t('app.changepasswordtext', { email }) });
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
onDisableClicked: function() {
|
|
222
|
+
this.enableUser(false);
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
onRestoreClicked: function() {
|
|
226
|
+
this.enableUser(true);
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
onDeleteClicked: async function() {
|
|
230
|
+
const option = this.$('[name="delete-options"]').val();
|
|
231
|
+
let popupHtml = Origin.l10n.t('app.deleteusermessage', { email: this.model.get('email') });
|
|
232
|
+
const courses = await $.post(`/api/content/query`, { _type: 'course', createdBy: this.model.get('_id') });
|
|
233
|
+
if(courses.length) {
|
|
234
|
+
popupHtml += Origin.l10n.t('app.deleteusercourseconfirm') +
|
|
235
|
+
'<select id="swal-courses" class="swal2-select">' +
|
|
236
|
+
`<option value="delete">${Origin.l10n.t("app.deletecourses")}</option>` +
|
|
237
|
+
`<option value="transfer">${Origin.l10n.t("app.transfercourses")}</option>` +
|
|
238
|
+
'</select>' +
|
|
239
|
+
'<div class="email-container">' +
|
|
240
|
+
`<input id="swal-email" class="swal2-input" placeholder="${Origin.l10n.t("app.deleteusercoursesinstruction")}">` +
|
|
241
|
+
'</div>' +
|
|
242
|
+
Origin.l10n.t('app.onewaytrip');
|
|
243
|
+
}
|
|
244
|
+
Origin.Notify.confirm({
|
|
245
|
+
type: 'confirm',
|
|
246
|
+
title: Origin.l10n.t('app.deleteuser'),
|
|
247
|
+
html: popupHtml,
|
|
248
|
+
didOpen: () => {
|
|
249
|
+
const $container = $('.email-container');
|
|
250
|
+
const $select = $('select.swal2-select');
|
|
251
|
+
$container.hide();
|
|
252
|
+
$select.on('change', () => $container.toggle($select.val() === 'transfer'));
|
|
253
|
+
},
|
|
254
|
+
preConfirm: async () => {
|
|
255
|
+
const shouldTransferCourses = $('select.swal2-select').val() === 'transfer';
|
|
256
|
+
let transferCoursesToUser;
|
|
257
|
+
|
|
258
|
+
if(shouldTransferCourses) {
|
|
259
|
+
const [newOwner] = await $.ajax({
|
|
260
|
+
url: '/api/users/query',
|
|
261
|
+
method: 'POST',
|
|
262
|
+
data: { email: $('#swal-email').val() }
|
|
263
|
+
});
|
|
264
|
+
if(!newOwner) {
|
|
265
|
+
Origin.Notify.Swal.showValidationMessage(Origin.l10n.t("app.unknownuser"));
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
transferCoursesToUser = newOwner._id;
|
|
269
|
+
}
|
|
270
|
+
this.model.set({ shouldTransferCourses, transferCoursesToUser });
|
|
271
|
+
},
|
|
272
|
+
callback: async result => {
|
|
273
|
+
if(!result.isConfirmed) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if(courses.length) {
|
|
277
|
+
try {
|
|
278
|
+
await Promise.all(courses.map(async c => {
|
|
279
|
+
const url = `/api/content/${c._id}`;
|
|
280
|
+
if(this.model.get('shouldTransferCourses')) {
|
|
281
|
+
await $.ajax({ url, method: 'PATCH', data: { createdBy: this.model.get('transferCoursesToUser') } });
|
|
282
|
+
} else {
|
|
283
|
+
await $.ajax({ url, method: 'DELETE' });
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
286
|
+
} catch(e) {
|
|
287
|
+
return this.onError(e.responseJSON.message);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
this.model.destroy({
|
|
291
|
+
data: { userCourseOption: option },
|
|
292
|
+
processData: true,
|
|
293
|
+
error: this.onError
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
updateModel: function(key, value) {
|
|
300
|
+
if(this.model.get(key) === value) {
|
|
301
|
+
return; // no point saving if there's no change
|
|
302
|
+
}
|
|
303
|
+
this.model.save({ [key]: value }, {
|
|
304
|
+
patch: true,
|
|
305
|
+
wait: true,
|
|
306
|
+
error: (model, response) => {
|
|
307
|
+
if(response.responseJSON && response.responseJSON.code === 11000) { // duplicate key
|
|
308
|
+
return this.onError(Origin.l10n.t('app.duplicateuservalueerror', { key, value }));
|
|
309
|
+
}
|
|
310
|
+
this.onError(`${Origin.l10n.t('app.uservalueerror')} (${response.responseText})`);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
onError: function(error) {
|
|
316
|
+
// HACK setTimeout workaround to give sweetalert time to clean up after a confirm
|
|
317
|
+
setTimeout(() => Origin.Notify.alert({ type: 'error', text: error.message || error }), 100);
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
template: 'user'
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
return UserView;
|
|
324
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"buildDir": {
|
|
6
|
+
"description": "Location of UI build files",
|
|
7
|
+
"type": "string",
|
|
8
|
+
"isDirectory": true,
|
|
9
|
+
"default": "$TEMP/ui-build"
|
|
10
|
+
},
|
|
11
|
+
"srcDir": {
|
|
12
|
+
"description": "Location of UI source files",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"isDirectory": true,
|
|
15
|
+
"default": "$TEMP/ui-src"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Migrating from legacy
|
|
2
|
+
|
|
3
|
+
> During development, set `adapt-authoring-ui.isProduction` to `false` in your config file for easier debugging (all .js files are served directly, rather using than the minified adapt.js file)
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
### Permissions
|
|
8
|
+
|
|
9
|
+
The permissions mechanism has been completely rewritten to use permissions 'scopes' which are human-readable strings. Permissions utilities are now accessed directly from the SessionModel.
|
|
10
|
+
|
|
11
|
+
- `Origin.permissions.hasPermission` => `Origin.sessionModel.hasScopes`
|
|
12
|
+
- `hasPermission` => `ifHasScopes`
|
|
13
|
+
|
|
14
|
+
### APIs
|
|
15
|
+
|
|
16
|
+
#### TODO
|
|
17
|
+
|
|
18
|
+
### Language strings
|
|
19
|
+
Language strings are now served directly from the back-end server, and therefore need to be stored in the root `lang` folder of your authoring tool module. The server will need to be restarted for any changes to these to be recognised.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Welcome!
|
|
2
|
+
|
|
3
|
+
This is the home of the official API reference documentation for the front-end application of the Adapt authoring tool (for the Node.js backend docs, see [this page]()).
|
|
4
|
+
|
|
5
|
+
The Adapt authoring tool is a server-based user interface for authoring eLearning courses using the Adapt framework.
|
|
6
|
+
|
|
7
|
+
## Contributing
|
|
8
|
+
If you come across any errors or omissions in this documentation, please submit an issue on our [GitHub page](https://github.com/adaptlearning/adapt_authoring/issues).
|
|
9
|
+
|
|
10
|
+
If you also have time to fix the issue, please see our [contribution guide](https://github.com/adaptlearning/adapt_framework/wiki/Contributing-code) on how to submit a fix.
|
|
11
|
+
|
|
12
|
+
## Useful links
|
|
13
|
+
|
|
14
|
+
- [Project website](https://www.adaptlearning.org/)
|
|
15
|
+
- [GitHub project](https://github.com/adapt-security/adapt-authoring)
|
|
16
|
+
- [Technical discussion forum](https://community.adaptlearning.org/mod/forum/view.php?id=4)
|
|
17
|
+
- [Gitter chatrooms](https://www.adaptlearning.org/)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { exec } from 'child_process'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import fs from 'fs-extra'
|
|
4
|
+
import { globSync } from 'glob'
|
|
5
|
+
import path from 'path'
|
|
6
|
+
import { promisify } from 'util'
|
|
7
|
+
|
|
8
|
+
const execPromise = promisify(exec)
|
|
9
|
+
|
|
10
|
+
export default class UIDocs {
|
|
11
|
+
resolvePath (relativePath, basePath) {
|
|
12
|
+
if (!basePath) basePath = this.docsRootPath
|
|
13
|
+
if (basePath instanceof URL) basePath = fileURLToPath(basePath)
|
|
14
|
+
return path.resolve(basePath, relativePath)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async run () {
|
|
18
|
+
this.outputDir = path.resolve(this.config.outputDir, '../frontend')
|
|
19
|
+
this.docsRootPath = path.resolve(this.app.dependencies['adapt-authoring-docs'].rootDir, 'jsdoc3')
|
|
20
|
+
this.configPath = this.resolvePath('.jsdocConfig.json', this.config.srcDir)
|
|
21
|
+
await this.writeConfig()
|
|
22
|
+
|
|
23
|
+
await execPromise(`npx jsdoc -c ${this.configPath}`)
|
|
24
|
+
await Promise.all([
|
|
25
|
+
fs.copy(this.resolvePath('./styles/adapt.css'), `${this.outputDir}/styles/adapt.css`),
|
|
26
|
+
fs.copy(this.resolvePath('./scripts/adapt.js'), `${this.outputDir}/scripts/adapt.js`),
|
|
27
|
+
fs.copy(this.resolvePath('../assets'), `${this.outputDir}/assets`)
|
|
28
|
+
])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async writeConfig () {
|
|
32
|
+
const config = await fs.readJson(path.join(this.docsRootPath, '.jsdocConfig.json'))
|
|
33
|
+
// update source files
|
|
34
|
+
config.source.include = [
|
|
35
|
+
this.resolvePath('index-ui.md', this.config.srcDir),
|
|
36
|
+
...globSync(`${this.app.dependencies['adapt-authoring-ui'].rootDir}/app/**/*.js`, { absolute: true })
|
|
37
|
+
].filter(f => !f.includes('/libraries/'))
|
|
38
|
+
// replace first menu item
|
|
39
|
+
config.docdash.menu = Object.entries(config.docdash.menu).reduce((m, [k, v], i) => {
|
|
40
|
+
if (i === 0) {
|
|
41
|
+
k = `<img class="logo" src="assets/logo-outline-colour.png" />Adapt authoring tool front-end documentation<br><span class="version">v${this.app.pkg.version}</span>`
|
|
42
|
+
}
|
|
43
|
+
m[k] = v
|
|
44
|
+
return m
|
|
45
|
+
}, {})
|
|
46
|
+
// update metadata
|
|
47
|
+
config.docdash.meta.version = `v${this.app.pkg.version}`
|
|
48
|
+
config.docdash.meta.title = config.docdash.meta.description = 'Adapt authoring tool front-end documentation'
|
|
49
|
+
// set dest path
|
|
50
|
+
config.opts.destination = this.outputDir
|
|
51
|
+
|
|
52
|
+
return fs.writeFile(this.configPath, JSON.stringify(config, null, 2))
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Extending the UI
|
|
2
|
+
The UI can be extended easily from an Adapt authoring tool module.
|
|
3
|
+
|
|
4
|
+
## Register your plugin
|
|
5
|
+
Register your UI plugin by calling the [UIModule#addUiPlugin](https://tomtaylor.codes/ls/jsdoc3/UIModule.html#addUiPlugin) function from your own module's [init](https://tomtaylor.codes/ls/jsdoc3/AbstractModule.html#init) function, which ensures that your plugin code is included in the build of the front-end app.
|
|
6
|
+
|
|
7
|
+
Any files found in this folder will be included in the app build process, so make sure you include all front-end code, Handlebars templates and LESS/CSS in here.
|
|
8
|
+
|
|
9
|
+
## Define language strings
|
|
10
|
+
Add any translated language strings to the `/lang` folder in the root of your module
|
|
11
|
+
|
|
12
|
+
## Resources
|
|
13
|
+
|
|
14
|
+
- **GitHub template**: You can use the following GitHub template repository as a starting point:
|
|
15
|
+
[adapt-security/adapt-authoring-uiplugintemplate](https://github.com/adapt-security/adapt-authoring-uiplugintemplate)
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lib/UiModule.js'
|