project/src/main/webapp/shared.js
/**
 * Writes out relevant details to an event card with the appropriate lod (level
 * of detail)
 */
Writes out relevant details to an event card with the appropriate lod (level
of detail)
Writes out relevant details to an event card with the appropriate lod ( level of detail )
async function populateEventContainerWithoutButtons(event, containerId, lod) {
  const eventCardAll = await $.get('event-card.html');
  const eventCard =
      $(eventCardAll).filter(`#event-card-level-${Math.min(lod, 3)}`).get(0);
  const eventCardId = `event-${event.eventId}`;
  $(eventCard).attr('id', eventCardId);
  $(`#${containerId}`).append(eventCard);
  $(`#${eventCardId} #event-card-title`).html(event.name);
  $(`#${eventCardId} #event-card-description`).html(event.description);
  if (lod > 1) {
    $(`#${eventCardId} #event-card-date`)
        .html(buildDate(
            event.date.year, event.date.month, event.date.dayOfMonth));
    $(`#${eventCardId} #event-card-time`).html(event.time);
    $(`#${eventCardId} #event-card-location`).html(event.location);
  }
  buildAsLabels(
      `#${eventCardId} .card-body #event-card-labels`, event.labels,
      'interests');
  buildSkillsAsLabels(
      `#${eventCardId} .card-body #event-card-labels`, event.opportunities);
  if (lod >= 2) {
    populateExistingImage(
        'event', `#${eventCardId} #event-card-image`, event.eventId);
  }
  if (lod >= 3) {
    if (event.opportunities.length) {
      $(`#${eventCardId} #event-card-volunteers`)
          .html(buildVolunteers(event.opportunities));
    } else {
      $(`#${eventCardId} #vols-needed`).parent().hide();
    }
  }
  if (event.opportunityName) {
    $(`#${eventCardId} #event-card-role-type-placeholder #event-card-role-type`)
        .html(`<b>Role:</b> ${event.opportunityName}`);
  } else {
    $(`#${eventCardId} #event-card-role-type-placeholder`).remove();
  }
  $('#' + eventCardId + ' div #event-details').hide();
  $('#' + eventCardId + ' div #event-register').hide();
  if (lod === 5) {
    $(`#${eventCardId}`).attr('style', 'width: 100% !important');
    $(".dropdown-toggle").dropdown();
    populateAttendees(event);
  }
}
async function populateEventContainerWithoutButtons ( event , containerId , lod ) { const eventCardAll = await $ . get ( 'event-card.html' ) ; const eventCard = $ ( eventCardAll ) . filter ( ` ${ Math . min ( lod , 3 ) } ` ) . get ( 0 ) ; const eventCardId = ` ${ event . eventId } ` ; $ ( eventCard ) . attr ( 'id' , eventCardId ) ; $ ( ` ${ containerId } ` ) . append ( eventCard ) ; $ ( ` ${ eventCardId } ` ) . html ( event . name ) ; $ ( ` ${ eventCardId } ` ) . html ( event . description ) ; if ( lod > 1 ) { $ ( ` ${ eventCardId } ` ) . html ( buildDate ( event . date . year , event . date . month , event . date . dayOfMonth ) ) ; $ ( ` ${ eventCardId } ` ) . html ( event . time ) ; $ ( ` ${ eventCardId } ` ) . html ( event . location ) ; } buildAsLabels ( ` ${ eventCardId } ` , event . labels , 'interests' ) ; buildSkillsAsLabels ( ` ${ eventCardId } ` , event . opportunities ) ; if ( lod >= 2 ) { populateExistingImage ( 'event' , ` ${ eventCardId } ` , event . eventId ) ; } if ( lod >= 3 ) { if ( event . opportunities . length ) { $ ( ` ${ eventCardId } ` ) . html ( buildVolunteers ( event . opportunities ) ) ; } else { $ ( ` ${ eventCardId } ` ) . parent ( ) . hide ( ) ; } } if ( event . opportunityName ) { $ ( ` ${ eventCardId } ` ) . html ( ` ${ event . opportunityName } ` ) ; } else { $ ( ` ${ eventCardId } ` ) . remove ( ) ; } $ ( '#' + eventCardId + ' div #event-details' ) . hide ( ) ; $ ( '#' + eventCardId + ' div #event-register' ) . hide ( ) ; if ( lod === 5 ) { $ ( ` ${ eventCardId } ` ) . attr ( 'style' , 'width: 100% !important' ) ; $ ( ".dropdown-toggle" ) . dropdown ( ) ; populateAttendees ( event ) ; } }
Writes out relevant details to an event card with the appropriate lod (level
 of detail)
Writes out relevant details to an event card with the appropriate lod ( level of detail )