Skip to content

How to Lock Menu Items

Chuck Lorenz edited this page Apr 27, 2016 · 4 revisions

How to Lock Menu Items

The Scenario

A course presents a number of menu items to the learner. Of this number, only the first is enabled. After the learner completes the first, the other menu items (or some subset) are enabled and the learner now has access to them.

How To

  1. Ensure your Adapt framework version is ^2.0.9
  2. Ensure the menu includes code snippet, but implement the menu json normally per the example.json or README.
  3. Add your "_lockType" to course.json
  4. Style CSS and/or adjust JavaScript based on class locked.

Lock Types

sequential

json
In course.json add the following:
,"_lockType": "sequential"

effect
The first menu item will be enabled. The following items will be disabled. Each item will be enabled when the preceding item is completed.

unlockFirst

json
In course.json add the following:
,"_lockType": "unlockFirst"

effect
The first menu item will be enabled. The following items will be disabled. When the first item is completed, all subsequent items will be enabled.

lockLast

json
In course.json add the following:
,"_lockType": "lockLast"

effect
The all menu items are enabled except the last item. The last item is enabled only when all other menu items have been completed.

custom

json
In course.json add the following:
,"_lockType": "custom"
In contentsObjects.json add the following to the page or menu that you want locked:
,"_lockedBy": "co-XX" where "co-XX" is the Id of the object whose completion will enable this page or menu.

effect
The all menu items are enabled except any item whose json contains the "_lockedBy" attribute. That item will be enabled only when the menu item specified by the value of "_lockedBy" is completed.

CSS _isComplete _force

define completion define enabled

src/core/js/models/adaptModel.js Matt: please note that I have instructed that all lockTypes including custom to be assigned in course.json, and that custom requires an additional assignment of _lockedByin contentObjects.json.

Complete page: Developers Guide: Menu. How to ensure the menu can be locked.

Clone this wiki locally