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,172 @@
|
|
|
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 ProjectsSidebarView = SidebarItemView.extend({
|
|
7
|
+
settings: {
|
|
8
|
+
autoRender: true
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
events: {
|
|
12
|
+
'click .projects-sidebar-add-course': 'addCourse',
|
|
13
|
+
'click .projects-sidebar-my-courses': 'gotoMyCourses',
|
|
14
|
+
'click .projects-sidebar-shared-courses': 'gotoSharedCourses',
|
|
15
|
+
'click .sidebar-filter-clear': 'clearFilterInput',
|
|
16
|
+
'click .projects-sidebar-tag': 'onFilterButtonClicked',
|
|
17
|
+
'click .projects-sidebar-add-tag': 'onAddTagClicked',
|
|
18
|
+
'click .projects-sidebar-row-filter': 'onFilterRemovedClicked',
|
|
19
|
+
'keyup .projects-sidebar-filter-search-input': 'onKeyUp',
|
|
20
|
+
'paste .projects-sidebar-filter-search-input': 'onPaste'
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
initialize: function() {
|
|
24
|
+
this.listenTo(Origin, 'sidebarFilter:filterByTags', this.filterProjectsByTags);
|
|
25
|
+
this.listenTo(Origin, 'sidebarFilter:addTagToSidebar', this.addTagToSidebar);
|
|
26
|
+
this.listenTo(Origin, 'sidebar:update:ui', this.updateUI);
|
|
27
|
+
|
|
28
|
+
this.debouncedFilterProjectsByTitle = _.debounce(this.filterProjectsByTitle.bind(this), 1000);
|
|
29
|
+
return SidebarItemView.prototype.initialize.apply(this, arguments);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
postRender: function() {
|
|
33
|
+
this.tags = [];
|
|
34
|
+
this.usedTags = [];
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
highlightSearchBox: function(){
|
|
38
|
+
this.$('.projects-sidebar-filter-search-input').removeClass('search-highlight');
|
|
39
|
+
if (this.$('.projects-sidebar-filter-search-input').val()) {
|
|
40
|
+
this.$('.projects-sidebar-filter-search-input').addClass('search-highlight');
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
updateUI: function(userPreferences) {
|
|
45
|
+
if (userPreferences.search) {
|
|
46
|
+
this.$('.projects-sidebar-filter-search-input').val(userPreferences.search);
|
|
47
|
+
}
|
|
48
|
+
this.highlightSearchBox();
|
|
49
|
+
if (userPreferences.tags) {
|
|
50
|
+
this.tags = userPreferences.tags;
|
|
51
|
+
_.each(userPreferences.tags, this.addTagToSidebar, this);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
addCourse: function() {
|
|
56
|
+
Origin.router.navigateTo('project/new');
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
gotoMyCourses: function() {
|
|
60
|
+
Origin.router.navigateTo('projects');
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
gotoSharedCourses: function() {
|
|
64
|
+
Origin.router.navigateTo('projects/shared');
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
filterProjectsByTitle: function() {
|
|
68
|
+
var filterText = this.$('.projects-sidebar-filter-search-input').val().trim();
|
|
69
|
+
Origin.trigger('dashboard:dashboardSidebarView:filterBySearch', filterText);
|
|
70
|
+
this.highlightSearchBox();
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
clearFilterInput: function(event) {
|
|
74
|
+
event && event.preventDefault();
|
|
75
|
+
|
|
76
|
+
var $currentTarget = $(event.currentTarget);
|
|
77
|
+
$currentTarget.prev('.projects-sidebar-filter-input').val('').trigger('keyup', [true]);
|
|
78
|
+
this.highlightSearchBox();
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
onFilterButtonClicked: function(event) {
|
|
82
|
+
event && event.preventDefault();
|
|
83
|
+
// toggle filter
|
|
84
|
+
$currentTarget = $(event.currentTarget);
|
|
85
|
+
var filterType = $currentTarget.attr('data-tag');
|
|
86
|
+
if ($currentTarget.hasClass('selected')) {
|
|
87
|
+
$currentTarget.removeClass('selected');
|
|
88
|
+
Origin.trigger('dashboard:sidebarFilter:remove', filterType);
|
|
89
|
+
} else {
|
|
90
|
+
$currentTarget.addClass('selected');
|
|
91
|
+
Origin.trigger('dashboard:sidebarFilter:add', filterType);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
onAddTagClicked: function(event) {
|
|
96
|
+
event && event.preventDefault();
|
|
97
|
+
var availableTags = [];
|
|
98
|
+
// create an array of unique project tags
|
|
99
|
+
this.collection.each(function(tag) {
|
|
100
|
+
var availableTagsTitles = _.pluck(availableTags, 'title');
|
|
101
|
+
var usedTagTitles = _.pluck(this.usedTags, 'title');
|
|
102
|
+
if (!_.contains(availableTagsTitles, tag.get('title')) && !_.contains(usedTagTitles, tag.get('title'))) {
|
|
103
|
+
availableTags.push(tag.attributes);
|
|
104
|
+
}
|
|
105
|
+
}, this);
|
|
106
|
+
|
|
107
|
+
Origin.trigger('sidebar:sidebarFilter:add', {
|
|
108
|
+
title: Origin.l10n.t('app.filterbytags'),
|
|
109
|
+
items: availableTags
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
onTagClicked: function(event) {
|
|
114
|
+
var tag = $(event.currentTarget).toggleClass('selected').attr('data-tag');
|
|
115
|
+
this.filterProjectsByTags(tag);
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
filterProjectsByTags: function(tag) {
|
|
119
|
+
// toggle tag
|
|
120
|
+
if (_.findWhere(this.tags, { id: tag.id } )) {
|
|
121
|
+
this.tags = _.reject(this.tags, function(tagItem) {
|
|
122
|
+
return tagItem.id === tag.id;
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
this.tags.push(tag);
|
|
126
|
+
}
|
|
127
|
+
Origin.trigger('dashboard:dashboardSidebarView:filterByTags', this.tags);
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
addTagToSidebar: function(tag) {
|
|
131
|
+
this.usedTags.push(tag);
|
|
132
|
+
|
|
133
|
+
var template = Handlebars.templates['sidebarRowFilter'];
|
|
134
|
+
var data = {
|
|
135
|
+
rowClasses: 'sidebar-row-filter',
|
|
136
|
+
buttonClasses:'projects-sidebar-row-filter',
|
|
137
|
+
tag: tag
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
this.$('.projects-sidebar-add-tag').parent().after(template(data));
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
onFilterRemovedClicked: function(event) {
|
|
144
|
+
var tag = {
|
|
145
|
+
title: $(event.currentTarget).attr('data-title'),
|
|
146
|
+
id: $(event.currentTarget).attr('data-id')
|
|
147
|
+
}
|
|
148
|
+
// Remove this tag from the usedTags
|
|
149
|
+
this.usedTags = _.reject(this.usedTags, function(item) {
|
|
150
|
+
return item.id === tag.id;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
this.filterProjectsByTags(tag);
|
|
154
|
+
|
|
155
|
+
$(event.currentTarget).parent().remove();
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
onKeyUp: function(event) {
|
|
159
|
+
event && event.preventDefault();
|
|
160
|
+
|
|
161
|
+
this.debouncedFilterProjectsByTitle();
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
onPaste: function() {
|
|
165
|
+
this.filterProjectsByTitle();
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
template: 'projectsSidebar'
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return ProjectsSidebarView;
|
|
172
|
+
});
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
|
|
2
|
+
define(function(require){
|
|
3
|
+
var CourseModel = require('core/models/courseModel');
|
|
4
|
+
var Origin = require('core/origin');
|
|
5
|
+
var OriginView = require('core/views/originView');
|
|
6
|
+
var ProjectView = require('./projectView');
|
|
7
|
+
var UserCollection = require('modules/userManagement/collections/userCollection');
|
|
8
|
+
|
|
9
|
+
var ProjectsView = OriginView.extend({
|
|
10
|
+
className: 'projects',
|
|
11
|
+
supportedLayouts: [
|
|
12
|
+
"grid",
|
|
13
|
+
"list"
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
preRender: function(options) {
|
|
17
|
+
OriginView.prototype.preRender.apply(this, arguments);
|
|
18
|
+
this._isShared = options._isShared;
|
|
19
|
+
this.allTags = options.tags.models.slice() || [];
|
|
20
|
+
this.usersCollection = new UserCollection();
|
|
21
|
+
this.childViews = [];
|
|
22
|
+
this.filterText = '';
|
|
23
|
+
this.filterTags = [];
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
postRender: function() {
|
|
27
|
+
this.settings.preferencesKey = 'dashboard';
|
|
28
|
+
this.initUserPreferences();
|
|
29
|
+
this.initEventListeners();
|
|
30
|
+
this.initPaging();
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
initEventListeners: function() {
|
|
34
|
+
this._doLazyScroll = _.throttle(this.doLazyScroll, 250).bind(this);
|
|
35
|
+
this._onResize = _.debounce(this.onResize, 250).bind(this);
|
|
36
|
+
|
|
37
|
+
this.listenTo(Origin, {
|
|
38
|
+
'window:resize dashboard:refresh': this._onResize,
|
|
39
|
+
'dashboard:dashboardSidebarView:filterBySearch': text => {
|
|
40
|
+
this.filterText = text;
|
|
41
|
+
this.doFilter()
|
|
42
|
+
},
|
|
43
|
+
'dashboard:dashboardSidebarView:filterByTags': tags => {
|
|
44
|
+
this.filterTags = tags;
|
|
45
|
+
this.doFilter()
|
|
46
|
+
},
|
|
47
|
+
'dashboard:sort:asc': () => this.doSort('asc'),
|
|
48
|
+
'dashboard:sort:desc': () => this.doSort('desc'),
|
|
49
|
+
'dashboard:sort:updated': () => this.doSort('updated')
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
this.supportedLayouts.forEach(l => {
|
|
53
|
+
this.listenTo(Origin, `dashboard:layout:${l}`, () => this.doLayout(l));
|
|
54
|
+
}, this);
|
|
55
|
+
|
|
56
|
+
$('.contentPane').on('scroll', this._doLazyScroll);
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
initUserPreferences: function() {
|
|
60
|
+
var prefs = this.getUserPreferences();
|
|
61
|
+
this.filterText = prefs.search;
|
|
62
|
+
this.filterTags = prefs.tags
|
|
63
|
+
? prefs.tags.reduce((m, tagId) => {
|
|
64
|
+
const tagModel = this.allTags.find(tag => tag.get('_id') === tagId)
|
|
65
|
+
if (tagModel) m.push({id:tagId, title:tagModel.get('title')})
|
|
66
|
+
return m
|
|
67
|
+
}, [])
|
|
68
|
+
: [];
|
|
69
|
+
this.doLayout(prefs.layout);
|
|
70
|
+
this.doSort(prefs.sort, false);
|
|
71
|
+
this.doFilter(false);
|
|
72
|
+
// set relevant filters as selected
|
|
73
|
+
$(`a[data-callback='dashboard:layout:${prefs.layout}']`).addClass('selected');
|
|
74
|
+
$(`a[data-callback='dashboard:sort:${prefs.sort}']`).addClass('selected');
|
|
75
|
+
// need to refresh this to get latest filters
|
|
76
|
+
prefs = this.getUserPreferences();
|
|
77
|
+
prefs.tags = this.filterTags
|
|
78
|
+
Origin.trigger('options:update:ui', prefs);
|
|
79
|
+
Origin.trigger('sidebar:update:ui', prefs);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// Set some default preferences
|
|
83
|
+
getUserPreferences: function() {
|
|
84
|
+
var prefs = OriginView.prototype.getUserPreferences.apply(this, arguments);
|
|
85
|
+
|
|
86
|
+
if(!prefs.layout) prefs.layout = 'grid';
|
|
87
|
+
if(!prefs.sort) prefs.sort = 'asc';
|
|
88
|
+
|
|
89
|
+
return prefs;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
initPaging: function() {
|
|
93
|
+
if(this.resizeTimer) {
|
|
94
|
+
clearTimeout(this.resizeTimer);
|
|
95
|
+
this.resizeTimer = -1;
|
|
96
|
+
}
|
|
97
|
+
var $item = new ProjectView({ model: new CourseModel() }).$el;
|
|
98
|
+
$item.css({
|
|
99
|
+
visibility: 'hidden'
|
|
100
|
+
}).appendTo('.projects-list'); // Fixed: added missing class selector
|
|
101
|
+
|
|
102
|
+
var containerHeight = $(window).height()-this.$el.offset().top;
|
|
103
|
+
var itemHeight = $item.outerHeight(true);
|
|
104
|
+
var columns = Math.floor(this.$('.projects-inner').width()/$item.outerWidth(true));
|
|
105
|
+
var rows = Math.max(1, Math.ceil(containerHeight/itemHeight));
|
|
106
|
+
$item.remove();
|
|
107
|
+
// columns stack nicely, but need to add extra row if it's not a clean split
|
|
108
|
+
if((containerHeight % itemHeight) > 0) rows++;
|
|
109
|
+
this.collection.queryOptions.limit = columns*rows;
|
|
110
|
+
this.resetCollection(this.setViewToReady);
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
getProjectsContainer: function() {
|
|
114
|
+
return this.$('.projects-list');
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
appendProjectItem: function(model) {
|
|
118
|
+
let creatorName;
|
|
119
|
+
try {
|
|
120
|
+
const { firstName, lastName } = this.usersCollection.findWhere({ _id: model.get('createdBy') }).attributes;
|
|
121
|
+
creatorName = `${firstName} ${lastName}`;
|
|
122
|
+
} catch(e) {
|
|
123
|
+
creatorName = Origin.l10n.t('app.unknownuser');
|
|
124
|
+
}
|
|
125
|
+
if(this._isShared && creatorName) model.set('creatorName', creatorName);
|
|
126
|
+
model.set('tagTitles', model.get('tags').map(tId => this.allTags.find(t => t.get('_id') === tId).get('title')));
|
|
127
|
+
const view = new ProjectView({ model });
|
|
128
|
+
this.childViews.push(view);
|
|
129
|
+
this.getProjectsContainer().append(view.$el);
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
resetCollection: function(cb) {
|
|
133
|
+
this.abortFetches();
|
|
134
|
+
this.removeChildViews();
|
|
135
|
+
this.allCourses = [];
|
|
136
|
+
this.page = 1;
|
|
137
|
+
this.collection.queryOptions.collation = { locale: navigator.language.substring(0, 2) };
|
|
138
|
+
this.shouldStopFetches = false;
|
|
139
|
+
this.collection.reset();
|
|
140
|
+
this.fetchCollection(cb);
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
abortFetches: function() {
|
|
144
|
+
|
|
145
|
+
doAbort(this.usersCollectionXhr);
|
|
146
|
+
doAbort(this.collectionXhr);
|
|
147
|
+
|
|
148
|
+
function doAbort(xhr) {
|
|
149
|
+
if (!xhr) return;
|
|
150
|
+
|
|
151
|
+
if(xhr.readyState > 0 && xhr.readyState < 4){
|
|
152
|
+
xhr.abort();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
fetchCollection: function(cb) {
|
|
158
|
+
if(this.shouldStopFetches) return;
|
|
159
|
+
|
|
160
|
+
this.isCollectionFetching = true;
|
|
161
|
+
|
|
162
|
+
this.usersCollection.fetch({
|
|
163
|
+
success: (collection, response) => {
|
|
164
|
+
Object.assign(this.collection.queryOptions, {
|
|
165
|
+
skip: this.allCourses.length,
|
|
166
|
+
page: this.page++,
|
|
167
|
+
});
|
|
168
|
+
this.collectionXhr = this.collection.fetch({
|
|
169
|
+
success: (collection, response) => {
|
|
170
|
+
this.isCollectionFetching = false;
|
|
171
|
+
|
|
172
|
+
collection.models.forEach(model => {
|
|
173
|
+
const courseId = model.get('_courseId')
|
|
174
|
+
if (this.allCourses.find(course => course.get('_courseId') === courseId)) return
|
|
175
|
+
this.allCourses.push(model);
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
this.removeChildViews();
|
|
179
|
+
this.allCourses.forEach(a => this.appendProjectItem(a));
|
|
180
|
+
|
|
181
|
+
// stop further fetching if this is the last page
|
|
182
|
+
if(response.length < this.collection.queryOptions.limit) this.shouldStopFetches = true;
|
|
183
|
+
|
|
184
|
+
this.$('.no-projects').toggleClass('display-none', this.allCourses.length > 0);
|
|
185
|
+
if(typeof cb === 'function') cb(collection);
|
|
186
|
+
},
|
|
187
|
+
error: () => {
|
|
188
|
+
this.isCollectionFetching = false;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
error: () => {
|
|
193
|
+
this.isCollectionFetching = false;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
doLazyScroll: function(e) {
|
|
199
|
+
if(this.isCollectionFetching) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const $last = $('.project-list-item').last();
|
|
203
|
+
const triggerY = ($('.contentPane').offset().top + $('.contentPane').height()) - ($last.height()/2) ;
|
|
204
|
+
|
|
205
|
+
if($last.offset().top < triggerY) this.fetchCollection();
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
doLayout: function(layout) {
|
|
209
|
+
if(this.supportedLayouts.indexOf(layout) === -1) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
this.getProjectsContainer().attr('data-layout', layout);
|
|
213
|
+
this.setUserPreference('layout', layout);
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
doSort: function(sort, fetch) {
|
|
217
|
+
let data;
|
|
218
|
+
switch(sort) {
|
|
219
|
+
case "desc":
|
|
220
|
+
data = { title: -1 };
|
|
221
|
+
break;
|
|
222
|
+
case "updated":
|
|
223
|
+
data = { updatedAt: -1 };
|
|
224
|
+
break;
|
|
225
|
+
case "asc":
|
|
226
|
+
default:
|
|
227
|
+
sort = "asc";
|
|
228
|
+
data = { title: 1 };
|
|
229
|
+
}
|
|
230
|
+
this.collection.queryOptions.sort = data;
|
|
231
|
+
this.setUserPreference('sort', sort);
|
|
232
|
+
|
|
233
|
+
if(fetch !== false) this.resetCollection();
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
doFilter: function(fetch) {
|
|
237
|
+
const text = this.filterText || '';
|
|
238
|
+
const tags = this.filterTags || [];
|
|
239
|
+
|
|
240
|
+
this.collection.customQuery.title = {
|
|
241
|
+
$regex: `.*${text.toLowerCase()}.*`,
|
|
242
|
+
$options: 'i'
|
|
243
|
+
};
|
|
244
|
+
this.setUserPreference('search', text, true);
|
|
245
|
+
|
|
246
|
+
this.collection.customQuery.tags = {$all: _.pluck(tags, 'id')};
|
|
247
|
+
this.setUserPreference('tags', this.filterTags.map(tag => tag.id), true);
|
|
248
|
+
|
|
249
|
+
if(fetch !== false) this.resetCollection();
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
onResize: function() {
|
|
253
|
+
this.initPaging();
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
removeChildViews: function() {
|
|
257
|
+
this.childViews.forEach(child => child.remove());
|
|
258
|
+
this.childViews = [];
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
remove: function() {
|
|
262
|
+
$('.contentPane').off('scroll', this._doLazyScroll);
|
|
263
|
+
this.removeChildViews();
|
|
264
|
+
OriginView.prototype.remove.apply(this, arguments);
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
template: 'projects'
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
return ProjectsView;
|
|
271
|
+
});
|