add_content.js 1.68 KB
Newer Older
Patrick's avatar
Patrick committed
1
2
3
function addcontent(item){
    var new_row = document.getElementById("row_main")

Joe TS Dell's avatar
Joe TS Dell committed
4
    // Prepare YouTube Link
5
    // var array_contains_youtube = true
Joe TS Dell's avatar
Joe TS Dell committed
6
    var YouTubeHTML = ''
7
8
    if ('youtube' in item.links) { // to be replaced by if (item.YouTubelink) or so...
      var YouTubelink = item.links.youtube // to be replaced by item.YouTubelink or so...
Joe TS Dell's avatar
Joe TS Dell committed
9
10
11
12
      YouTubeHTML = `<a class="btn btn-sm btn-outline-danger" href="${YouTubelink}">YouTube</a>` 
    }

    // Prepare Explore Link
13
    // var array_contains_explore_link = true
Joe TS Dell's avatar
Joe TS Dell committed
14
    var ExploreHTML = ''
15
16
    if ('demo' in item.links) { // to be replaced by if (item.YouTubelink) or so...
      var ExploreLink = item.links.demo // to be replaced by item.ExploreLink or so...
Joe TS Dell's avatar
Joe TS Dell committed
17
18
19
      ExploreHTML = `<a class="btn btn-sm btn-outline-secondary" href="${ExploreLink}">Explore</a>` 
    }

Patrick's avatar
Patrick committed
20
21
22
23
24
25
26
27
28
29
30
    new_row.innerHTML = new_row.innerHTML + '<div class="col-lg-4">' +
    '<div class="card mb-4 shadow-sm extension">' +
      '<h5>'+ item.item.title +' <span class="lead text-muted"> ' + item.item.project + '</span></h5>' +
      '<img class="thumbimg" src="' + item.item.imageLink + '" alt="">' +
      '<div class="card-body">' +
        '<p class="card-text-lg small">' +
          item.item.description +
          '<br>' +
          '<b><i class="fas fa-user"></i> Contact Person</b>: <a' +
          'href="https://www.hft-stuttgart.de/p/thunyathep-santhanavanich"> ' + item.item.author.firstName +
          ' ' + item.item.author.lastName + '</a> <br>' +
Joe TS Dell's avatar
Joe TS Dell committed
31
32
33
          '<b><i class="fas fa-star"></i> Keywords</b>: ' + item.item.keywords.join(', ') + '</br>' +
        ExploreHTML + '&nbsp;' +
        YouTubeHTML +
Patrick's avatar
Patrick committed
34
35
36
37
38
        '</p>' +
      '</div>' +
    '</div>' +
  '</div>'

39
40
}