feat(index): add datatables responsive plugin

This commit is contained in:
Axel Cocat 2022-02-26 21:10:57 +01:00
parent 88477ba93f
commit 3860ad47c7
4 changed files with 13 additions and 7 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "azerothcore-armory", "name": "azerothcore-armory",
"version": "0.6.3", "version": "0.6.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "azerothcore-armory", "name": "azerothcore-armory",
"version": "0.6.3", "version": "0.6.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@supercharge/promise-pool": "^2.1.0", "@supercharge/promise-pool": "^2.1.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "azerothcore-armory", "name": "azerothcore-armory",
"version": "0.6.3", "version": "0.6.4",
"description": "", "description": "",
"scripts": { "scripts": {
"build": "tsc -p tsconfig.json", "build": "tsc -p tsconfig.json",

View file

@ -72,8 +72,8 @@ export class IndexController {
{ name: "name", collation: `${charSet}_general_ci` }, { name: "name", collation: `${charSet}_general_ci` },
{ table: "guild", name: "name" }, { table: "guild", name: "name" },
{ name: "level" }, { name: "level" },
{ name: "race", formatter: (race, row) => `${raceFiles[race]}_${row[6] === 0 ? "male" : "female"}` },
{ name: "class", formatter: cls => classFiles[cls] }, { name: "class", formatter: cls => classFiles[cls] },
{ name: "race", formatter: (race, row) => `${raceFiles[race]}_${row[6] === 0 ? "male" : "female"}` },
{ name: "online", formatter: online => online === 1 }, { name: "online", formatter: online => online === 1 },
]); ]);
ssp.joins = [ ssp.joins = [

View file

@ -1,7 +1,10 @@
<link rel="stylesheet" type="text/css" href="/css/index.css"> <link rel="stylesheet" type="text/css" href="/css/index.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css"> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/css/datatables.css"> <link rel="stylesheet" type="text/css" href="/css/datatables.css">
<script type="application/javascript" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script> <script type="application/javascript" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script type="application/javascript"
src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
<h1 class="title is-size-1">Armory</h1> <h1 class="title is-size-1">Armory</h1>
@ -27,8 +30,8 @@
<th>Character name</th> <th>Character name</th>
<th>Guild</th> <th>Guild</th>
<th>Level</th> <th>Level</th>
<th>Race</th>
<th>Class</th> <th>Class</th>
<th>Race</th>
<th>Online</th> <th>Online</th>
</tr> </tr>
</thead> </thead>
@ -57,12 +60,12 @@
{ {
searchable: false, searchable: false,
targets: 3, targets: 3,
render: data => `<img src="{{aowow}}/static/images/wow/icons/medium/race_${data}.jpg">`, render: data => `<img src="{{aowow}}/static/images/wow/icons/medium/class_${data}.jpg">`,
}, },
{ {
searchable: false, searchable: false,
targets: 4, targets: 4,
render: data => `<img src="{{aowow}}/static/images/wow/icons/medium/class_${data}.jpg">`, render: data => `<img src="{{aowow}}/static/images/wow/icons/medium/race_${data}.jpg">`,
}, },
{ {
searchable: false, searchable: false,
@ -70,6 +73,9 @@
render: online => online ? "🟢" : "🔴", render: online => online ? "🟢" : "🔴",
}, },
], ],
responsive: {
details: true,
},
}); });
} }