Difference between revisions of "Widget:MerlinProficiencyProgress"

From Coder Merlin
(Added prev/next buttons)
 
Line 1: Line 1:
<div class="row" id="users-treeview-wrapper">
<script type="module">
    <div id="users-treeview" class="col">
import * as merlinapi from "/wiki/merlin_extensions/merlin-api.mjs";
    </div>
 
    <div class="col d-flex justify-content-center flex-column">
const userName = "<!--{$userName}-->".toLowerCase();
        <select id="students-dropdown" class="" style="display: none;">
const sessionID = "<!--{$sessionID}-->";
            <option disabled selected>Make a selection</option>
 
        </select>
function MasteryProgressModel(data) {
        <div class="dropdown-control-buttons justify-content-between" style="display: none;">
    this.masteryProgresses = ko.observableArray(data);
            <button class="btn btn-primary d-inline" id="prev-button">Previous</button>
}
            <button class="btn btn-primary d-inline" id="next-button">Next</button>
 
        </div>
// Activates knockout.js
        <div id="treeview-spinner" class="merlin-spinner spinner-border my-4 mx-auto" role="status" style="display: none;">
function init(event) {
            <span class="sr-only">Loading...</span>
    let successHandler = function (data) {
        </div>
        data.sort((left, right) => {
    </div>
return left.masteryProgramTopicSequence > right.masteryProgramTopicSequence ? 1 :
</div>
      (left.masteryProgramTopicSequence < right.masteryProgramTopicSequence ? -1 :
<div id="mastery-loader" class="merlin-spinner spinner-border my-4 mx-auto" role="status">
      0)
    <span class="sr-only">Loading...</span>
    });
</div>
    let model = new MasteryProgressModel(data);
<table class="table table-bordered" id="mastery-progress-table">
    ko.applyBindings(model);
  }
  let errorHandler = function(error) {
      console.error(error.message);
  }
  merlinapi.MasteryProgressModel.load(successHandler, errorHandler, userName, sessionID);
}
     
window.addEventListener("load", (event) => {
  init(event)
});
</script>
 
<table class="merlin-proficiency-progress-table" style="display: none" data-bind="visible: true">
     <thead>
     <thead>
    <tr>
    <tr>
        <th></th>
        <th>Program Level Name</th>
        <th scope="row">Topic</th>
        <th>Emerging</th>
        <th scope="row" class="text-center">Inevident</th>
        <th>Developing</th>
        <th scope="row" class="text-center">Emerging</th>
        <th>Proficient</th>
        <th scope="row" class="text-center">Developing</th>
        <th>Exemplary</th>
        <th scope="row" class="text-center">Proficient</th>
      </tr>
        <th scope="row" class="text-center">Exemplary</th>
    </tr>
     </thead>
     </thead>
    <tbody data-bind="foreach: masteryProgresses">
        <tr>
        <td data-bind="style: {'background-color': color()}, click: toggleMissionDisplay" class="merlin-proficiency-progress-program-level-name">
            <span data-bind="text: arrowInnerText()"></span>
            <span data-bind="text: standardName()"></span>
                <ul data-bind="style: {'display': (shouldShowMissions()) ? 'block' : 'none'},foreach: missions">
                <li data-bind="text: standardName()"></li>
                </ul>
        </td>
            <td><span data-bind="class: emergingClassName()"></span></td>
            <td><span data-bind="class: developingClassName()"></span></td>
            <td><span data-bind="class: proficientClassName()"></span></td>
            <td><span data-bind="class: exemplaryClassName()"></span></td>
        </tr>
    </tbody>
</table>
</table>
<script>
var username = "<!--{$userName}-->".toLowerCase();
var sessionID =  "<!--{$sessionID}-->";
window.addEventListener('load', (event) => {
    merlinProficiencyProgress(username, sessionID);
});
</script>

Latest revision as of 20:11, 5 April 2023

<script type="module"> import * as merlinapi from "/wiki/merlin_extensions/merlin-api.mjs";

const userName = "".toLowerCase(); const sessionID = "";

function MasteryProgressModel(data) {

   this.masteryProgresses = ko.observableArray(data);

}

// Activates knockout.js function init(event) {

   let successHandler = function (data) {
       data.sort((left, right) => {

return left.masteryProgramTopicSequence > right.masteryProgramTopicSequence ? 1 : (left.masteryProgramTopicSequence < right.masteryProgramTopicSequence ? -1 : 0) }); let model = new MasteryProgressModel(data); ko.applyBindings(model); } let errorHandler = function(error) { console.error(error.message); } merlinapi.MasteryProgressModel.load(successHandler, errorHandler, userName, sessionID); }

window.addEventListener("load", (event) => { init(event) }); </script>

<thead> </thead> <tbody data-bind="foreach: masteryProgresses"> </tbody>