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,26 @@
|
|
|
1
|
+
<div class="asset-management-modal-tags-inner">
|
|
2
|
+
<div class="asset-management-modal-tags-toolbar">
|
|
3
|
+
<div class="asset-management-modal-tags-toolbar-inner clearfix">
|
|
4
|
+
<div class="asset-management-modal-tags-toolbar-title sidebar-filter-toolbar-title">
|
|
5
|
+
{{title}}
|
|
6
|
+
</div>
|
|
7
|
+
<div class="asset-management-modal-tags-toolbar-close sidebar-filter-toolbar-close">
|
|
8
|
+
<button class="fa fa-times"></button>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="asset-management-modal-tags-search sidebar-filter-search">
|
|
13
|
+
<input type="text" class="asset-management-modal-tags-search-input sidebar-filter-search-input" />
|
|
14
|
+
</div>
|
|
15
|
+
<div class="asset-management-modal-tags-items sidebar-filter-items">
|
|
16
|
+
<div class="asset-management-modal-tags-items-inner">
|
|
17
|
+
{{#each items}}
|
|
18
|
+
<button class="asset-management-modal-tags-item sidebar-filter-item" data-title="{{title}}" data-id="{{_id}}">
|
|
19
|
+
<div class="asset-management-modal-tags-item-inner">
|
|
20
|
+
{{#if _isUsed}}<i class="fa fa-check"></i>{{/if}}{{title}}
|
|
21
|
+
</div>
|
|
22
|
+
</button>
|
|
23
|
+
{{/each}}
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<div class="asset-preview-details text-centered">
|
|
2
|
+
<div class="asset-preview-details-preview">
|
|
3
|
+
{{#ifValueEquals type "image"}}
|
|
4
|
+
<img src="api/assets/serve/{{_id}}?{{timestring updatedAt}}"/>
|
|
5
|
+
{{/ifValueEquals}}
|
|
6
|
+
|
|
7
|
+
{{#ifValueEquals type "video"}}
|
|
8
|
+
<video preload="auto" controls width="640px" height="360px" poster="" style="width:100%; height:100%;">
|
|
9
|
+
<source src="api/assets/serve/{{_id}}?{{timestring updatedAt}}" type="{{type}}/{{subtype}}"/>
|
|
10
|
+
</video>
|
|
11
|
+
{{/ifValueEquals}}
|
|
12
|
+
|
|
13
|
+
{{#ifValueEquals type "audio"}}
|
|
14
|
+
<audio src="api/assets/serve/{{_id}}?{{timestring updatedAt}}" type="{{type}}/{{subtype}}" controls="controls" style="width:100%;"></audio>
|
|
15
|
+
{{/ifValueEquals}}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<h1 class="asset-preview-title">{{title}}</h1>
|
|
19
|
+
<div class="asset-preview-description">{{description}}</div>
|
|
20
|
+
|
|
21
|
+
<div class="asset-type">
|
|
22
|
+
<i class="fa {{iconName}}"></i> <span>{{type}}/{{subtype}}</span>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="asset-size">{{t 'app.assetsize'}}: {{{bytesToSize size}}}</div>
|
|
26
|
+
|
|
27
|
+
{{#if duration}}
|
|
28
|
+
<div class="asset-duration break">{{t 'app.assetduration'}}: {{{formatDuration metadata.duration}}}</div>
|
|
29
|
+
{{/if}}
|
|
30
|
+
|
|
31
|
+
{{#if resolution}}
|
|
32
|
+
<div class="asset-height">{{t 'app.assetdimensions'}}: {{resolution}}</div>
|
|
33
|
+
{{/if}}
|
|
34
|
+
|
|
35
|
+
{{#if tagsMapped.length}}
|
|
36
|
+
<div class="asset-tags">{{t 'app.tags'}}: {{renderTags tagsMapped "title"}}</div>
|
|
37
|
+
{{/if}}
|
|
38
|
+
|
|
39
|
+
{{#if isSelectable}}
|
|
40
|
+
<div class="assset-select">
|
|
41
|
+
<a href="#" class="btn primary confirm-select-asset">Select</a>
|
|
42
|
+
</div>
|
|
43
|
+
{{/if}}
|
|
44
|
+
<div class="asset-preview-edit">
|
|
45
|
+
{{#if _isDeleted}}
|
|
46
|
+
<button class="asset-preview-restore-button btn alert">{{t 'app.restore'}}</button>
|
|
47
|
+
{{else}}
|
|
48
|
+
<button class="asset-preview-edit-button btn primary">{{t 'app.edit'}}</button>
|
|
49
|
+
<button class="asset-preview-delete-button btn alert">{{t 'app.delete'}}</button>
|
|
50
|
+
{{/if}}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<div class="sidebar-item-inner">
|
|
2
|
+
|
|
3
|
+
{{!-- <div class="sidebar-row sidebar-item-title">
|
|
4
|
+
<h2 class="sidebar-item-title-inner">
|
|
5
|
+
Asset Management
|
|
6
|
+
</h2>
|
|
7
|
+
</div> --}}
|
|
8
|
+
|
|
9
|
+
<div class="separator"></div>
|
|
10
|
+
|
|
11
|
+
<button class="asset-management-sidebar-new action-primary">
|
|
12
|
+
<span class="asset-management-sidebar-new-inner">
|
|
13
|
+
{{t 'app.uploadnewasset'}}
|
|
14
|
+
</span>
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<div class="separator"></div>
|
|
18
|
+
|
|
19
|
+
{{!-- ASSET FILTERS --}}
|
|
20
|
+
|
|
21
|
+
<div class="sidebar-row sidebar-divide">
|
|
22
|
+
<h3 class="sidebar-divide-inner">
|
|
23
|
+
<i class="fa fa-filter"></i>{{t 'app.assetfilters'}}
|
|
24
|
+
</h3>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
{{!-- inline search field with close button --}}
|
|
28
|
+
<div class="sidebar-row">
|
|
29
|
+
<div class="sidebar-row-input">
|
|
30
|
+
<input type="text" class="asset-management-sidebar-filter-search" placeholder="{{t 'app.searchbyname'}}"/>
|
|
31
|
+
<button class="sidebar-filter-clear">
|
|
32
|
+
<i class="fa fa-times"></i>
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="sidebar-row">
|
|
38
|
+
<button class="asset-management-sidebar-filter-image sidebar-tag asset-management-sidebar-filter-button" data-filter-type="image">
|
|
39
|
+
<span class="asset-management-sidebar-filter-image-inner">
|
|
40
|
+
<i class="fa fa-toggle-off"></i>{{t 'app.filetypeimage' }}
|
|
41
|
+
</span>
|
|
42
|
+
<span class="asset-management-sidebar-filter-image-icon">
|
|
43
|
+
<i class="fa fa-image"></i>
|
|
44
|
+
</span>
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="sidebar-row">
|
|
49
|
+
<button class="asset-management-sidebar-filter-audio sidebar-tag asset-management-sidebar-filter-button" data-filter-type="audio">
|
|
50
|
+
<span class="asset-management-sidebar-filter-audio-inner">
|
|
51
|
+
<i class="fa fa-toggle-off"></i>{{t 'app.filetypeaudio' }}
|
|
52
|
+
</span>
|
|
53
|
+
<span class="asset-management-sidebar-filter-image-icon">
|
|
54
|
+
<i class="fa fa-file-audio-o"></i>
|
|
55
|
+
</span>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div class="sidebar-row">
|
|
60
|
+
<button class="asset-management-sidebar-filter-video sidebar-tag asset-management-sidebar-filter-button" data-filter-type="video">
|
|
61
|
+
<span class="asset-management-sidebar-filter-video-inner">
|
|
62
|
+
<i class="fa fa-toggle-off"></i>{{t 'app.filetypevideo' }}
|
|
63
|
+
</span>
|
|
64
|
+
<span class="asset-management-sidebar-filter-image-icon">
|
|
65
|
+
<i class="fa fa-file-video-o"></i>
|
|
66
|
+
</span>
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="sidebar-row">
|
|
71
|
+
<button class="asset-management-sidebar-filter-other sidebar-tag asset-management-sidebar-filter-button" data-filter-type="other">
|
|
72
|
+
<span class="asset-management-sidebar-filter-other-inner">
|
|
73
|
+
<i class="fa fa-toggle-off"></i>{{t 'app.filetypeother' }}
|
|
74
|
+
</span>
|
|
75
|
+
<span class="asset-management-sidebar-filter-image-icon">
|
|
76
|
+
<i class="fa fa-file-o"></i>
|
|
77
|
+
</span>
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="sidebar-row sidebar-divide">
|
|
82
|
+
<h3 class="sidebar-divide-inner">
|
|
83
|
+
<i class="fa fa-tags"></i>{{t 'app.tags'}}
|
|
84
|
+
</h3>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<button class="asset-management-sidebar-add-tag sidebar-filter-button sidebar-tag action-secondary">
|
|
88
|
+
<span class="dashboard-sidebar-add-tag-inner">
|
|
89
|
+
{{t 'app.searchbytag' }}
|
|
90
|
+
</span>
|
|
91
|
+
</button>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div class="asset-picker-filters">
|
|
2
|
+
{{!-- inline search field with close button --}}
|
|
3
|
+
<label for="asset-picker-filter-search">{{t 'app.filter'}}</label>
|
|
4
|
+
<input type="text" name="asset-picker-filter-search" class="asset-management-sidebar-filter-search" placeholder="{{t 'app.searchtitleordescription'}}"/>
|
|
5
|
+
<button class="sidebar-inline-input-button asset-picker-sidebar-filter-clear-search">
|
|
6
|
+
<i class="fa fa-times"></i>
|
|
7
|
+
</button>
|
|
8
|
+
<button class="asset-picker-sidebar-filter-image asset-picker-sidebar-filter-button" data-filter-type="image">
|
|
9
|
+
<span class="asset-picker-sidebar-filter-image-inner">
|
|
10
|
+
{{t 'app.filetypeimage' }}
|
|
11
|
+
</span>
|
|
12
|
+
</button>
|
|
13
|
+
|
|
14
|
+
<button class="asset-picker-sidebar-filter-audio asset-picker-sidebar-filter-button" data-filter-type="audio">
|
|
15
|
+
<span class="asset-picker-sidebar-filter-audio-inner">
|
|
16
|
+
{{t 'app.filetypeaudio' }}
|
|
17
|
+
</span>
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<button class="asset-picker-sidebar-filter-video asset-picker-sidebar-filter-button" data-filter-type="video">
|
|
21
|
+
<span class="asset-picker-sidebar-filter-video-inner">
|
|
22
|
+
{{t 'app.filetypevideo' }}
|
|
23
|
+
</span>
|
|
24
|
+
</button>
|
|
25
|
+
|
|
26
|
+
<button class="asset-picker-sidebar-filter-other asset-picker-sidebar-filter-button" data-filter-type="other">
|
|
27
|
+
<span class="asset-picker-sidebar-filter-other-inner">
|
|
28
|
+
{{t 'app.filetypeother' }}
|
|
29
|
+
</span>
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<div class="asset-management-inner">
|
|
35
|
+
<div class="asset-management-assets-container">
|
|
36
|
+
<div class="asset-management-no-assets">{{t 'app.noassetsfound'}}</div>
|
|
37
|
+
<div class="asset-management-assets-container-inner">
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="asset-management-preview-container">
|
|
41
|
+
<div class="asset-management-no-preview">{{t 'app.assetpreviewinstruction'}}</div>
|
|
42
|
+
<div class="asset-management-preview-container-inner">
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
@@ -0,0 +1,216 @@
|
|
|
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 AssetItemView = require('./assetManagementItemView');
|
|
6
|
+
var AssetModel = require('../models/assetModel');
|
|
7
|
+
var TagsCollection = require('core/collections/tagsCollection');
|
|
8
|
+
|
|
9
|
+
var AssetCollectionView = OriginView.extend({
|
|
10
|
+
className: "asset-management-collection",
|
|
11
|
+
|
|
12
|
+
sort: { createdAt: -1 },
|
|
13
|
+
search: undefined,
|
|
14
|
+
filters: [],
|
|
15
|
+
tags: [],
|
|
16
|
+
fetchCount: 0,
|
|
17
|
+
shouldStopFetches: false,
|
|
18
|
+
page: 1,
|
|
19
|
+
pageSize: 1,
|
|
20
|
+
assets: [],
|
|
21
|
+
|
|
22
|
+
preRender: function(options) {
|
|
23
|
+
this.initEventListeners();
|
|
24
|
+
|
|
25
|
+
this.isModal = options.isModal || false;
|
|
26
|
+
|
|
27
|
+
if(options.types) {
|
|
28
|
+
this.filters = options.types;
|
|
29
|
+
}
|
|
30
|
+
this.tagsCollection = new TagsCollection();
|
|
31
|
+
|
|
32
|
+
this._doLazyScroll = _.bind(_.throttle(this.doLazyScroll, 250), this);
|
|
33
|
+
this._onResize = _.bind(_.debounce(this.onResize, 400), this);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
postRender: function() {
|
|
37
|
+
if(this.isModal) {
|
|
38
|
+
this.initPaging();
|
|
39
|
+
} else {
|
|
40
|
+
Origin.once('contentPane:ready', () => this.initPaging());
|
|
41
|
+
}
|
|
42
|
+
// init lazy scrolling
|
|
43
|
+
$('.asset-management-assets-container').on('scroll', this._doLazyScroll);
|
|
44
|
+
$(window).on('resize', this._onResize);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
initEventListeners: function() {
|
|
48
|
+
this.listenTo(Origin, {
|
|
49
|
+
'assetManagement:sidebarFilter:add': this.addFilter,
|
|
50
|
+
'assetManagement:sidebarFilter:remove': this.removeFilter,
|
|
51
|
+
'assetManagement:sidebarView:filter': this.filterBySearchInput,
|
|
52
|
+
'assetManagement:assetManagementSidebarView:filterByTags': this.filterByTags,
|
|
53
|
+
'assetManagement:collection:refresh': this.resetCollection
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
initPaging: function() {
|
|
58
|
+
var $item = new AssetItemView({ model: new AssetModel() }).$el;
|
|
59
|
+
$item.css({
|
|
60
|
+
visibility: 'hidden'
|
|
61
|
+
}).appendTo('body');
|
|
62
|
+
var containerHeight = $('.asset-management-assets-container').outerHeight();
|
|
63
|
+
var itemHeight = $item.outerHeight(true);
|
|
64
|
+
var columns = Math.floor($('.asset-management-assets-container').outerWidth()/$item.outerWidth(true));
|
|
65
|
+
var rows = Math.max(1, Math.ceil(containerHeight/itemHeight));
|
|
66
|
+
$item.remove();
|
|
67
|
+
// columns stack nicely, but need to add extra row if it's not a clean split
|
|
68
|
+
if((containerHeight % itemHeight) > 0) rows++;
|
|
69
|
+
this.pageSize = columns*rows;
|
|
70
|
+
this.resetCollection(this.setViewToReady);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
appendAssetItem: function (asset) {
|
|
74
|
+
if(!asset) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const tagsMapped = [];
|
|
78
|
+
const assetTags = asset.get('tags');
|
|
79
|
+
if(assetTags) {
|
|
80
|
+
assetTags.forEach(tId => {
|
|
81
|
+
tagsMapped.push(this.tagsCollection.find(t => t.get('_id') === tId).attributes);
|
|
82
|
+
});
|
|
83
|
+
asset.set('tagsMapped', tagsMapped);
|
|
84
|
+
}
|
|
85
|
+
this.$('.asset-management-collection-inner').append(new AssetItemView({ model: asset }).$el);
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// Collection manipulation
|
|
89
|
+
|
|
90
|
+
fetchCollection: async function(cb) {
|
|
91
|
+
if(this.shouldStopFetches || this.isCollectionFetching) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.isCollectionFetching = true;
|
|
95
|
+
|
|
96
|
+
this.collection.customQuery.tags = { $all: this.tags };
|
|
97
|
+
|
|
98
|
+
if(this.search) {
|
|
99
|
+
this.collection.customQuery.$or = [
|
|
100
|
+
{ title: { $regex: `.*${this.search.toLowerCase()}.*`, $options: 'i' } },
|
|
101
|
+
{ description: { $regex: `.*${this.search.toLowerCase()}.*`, $options: 'i' } }
|
|
102
|
+
]
|
|
103
|
+
} else {
|
|
104
|
+
delete this.collection.customQuery.$or;
|
|
105
|
+
}
|
|
106
|
+
if(this.filters.length) {
|
|
107
|
+
this.collection.customQuery.type = { $in: this.filters };
|
|
108
|
+
} else {
|
|
109
|
+
delete this.collection.customQuery.type;
|
|
110
|
+
}
|
|
111
|
+
Object.assign(this.collection.queryOptions, {
|
|
112
|
+
skip: this.allAssets.length,
|
|
113
|
+
limit: this.pageSize,
|
|
114
|
+
page: this.page+1,
|
|
115
|
+
sort: this.sort
|
|
116
|
+
});
|
|
117
|
+
await this.tagsCollection.fetch();
|
|
118
|
+
|
|
119
|
+
this.collection.fetch({
|
|
120
|
+
success: _.bind(function(collection, response) {
|
|
121
|
+
this.allAssets.push(...collection.models);
|
|
122
|
+
this.isCollectionFetching = false;
|
|
123
|
+
// stop further fetching if this is the last page
|
|
124
|
+
if(response.length < this.pageSize) this.shouldStopFetches = true;
|
|
125
|
+
|
|
126
|
+
$('.asset-management-no-assets').toggleClass('display-none', this.allAssets.length > 0);
|
|
127
|
+
|
|
128
|
+
this.$('.asset-management-list-item').remove();
|
|
129
|
+
this.allAssets.forEach(a => this.appendAssetItem(a));
|
|
130
|
+
|
|
131
|
+
this.isCollectionFetching = false;
|
|
132
|
+
|
|
133
|
+
Origin.trigger('assetManagement:assetManagementCollection:fetched');
|
|
134
|
+
if(typeof cb === 'function') cb(collection);
|
|
135
|
+
}, this),
|
|
136
|
+
error: function(error) {
|
|
137
|
+
console.log(error);
|
|
138
|
+
this.isCollectionFetching = false;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
resetCollection: function(cb, shouldFetch = true, selectedId) {
|
|
144
|
+
// to remove old views
|
|
145
|
+
Origin.trigger('assetManagement:assetViews:remove');
|
|
146
|
+
|
|
147
|
+
this.allAssets = [];
|
|
148
|
+
this.shouldStopFetches = false;
|
|
149
|
+
this.fetchCount = 0;
|
|
150
|
+
this.page = 0;
|
|
151
|
+
this.collection.reset();
|
|
152
|
+
|
|
153
|
+
if(!shouldFetch) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.fetchCollection(() => {
|
|
157
|
+
if(selectedId) Origin.trigger('assetManagement:assetItemView:preview', this.collection.findWhere({ _id: selectedId }));
|
|
158
|
+
if(cb) cb()
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Filtering
|
|
163
|
+
|
|
164
|
+
addFilter: function(filterType) {
|
|
165
|
+
this.filters.push(filterType);
|
|
166
|
+
this.resetCollection();
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
removeFilter: function(filterType) {
|
|
170
|
+
// remove filter from this.filters
|
|
171
|
+
this.filters = this.filters.filter(item => item !== filterType);
|
|
172
|
+
this.resetCollection();
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
filterBySearchInput: function (filterText) {
|
|
176
|
+
this.resetCollection(null, false);
|
|
177
|
+
this.search = filterText;
|
|
178
|
+
this.fetchCollection();
|
|
179
|
+
|
|
180
|
+
$(".asset-management-modal-filter-search" ).focus();
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
filterByTags: function(tags) {
|
|
184
|
+
this.resetCollection(null, false);
|
|
185
|
+
this.tags = _.pluck(tags, 'id');
|
|
186
|
+
this.fetchCollection();
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
// Event handling
|
|
190
|
+
|
|
191
|
+
onResize: function() {
|
|
192
|
+
this.initPaging();
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
doLazyScroll: function(e) {
|
|
196
|
+
if(this.isCollectionFetching) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const $last = $('.asset-management-list-item').last();
|
|
200
|
+
const triggerY = ($('.asset-management').offset().top + this.$el.height()) - ($last.height()/2) ;
|
|
201
|
+
|
|
202
|
+
if($last.offset().top < triggerY) this.fetchCollection();
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
remove: function() {
|
|
206
|
+
$('.asset-management-assets-container').off('scroll', this._doLazyScroll);
|
|
207
|
+
$(window).off('resize', this._onResize);
|
|
208
|
+
|
|
209
|
+
OriginView.prototype.remove.apply(this, arguments);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
}, {
|
|
213
|
+
template: 'assetManagementCollection'
|
|
214
|
+
});
|
|
215
|
+
return AssetCollectionView;
|
|
216
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
|
|
2
|
+
define(function(require) {
|
|
3
|
+
var Origin = require('core/origin');
|
|
4
|
+
var SidebarItemView = require('modules/sidebar/views/sidebarItemView');
|
|
5
|
+
|
|
6
|
+
var AssetManagementEditAssetSidebarView = SidebarItemView.extend({
|
|
7
|
+
events: {
|
|
8
|
+
'click .asset-management-edit-sidebar-save-button': 'onSaveNewAssetClicked',
|
|
9
|
+
'click .asset-management-edit-sidebar-cancel-button': 'onCancelNewAssetClicked'
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
onSaveNewAssetClicked: function() {
|
|
13
|
+
this.updateButton('.asset-management-edit-sidebar-save-button', Origin.l10n.t('app.saving'));
|
|
14
|
+
Origin.trigger('assetManagement:editAsset');
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
onCancelNewAssetClicked: function() {
|
|
18
|
+
Origin.router.navigateTo('assetManagement');
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
template: 'assetManagementEditAssetSidebar'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return AssetManagementEditAssetSidebarView;
|
|
25
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
|
|
2
|
+
define([
|
|
3
|
+
'core/origin',
|
|
4
|
+
'core/views/originView',
|
|
5
|
+
'modules/scaffold/views/scaffoldFileView'
|
|
6
|
+
], function(Origin, OriginView, ScaffoldFileView){
|
|
7
|
+
var AssetManagementEditAssetView = OriginView.extend({
|
|
8
|
+
className: 'asset-management-edit-asset',
|
|
9
|
+
events: {
|
|
10
|
+
'change .scaffold-file': 'updateTitle',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
preRender: function() {
|
|
14
|
+
this.listenTo(Origin, 'assetManagement:editAsset', this.save);
|
|
15
|
+
this.originalAttributes = _.clone(this.model.attributes);
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
postRender: async function() {
|
|
19
|
+
this.model.set('_type', 'asset');
|
|
20
|
+
this.form = await Origin.scaffold.buildForm({ model: this.model });
|
|
21
|
+
|
|
22
|
+
const input = new ScaffoldFileView({ schema: { file: { type: "File" }, editorClass: 'field' }, key: 'file' });
|
|
23
|
+
input.$el.insertBefore($('.field', this.form.$el).first());
|
|
24
|
+
input.render();
|
|
25
|
+
|
|
26
|
+
$('.form-container', this.$el).append(this.form.el);
|
|
27
|
+
|
|
28
|
+
this.form.on('url:change', () => this.updateTitle());
|
|
29
|
+
|
|
30
|
+
this.setViewToReady();
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
updateTitle: function(e) {
|
|
34
|
+
if(!this.form.fields.title.getValue()) { // add the asset file name if there isn't already a title
|
|
35
|
+
this.form.fields.title.setValue($(e.currentTarget).val().replace("C:\\fakepath\\", ""));
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
buildErrorMessage: function(errors, message = "") {
|
|
40
|
+
Object.values(errors).forEach((item, key) => {
|
|
41
|
+
if(item.hasOwnProperty('message')) {
|
|
42
|
+
message += `<span class="key">${item.title || key}</span>: ${item.message}<br/>`;
|
|
43
|
+
} else if(_.isObject(item)) { // recurse
|
|
44
|
+
message = this.buildErrorMessage(item, message);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return message;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
sanitiseData: function(dataArr) {
|
|
51
|
+
const isArray = Array.isArray(dataArr)
|
|
52
|
+
if(!isArray) {
|
|
53
|
+
dataArr = Object.entries(dataArr).map(([k,v]) => Object.create({ name: k, value: v }));
|
|
54
|
+
}
|
|
55
|
+
for (let i = 0; i < dataArr.length; i++) {
|
|
56
|
+
const d = dataArr[i];
|
|
57
|
+
if(d.name === "tags") {
|
|
58
|
+
if(!d.value.length) dataArr.splice(i--, 1);
|
|
59
|
+
} else if(d.name === "url" && d.value === "") {
|
|
60
|
+
dataArr.splice(i--, 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if(isArray) return dataArr;
|
|
64
|
+
const data = dataArr.reduce((m, d) => Object.assign(m, { [d.name]: d.value }), {});
|
|
65
|
+
if(Object.keys(data).length) return data;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
getAttributesToSave: function() {
|
|
69
|
+
if(this.model.isNew()) {
|
|
70
|
+
return this.model.attributes;
|
|
71
|
+
}
|
|
72
|
+
var changedAttributes = this.model.changedAttributes();
|
|
73
|
+
return Object.keys(changedAttributes).length ? changedAttributes : undefined;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
save: function() {
|
|
77
|
+
const errors = this.form.validate();
|
|
78
|
+
if(errors) {
|
|
79
|
+
return this.onSaveError(`${Origin.l10n.t('app.validationfailedmessage')}<br/><br/>${this.buildErrorMessage(errors)}`);
|
|
80
|
+
}
|
|
81
|
+
const callbacks = {
|
|
82
|
+
success: data => this.onSaveSuccess(data),
|
|
83
|
+
error: (model, xhr) => {
|
|
84
|
+
if(typeof xhr === 'string') xhr = model;
|
|
85
|
+
this.onSaveError(xhr.responseJSON && xhr.responseJSON.message || xhr.statusText);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
if($('input[name="file"]').val()) { // handle file upload
|
|
89
|
+
this.form.$el.ajaxSubmit(Object.assign({
|
|
90
|
+
method: this.model.isNew() ? 'POST' : 'PATCH',
|
|
91
|
+
url: `/api/assets/${this.model.get('_id') ? this.model.get('_id') : ''}`,
|
|
92
|
+
beforeSubmit: this.sanitiseData,
|
|
93
|
+
}, callbacks));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.form.commit();
|
|
97
|
+
const data = this.sanitiseData(this.getAttributesToSave());
|
|
98
|
+
data ? this.model.save(data, Object.assign({ patch: true }, callbacks)) : this.onSaveSuccess();
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
onSaveSuccess: async function(data) {
|
|
102
|
+
const modelData = data ? Array.isArray(data) ? data[0] : data : undefined;
|
|
103
|
+
const _id = modelData && modelData._id;
|
|
104
|
+
|
|
105
|
+
if(this.model.get('isModal')) {
|
|
106
|
+
if(_id) Origin.trigger('assetManagement:collection:refresh', null, true, _id);
|
|
107
|
+
Origin.trigger('assetManagement:modalEdit:remove');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
Origin.router.navigateTo('assetManagement');
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
onSaveError: function(errorMessage) {
|
|
114
|
+
Origin.trigger('sidebar:resetButtons');
|
|
115
|
+
Origin.Notify.alert({ type: 'error', text: errorMessage });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}, {
|
|
119
|
+
template: 'assetManagementEditAsset'
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return AssetManagementEditAssetView;
|
|
123
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
|
|
6
|
+
var AssetItemView = OriginView.extend({
|
|
7
|
+
tagName: 'div',
|
|
8
|
+
|
|
9
|
+
className: function() {
|
|
10
|
+
return `asset-management-list-item id-${this.model.get('_id')}`;
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
events: {
|
|
14
|
+
'click' : 'onAssetClicked'
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
preRender: function() {
|
|
18
|
+
this.listenTo(this, 'remove', this.remove);
|
|
19
|
+
this.listenTo(Origin, {
|
|
20
|
+
'assetManagement:modal:selectItem': this.onAssetClicked,
|
|
21
|
+
'assetManagement:assetViews:remove': this.remove
|
|
22
|
+
});
|
|
23
|
+
this.listenTo(this.model, {
|
|
24
|
+
'destroy': this.remove,
|
|
25
|
+
'change:_isDeleted': this.render
|
|
26
|
+
});
|
|
27
|
+
this.model.set({ iconName: this.getIconName() });
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
postRender: function() {
|
|
31
|
+
this.$el.toggleClass('selected', !!this.model.get('_isSelected'));
|
|
32
|
+
if (this.model.get('_isSelected')) {
|
|
33
|
+
Origin.trigger('assetManagement:assetItemView:preview', this.model);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
getIconName: function() {
|
|
38
|
+
const type = this.model.get('type');
|
|
39
|
+
const subtype = this.model.get('subtype');
|
|
40
|
+
|
|
41
|
+
switch(type) {
|
|
42
|
+
case 'audio': return 'fa-file-audio-o';
|
|
43
|
+
case 'image': return 'fa-file-image-o';
|
|
44
|
+
case 'font': return 'fa-font';
|
|
45
|
+
case 'video': return 'fa-file-video-o';
|
|
46
|
+
}
|
|
47
|
+
switch(subtype) {
|
|
48
|
+
case 'pdf': return 'fa-file-pdf-o';
|
|
49
|
+
case 'zip': return 'fa-file-archive-o';
|
|
50
|
+
}
|
|
51
|
+
return 'fa-file-o';
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onAssetClicked: function (model) {
|
|
55
|
+
if(model instanceof $.Event) {
|
|
56
|
+
this.model.set('_isSelected', true);
|
|
57
|
+
Origin.trigger('assetManagement:modal:selectItem', this.model);
|
|
58
|
+
} else if(model.get('_id') !== this.model.get('_id')) {
|
|
59
|
+
this.model.set('_isSelected', false);
|
|
60
|
+
}
|
|
61
|
+
this.render();
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
template: 'assetManagementListItem'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return AssetItemView;
|
|
68
|
+
});
|