diff --git a/static/javascript/main.js b/static/javascript/main.js index 19a5201..c06a1d1 100644 --- a/static/javascript/main.js +++ b/static/javascript/main.js @@ -13,25 +13,6 @@ async function makeRequest(url) { } } -function add_boardgame_row(html_tbody, boardgame_json) { - var row = html_tbody.insertRow(); - var icon_cell = row.insertCell(); - var name_cell = row.insertCell(); - var description_cell = row.insertCell(); - var weight_cell = row.insertCell() - - var icon_image = document.createElement('img') - icon_image.src = boardgame_json.thumbnail_url - icon_image.classList.add("img-thumbnail") - - icon_cell.appendChild(icon_image) - name_cell.innerHTML = boardgame_json.name - description_cell.innerHTML = boardgame_json.description - weight_cell.innerHTML = boardgame_json.weight - - row.onclick = function(){ window.location.href = '/boardgame?id=' + boardgame_json.id} -} - async function loadWishlistedGames() { var wishlist_priorities = [1,2,3,4] @@ -57,7 +38,25 @@ async function loadWishlistedGames() { data: 'name' }, { - data: 'description' + data: 'min_players', + render: function(data,type,row){ + if (row.min_players != row.max_players){ + return row.min_players + '-' + row.max_players + }else{ + return row.min_players + } + + } + }, + { + data: 'min_playing_time', + render: function(data,type,row){ + if (row.min_playing_time != row.max_playing_time){ + return row.min_playing_time + '-' + row.max_playing_time + }else{ + return row.min_playing_time + } + } }, { data: 'weight' @@ -67,7 +66,8 @@ async function loadWishlistedGames() { { target: 0, visible: false - } + }, + { targets: 'no-sort', orderable: false } ], order: [[2, 'asc']] }); @@ -78,7 +78,6 @@ async function loadWishlistedGames() { }) }); - } async function loadOwnedGames() { @@ -99,12 +98,33 @@ async function loadOwnedGames() { data: 'name' }, { - data: 'description' + data: 'min_players', + render: function(data,type,row){ + if (row.min_players != row.max_players){ + return row.min_players + '-' + row.max_players + }else{ + return row.min_players + } + + } + }, + { + data: 'min_playing_time', + render: function(data,type,row){ + if (row.min_playing_time != row.max_playing_time){ + return row.min_playing_time + '-' + row.max_playing_time + }else{ + return row.min_playing_time + } + } }, { data: 'weight' } ], + columnDefs: [ + { targets: 'no-sort', orderable: false } + ], order: [[1, 'asc']] }); diff --git a/templates/owned.jinja b/templates/owned.jinja index aa79070..002ae5a 100644 --- a/templates/owned.jinja +++ b/templates/owned.jinja @@ -10,9 +10,10 @@
| Thumbnail | +Thumbnail | Naam | -Beschrijving | +Spelers | +Duratie | Moeilijkheid | |
|---|---|---|---|---|---|---|---|
| wishlist_priority | -Thumbnail | +Thumbnail | Naam | -Beschrijving | +Spelers | +Duratie | Moeilijkheid |
| wishlist_priority | -Thumbnail | +Thumbnail | Naam | -Beschrijving | +Spelers | +Duratie | Moeilijkheid |