Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/2709 v5.5.0 #2711

Merged
merged 65 commits into from
May 12, 2020
Merged

issue/2709 v5.5.0 #2711

merged 65 commits into from
May 12, 2020

Conversation

oliverfoster
Copy link
Member

@oliverfoster oliverfoster commented Mar 31, 2020

#2645 #2709 #2712 #2714 #1902
Reference WIKI
Reference plan

Converted more of adapt core to ES6.
Views and models no longer have hard-coded relationships, instead they are determined by the JSON. All core views and models can be replaced. Multi-menu support is now possible by simply registering the menu view with Adapt.register('course menu boxmenu', { view: BoxMenuView });
This should be non-breaking. Lots of additions, some code relocated, fundamental changes to Adapt.remove and how that interacts with all sub views of AdaptView.

Added

  • ContentObjectView to unify common PageView and MenuView behaviour
  • Adapt.store which is the Adapt.componentStore extended to contain all content views and models not just component views and models
  • AdaptModel functions for matching type groups such as "blocks", "components", "pages" etc: getTypeGroup(), getTypeGroups(), isTypeGroup(typegroup)
  • Adapt functions for fetching model and view classes: getViewName, getViewClass, getModelName, getModelClass
  • AdaptModel property hasManagedChildren to signify which models automatically render and listen to their children models
  • New json properties _model and _view specify the name of the registered model or view to use on instantiation. Adapt will use properties _type, _component, _model and _type, _component, _view in order to determine which model or view should be used respectively
  • Adapt.log.warnOnce
  • Adapt is now JSON filename agnostic in the language folder (build.js and config.json are still fixed filenames outside of the language folders).
  • Each file must contain an object or an array of objects with, at minimum a { "_type": "" }, { "_component": "" } or { "_model": "" } attribute on each JSON file object as this denotes the corresponding model inside the framework.
  • Each language folder must have a { "_type": "course" } object.
  • grunt task language-data-manifests for language folder manifest production
  • contentObjectView:* events [preRender, render, postRender, preReady, ready, postReady, preRemove, remove, postRemove] for extensions to ContentObjectView
  • view:* events [preRender, render, postRender, preRemove, remove, postRemove] for every view which extends AdaptView
  • Adapt.router.rootModel property to allow the router to have a different root ContentObjectModel other than Adapt.course
  • Adapt.router.navigateBack instead of needing Backbone.history.history.back()

Changed

  • Converted more models and views to ES6
  • Converted controllers adapt.js, data.js, router.js and scrolling.js to ES6
  • Switched to Adapt.log.deprecated, Adapt.log.removed and Adapt.log.warnOnce where appropriate
  • Added more deprecated warnings to QuestionView compatibility layer
  • Moved AdaptModel.setCustomLocking menu check into the MenuModel
  • Reworked ItemsQuestionModel blending of ItemsComponentModel and QuestionModel to make it clearer
  • Fixed attribute LockingModel to work with ES6 classes
  • The Adapt.register name parameter can now take an array or space separated list of names
  • Registered all core content views and models with the Adapt.store
  • Router uses Adapt.store to lookup ContentObject views
  • AdaptView addChildren uses Adapt.store to lookup child views
  • Adapt.data is now a collection of all models
  • Adapt.data.filter is used to filter all data models throughout
  • Adapt.data uses Adapt.store to lookup models
  • Reworked findRelativeModel so that it doesn't use hard-coded type groups and so that it returns the rootModel when requested
  • Adapt.parseRelativeString so that it doesn't use hard-coded type groups
  • Menus will only be rendered by the event router:menu if aViewClass isn't found for them
  • All core functions which accept type groups now use the new typegroup functions findAncestor, findDescendantModels, findRelativeModel
  • Reworked src/core/js/data.js to load manifest, files and become the collection for all models. It now has no references to the menu, page, article, block and component structure
  • Moved menu, page, article, block and component controller parts from data into src/core/js/mpabc.js
  • AdaptCollection so that it is no longer a data loader, only a container.
  • Improved babel sourcemapping so that it works best in dev build mode.
  • Simplified router, removed duplicate code, switched over from hard coded model types to instance types where possible
  • Moved Adapt.navigateToElement into Adapt.router
  • Moved Adapt.scrollTo into Adapt.scrolling proper
  • Made way for content object transitions. Stopped AdaptView listening to global remove event, so all content objects and their descendants are now selectively destroyed using findDescendantViews. Have added Adapt.set('_shouldDestroyContentObjects', false); to control destruction which will allow extensions to perform content object transitions before destroying the old one, have added Adapt.set('_shouldContentObjectScrollTop', false); to control if the contentObject performs a scrollTop(0); automatically.
  • Made Adapt.wait.queue() into an async function if no callback specified which flattens some nested callbacks in the router

