Created more board game table columns
This commit is contained in:
parent
49b97ef0c2
commit
d88ca6d216
3 changed files with 61 additions and 33 deletions
|
|
@ -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() {
|
async function loadWishlistedGames() {
|
||||||
|
|
||||||
var wishlist_priorities = [1,2,3,4]
|
var wishlist_priorities = [1,2,3,4]
|
||||||
|
|
@ -57,7 +38,25 @@ async function loadWishlistedGames() {
|
||||||
data: 'name'
|
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'
|
data: 'weight'
|
||||||
|
|
@ -67,7 +66,8 @@ async function loadWishlistedGames() {
|
||||||
{
|
{
|
||||||
target: 0,
|
target: 0,
|
||||||
visible: false
|
visible: false
|
||||||
}
|
},
|
||||||
|
{ targets: 'no-sort', orderable: false }
|
||||||
],
|
],
|
||||||
order: [[2, 'asc']]
|
order: [[2, 'asc']]
|
||||||
});
|
});
|
||||||
|
|
@ -78,7 +78,6 @@ async function loadWishlistedGames() {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadOwnedGames() {
|
async function loadOwnedGames() {
|
||||||
|
|
@ -99,12 +98,33 @@ async function loadOwnedGames() {
|
||||||
data: 'name'
|
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'
|
data: 'weight'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{ targets: 'no-sort', orderable: false }
|
||||||
|
],
|
||||||
order: [[1, 'asc']]
|
order: [[1, 'asc']]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,10 @@
|
||||||
<table class="table table-striped boardgame_table">
|
<table class="table table-striped boardgame_table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Thumbnail</th>
|
<th scope="col" class="no-sort">Thumbnail</th>
|
||||||
<th scope="col">Naam</th>
|
<th scope="col">Naam</th>
|
||||||
<th scope="col">Beschrijving</th>
|
<th scope="col">Spelers</th>
|
||||||
|
<th scope="col">Duratie</th>
|
||||||
<th scope="col">Moeilijkheid</th>
|
<th scope="col">Moeilijkheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,10 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">wishlist_priority</th>
|
<th scope="col">wishlist_priority</th>
|
||||||
<th scope="col">Thumbnail</th>
|
<th scope="col" class="no-sort">Thumbnail</th>
|
||||||
<th scope="col">Naam</th>
|
<th scope="col">Naam</th>
|
||||||
<th scope="col">Beschrijving</th>
|
<th scope="col">Spelers</th>
|
||||||
|
<th scope="col">Duratie</th>
|
||||||
<th scope="col">Moeilijkheid</th>
|
<th scope="col">Moeilijkheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -25,11 +26,13 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">wishlist_priority</th>
|
<th scope="col">wishlist_priority</th>
|
||||||
<th scope="col">Thumbnail</th>
|
<th scope="col" class="no-sort">Thumbnail</th>
|
||||||
<th scope="col">Naam</th>
|
<th scope="col">Naam</th>
|
||||||
<th scope="col">Beschrijving</th>
|
<th scope="col">Spelers</th>
|
||||||
|
<th scope="col">Duratie</th>
|
||||||
<th scope="col">Moeilijkheid</th>
|
<th scope="col">Moeilijkheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -39,11 +42,13 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">wishlist_priority</th>
|
<th scope="col">wishlist_priority</th>
|
||||||
<th scope="col">Thumbnail</th>
|
<th scope="col" class="no-sort">Thumbnail</th>
|
||||||
<th scope="col">Naam</th>
|
<th scope="col">Naam</th>
|
||||||
<th scope="col">Beschrijving</th>
|
<th scope="col">Spelers</th>
|
||||||
|
<th scope="col">Duratie</th>
|
||||||
<th scope="col">Moeilijkheid</th>
|
<th scope="col">Moeilijkheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -53,11 +58,13 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">wishlist_priority</th>
|
<th scope="col">wishlist_priority</th>
|
||||||
<th scope="col">Thumbnail</th>
|
<th scope="col" class="no-sort">Thumbnail</th>
|
||||||
<th scope="col">Naam</th>
|
<th scope="col">Naam</th>
|
||||||
<th scope="col">Beschrijving</th>
|
<th scope="col">Spelers</th>
|
||||||
|
<th scope="col">Duratie</th>
|
||||||
<th scope="col">Moeilijkheid</th>
|
<th scope="col">Moeilijkheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue