Add initial Bootstrap style

Signed-off-by: Graham <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent 81e2dedee5
commit 554520b285
  1. 2
      archive/build.gradle.kts
  2. 3
      archive/src/main/kotlin/org/openrs2/archive/web/WebServer.kt
  3. 66
      archive/src/main/resources/org/openrs2/archive/templates/caches/index.html
  4. 1
      buildSrc/src/main/kotlin/Versions.kt

@ -24,11 +24,13 @@ dependencies {
implementation("io.ktor:ktor-jackson:${Versions.ktor}")
implementation("io.ktor:ktor-server-netty:${Versions.ktor}")
implementation("io.ktor:ktor-thymeleaf:${Versions.ktor}")
implementation("io.ktor:ktor-webjars:${Versions.ktor}")
implementation("org.flywaydb:flyway-core:${Versions.flyway}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}")
implementation("org.postgresql:postgresql:${Versions.postgres}")
implementation("org.thymeleaf:thymeleaf:${Versions.thymeleaf}")
implementation("org.thymeleaf.extras:thymeleaf-extras-java8time:${Versions.thymeleafJava8Time}")
implementation("org.webjars:bootstrap:${Versions.bootstrap}")
}
publishing {

@ -11,6 +11,7 @@ import io.ktor.routing.routing
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.thymeleaf.Thymeleaf
import io.ktor.webjars.Webjars
import org.openrs2.json.Json
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect
import org.thymeleaf.templatemode.TemplateMode
@ -38,6 +39,8 @@ public class WebServer @Inject constructor(
})
}
install(Webjars)
routing {
get("/caches") { cachesController.index(call) }
get("/caches/{id}.zip") { cachesController.export(call) }

@ -1,35 +1,41 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
<title>OpenRS2 Archive</title>
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css" />
</head>
<body>
<table>
<thead>
<tr>
<th>Game</th>
<th>Build</th>
<th>Timestamp</th>
<th>Name</th>
<th>Indexes</th>
<th>Groups</th>
<th>Keys</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<!--/*@thymesVar id="caches" type="java.util.List<org.openrs2.archive.cache.CacheExporter.Cache>"*/-->
<tr th:each="cache : ${caches}">
<td th:text="${cache.game}">runescape</td>
<td th:text="${cache.build}">550</td>
<td th:text="${#temporals.formatISO(cache.timestamp)}"></td>
<td th:text="${cache.name}"></td>
<td th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validGroups} + ' / ' + ${cache.groupStats.groups} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validKeys} + ' / ' + ${cache.groupStats.keys} : 'Calculating...'">Calculating...</td>
<td>
<a th:href="${'/caches/' + cache.id + '.zip'}">Cache</a>
<a th:href="${'/caches/' + cache.id + '.json'}">Keys</a>
</td>
</tr>
</tbody>
</table>
<main class="container">
<table class="table table-striped table-bordered table-hover">
<thead class="thead-dark">
<tr>
<th>Game</th>
<th>Build</th>
<th>Timestamp</th>
<th>Name</th>
<th>Indexes</th>
<th>Groups</th>
<th>Keys</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<!--/*@thymesVar id="caches" type="java.util.List<org.openrs2.archive.cache.CacheExporter.Cache>"*/-->
<tr th:each="cache : ${caches}">
<td th:text="${cache.game}">runescape</td>
<td th:text="${cache.build}">550</td>
<td th:text="${#temporals.formatISO(cache.timestamp)}"></td>
<td th:text="${cache.name}"></td>
<td th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validGroups} + ' / ' + ${cache.groupStats.groups} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validKeys} + ' / ' + ${cache.groupStats.keys} : 'Calculating...'">Calculating...</td>
<td>
<a th:href="${'/caches/' + cache.id + '.zip'}" class="btn btn-primary btn-sm">Cache</a>
<a th:href="${'/caches/' + cache.id + '.json'}" class="btn btn-primary btn-sm">Keys</a>
</td>
</tr>
</tbody>
</table>
</main>
</body>
</html>

@ -1,5 +1,6 @@
object Versions {
const val asm = "9.1"
const val bootstrap = "4.6.0"
const val bouncyCastlePkix = "1.68"
const val bouncyCastleProvider = "1.68"
const val clikt = "3.1.0"

Loading…
Cancel
Save