js/main.js
/*
 using 'function' syntax here to resolve "this"
 not being the clicked on model that excecutes this function
 */
using 'function' syntax here to resolve "this"
not being the clicked on model that excecutes this function
using ' function ' syntax here to resolve " this " not being the clicked on model that excecutes this function
function showInfo() {
    let associationsPad = document.getElementById('assoc-pad');
    let attributesPad = document.getElementById('attr-pad');
    let currentModel = this;
    associationsPad.innerHTML = "";
    attributesPad.innerHTML = "";
    let displayName = document.querySelector('.selected-model');
    displayName.innerHTML = currentModel.querySelector('.model-title').innerHTML;
    let associations = readAssociations(currentModel);
    let attributes = readAttributes(currentModel);
    associations.forEach( asc => associationsPad.appendChild(asc) );
    attributes.forEach( att => attributesPad.appendChild(att) );
    if ( attributesPad.innerHTML === "" ) {
        attributesPad.innerHTML = "No Attributes Found";
    }
    if (associationsPad.innerHTML === "") {
        associationsPad.innerHTML = "No Associations Found";
    }
    $('#assoc-attr-modal').modal('show');
    showTotalAssoc(currentModel); 
}
function showInfo ( ) { let associationsPad = document . getElementById ( 'assoc-pad' ) ; let attributesPad = document . getElementById ( 'attr-pad' ) ; let currentModel = this ; associationsPad . innerHTML = "" ; attributesPad . innerHTML = "" ; let displayName = document . querySelector ( '.selected-model' ) ; displayName . innerHTML = currentModel . querySelector ( '.model-title' ) . innerHTML ; let associations = readAssociations ( currentModel ) ; let attributes = readAttributes ( currentModel ) ; associations . forEach ( asc => associationsPad . appendChild ( asc ) ) ; attributes . forEach ( att => attributesPad . appendChild ( att ) ) ; if ( attributesPad . innerHTML === "" ) { attributesPad . innerHTML = "No Attributes Found" ; } if ( associationsPad . innerHTML === "" ) { associationsPad . innerHTML = "No Associations Found" ; } $ ( '#assoc-attr-modal' ) . modal ( 'show' ) ; showTotalAssoc ( currentModel ) ; }
using 'function' syntax here to resolve "this"
not being the clicked on model that excecutes this function
using ' function ' syntax here to resolve " this " not being the clicked on model that excecutes this function
// clear out previous model info // sets the model's name to be displayed in the 'selected-model' div //display the total count of associations