add_content.js 1.94 KB
Newer Older
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
1
2
function addcontent(item){
    var new_row = document.getElementById("row_main")
Patrick's avatar
Patrick committed
3
    if(item === undefined) {
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
4

Patrick's avatar
Patrick committed
5
6
7
    }else{
      
    
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
8
9
10
11
12
    // Prepare YouTube Link
    // var array_contains_youtube = true
    var YouTubeHTML = ''
    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
up    
Joe TS Dell committed
13
      YouTubeHTML = `<a class="btn btn-sm btn-outline-danger" href="${YouTubelink}" target="_blank">YouTube</a>` 
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
14
15
16
17
18
19
20
21
22
23
24
25
    }
    var description = ""
    if (lang_setting == "1"){
        description = item.item.description_en
    } else if (lang_setting == "2"){
        description = item.item.description_de
    }
    // Prepare Explore Link
    // var array_contains_explore_link = true
    var ExploreHTML = ''
    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
up    
Joe TS Dell committed
26
      ExploreHTML = `<a class="btn btn-sm btn-outline-secondary" href="${ExploreLink}" target="_blank">Explore</a>` 
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    }

    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">' +
          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>' +
          '<b><i class="fas fa-star"></i> Keywords</b>: ' + item.item.keywords.join(', ') + '</br>' +
        ExploreHTML + '&nbsp;' +
        YouTubeHTML +
        '</p>' +
      '</div>' +
    '</div>' +
  '</div>'
Patrick's avatar
Patrick committed
47
}
JOE Thunyathep S's avatar
up  
JOE Thunyathep S committed
48
49
}