var initOptions = {
ui: {
layout: {
global_template: 'custom'
}
}
},
questionEditorApp = LearnosityQuestionEditor.init(initOptions);
Getting started
This section steps you through using a custom global layout. Follow the steps below to build your own custom global layout.1. Add config
Set ui.layout.global_template to "custom". var initOptions = {
configuration: {
consumer_key: 'INSERT_CONSUMER_KEY'
},
ui: {
layout: {
global_template: 'custom'
}
},
widget_type: "response"
},
questionEditorApp = LearnosityQuestionEditor.init(initOptions);
2. Add your custom global layout HTML to the page
Refer to the Global Layout components section to see which global layout components are available. (As a quick heads up - components are the spans with data-lrn-qe-layout-{component-name}).<div class="place-holder">
<h5 class="place-holder-title">Block 1</h5>
<div class="component-view-block">
<h4>Question/Feature tile list</h4>
<div class="component-view-block-content">
<span data-lrn-qe-layout-tile-list=""></span>
</div>
</div>
<div class="component-view-block">
<h4>Editing widget title</h4>
<div class="component-view-block-content">
<span data-lrn-qe-layout-widget-title=""></span>
</div>
</div>
</div>
<div class="place-holder">
<h5 class="place-holder-title">Block 2</h5>
<div class="component-view-block">
<h4>Validate question button</h4>
<div class="component-view-block-content">
<span data-lrn-qe-layout-validate-question=""></span>
</div>
</div>
</div>
<div class="place-holder">
<h5 class="place-holder-title">Block 3</h5>
<div class="component-view-block">
<h4>Validatable question live score element</h4>
<div class="component-view-block-content">
<span data-lrn-qe-layout-live-score=""></span>
</div>
</div>
</div>
3. Polish
Play around with the markup and apply CSS until it meets your needs. You can style the global layouts in any way you choose.Global layout initialization object
Define which global layout to use. If not set, Learnosity's default global layout (edit) will be used.edit | The Learnosity default global layout. This layout will render the edit panel and preview panel in a single column and the user can toggle the visibility of each view by clicking the Preview button. |
---|---|
edit_preview | This layout will render the edit panel and preview panel in a two column layout. |
custom | Custom global layout. Any view that user wants to render is needed to be defined through span element with this data attribute: data-lrn-qe-layout- prefix. |
var initOptions = {
widgetType: 'response',
ui: {
layout: {
global_template: 'custom' // custom global layout is being used. Default global layouts of Learnosity are 'edit' and 'edit_preview'
}
}
};
var questionEditorApp = LearnosityQuestionEditor.init(initOptions);
Global layout components
The sections below detail the global layout components that are available for use in thewidget selection view.
The widget selection view allows users to browse all the Questions/Features that Learnosity supports. By selecting a Question/Feature from the list, the default JSON of that Question/Feature will be loaded in the widget edit panel.
For example:
<span data-lrn-qe-layout-tile-list></span> | Define where the widget selection view should be rendered. |
---|
<div class="my-widget-selection-wrapper">
<span data-lrn-qe-layout-tile-list></span>
</div>
Editing the widget title view
Define the title of the Question/Feature that user is editing.
For example:
<span data-lrn-qe-layout-widget-title></span> | Define where the current editing widget title view should be rendered. |
---|
<div class="container col-12">
<span data-lrn-qe-layout-widget-title></span>
Widget edit panel
The widget edit panel allows an author to set Question/Feature options (e.g. turning multiple_responses on/off for an MCQ question) through our visual editor rather than having to handwrite question JSON.
For example:
<span data-lrn-qe-layout-edit-panel></span> | Define where the widget edit panel should be rendered. |
---|
<div class="row col-6">
<span data-lrn-qe-layout-edit-panel></span>
</div>
Question live score
The Question live score lets the author experiment with validation options. They can set valid responses in the edit pane and then try different answers in the Question preview to see what score a student would receive. Every time they change the response in the Question preview, the live score will update.
For example:
<span data-lrn-qe-layout-live-score></span> | Define where the Question live score widget should be rendered. |
---|
<span data-lrn-qe-layout-live-score></span>
</div>
Widget preview panel
The widget preview panel shows an author what the Question/Feature will look like when it is published. The preview automatically updates when the author changes the options in the edit panel.
For example:
<span data-lrn-qe-layout-preview-panel></span> | Define where the widget preview panel should be rendered. |
---|
<span data-lrn-qe-layout-preview-panel></span>