Deprecated

  • AdaptModel properties, _parent, _children, _siblings
  • Adapt.contentObjects, Adapt.articles, Adapt.blocks, Adapt.components in favour of Adapt.data
  • Adapt.componentStore
  • Pluralised or non-lowercase type groups such as components, blocks, articles, contentObjects in favour of lowercase singular component, block, article, contentobject
  • QuestionView getInteractionObject, getInteractionObject, getResponseType, setupDefaultSettings, setupButtonSettings, setupWeightSettings, canSubmit, updateAttempts, storeUserAnswer, resetUserAnswer, isCorrect, setScore, updateButtons, setupButtonSettings, isPartlyCorrect, setupCorrectFeedback, setupPartlyCorrectFeedback and setupIncorrectFeedback in favour of the QuestionModel versions.
  • View only component registrations Adapt.register('name', View);

Removed

  • All hard-coded references to type groups such as "blocks", "components", "pages" etc,

Testing

Tested with languagePicker, works as normal.
All change events trigger from both Adapt.data and Adapt.blocks, Adapt.components etc as intended.

PRs included

#2717
#2716
#2713

@oliverfoster oliverfoster mentioned this pull request Apr 1, 2020
Copy link
Contributor

@tomgreenfield tomgreenfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎾

src/core/js/adapt.js Outdated Show resolved Hide resolved
src/core/js/adapt.js Outdated Show resolved Hide resolved
src/core/js/adapt.js Outdated Show resolved Hide resolved
src/core/js/collections/adaptCollection.js Outdated Show resolved Hide resolved
src/core/js/data.js Show resolved Hide resolved
src/core/js/models/itemsQuestionModel.js Outdated Show resolved Hide resolved
src/core/js/models/itemsQuestionModel.js Show resolved Hide resolved
src/core/js/models/lockingModel.js Outdated Show resolved Hide resolved
src/core/js/models/lockingModel.js Outdated Show resolved Hide resolved
src/core/js/adapt.js Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@moloko
Copy link
Contributor

moloko commented Apr 27, 2020

@oliverfoster is this ready for review again now?

@olivermartinfoster
Copy link
Contributor

Absolutely

Copy link
Contributor

@tomgreenfield tomgreenfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

prevent invalid value from being processed by setActiveItem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@oliverfoster
Copy link
Member Author

oliverfoster commented May 12, 2020

Thanks for reviewing @cahirodoherty-learningpool, @chetan-hajare, @tomgreenfield, @moloko
This is ready to go.

Just need to do a v5.4.0 release as there are 30 commits to go out before this gets merged.
Will do that a.s.a.p.
https:/adaptlearning/adapt_framework/releases/tag/v5.3.0

Note: Had to bump up all the minor version numbers as 5.3.0 had feature additions added. So this pr is now v5.5.0

@oliverfoster oliverfoster changed the title issue/2709 v5.4.0 issue/2709 v5.5.0 May 12, 2020
@oliverfoster oliverfoster merged commit eccfcfd into master May 12, 2020
@oliverfoster oliverfoster deleted the issue/2709-1 branch July 7, 2020 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants