aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/views
diff options
context:
space:
mode:
authorMarvin Borner2020-07-09 22:33:43 +0200
committerMarvin Borner2020-07-09 22:33:43 +0200
commit1edfdf5f3a316a36108a0a853b0a2553d116d6fc (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/main/resources/views
parent18edde9bd3603f3f867cebce100e7b22be9012cd (diff)
Rewriiiiiiiiiite!
Okay, okay. I know, rewriting projects all the time is dumb. Buuut, we really don't want to work with our old and ugly code anymore. Furthermore we'll be using Deno now!
Diffstat (limited to 'src/main/resources/views')
-rw-r--r--src/main/resources/views/admin.rocker.html26
-rw-r--r--src/main/resources/views/files.rocker.html147
-rw-r--r--src/main/resources/views/fileview.rocker.html40
-rw-r--r--src/main/resources/views/index.rocker.html48
-rw-r--r--src/main/resources/views/layout.rocker.html30
-rw-r--r--src/main/resources/views/login.rocker.html44
-rw-r--r--src/main/resources/views/register.rocker.html40
-rw-r--r--src/main/resources/views/setup.rocker.html39
8 files changed, 0 insertions, 414 deletions
diff --git a/src/main/resources/views/admin.rocker.html b/src/main/resources/views/admin.rocker.html
deleted file mode 100644
index aa4fff6..0000000
--- a/src/main/resources/views/admin.rocker.html
+++ /dev/null
@@ -1,26 +0,0 @@
-@import io.javalin.*
-@args (String message, Context ctx)
-
-@layout.template("Index", ctx, RockerContent.NONE, RockerContent.NONE) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="">Admin</a>
- </h3>
-</div>
-<div class="flex">
- <div>
- <h1>Add new user</h1>
- <form action="/user/add" method="post">
- <label for="username">Username:</label>
- <input autocomplete="off" autofocus id="username" name="username" required type="text"/>
- <button type="submit">Generate</button>
- </form>
- </div>
- <div>
- @if (message.length() > 0) {
- <small>@message</small>
- }
- </div>
-</div>
-}
diff --git a/src/main/resources/views/files.rocker.html b/src/main/resources/views/files.rocker.html
deleted file mode 100644
index 7e074c4..0000000
--- a/src/main/resources/views/files.rocker.html
+++ /dev/null
@@ -1,147 +0,0 @@
-@import java.util.ArrayList
-@import io.javalin.*
-@args (ArrayList files, String path, Boolean isShared, Context ctx)
-
-@css => {
-<link href="/css/files.css" rel="stylesheet">
-}
-
-@js => {
-<script>
- const path = "@path";
- const isShared = "@isShared";
-</script>
-<script src="/js/imagePreview.js"></script>
-<script src="/js/files.js"></script>
-}
-
-@layout.template(files.size() + " Files", ctx, css, js) -> {
-<div class="drop" id="drop">
- <h3 class="navigation">
- @if (!isShared) {
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="/files/">Files</a>
-
- @if (!path.isEmpty()) {
- <i class="icon ion-ios-arrow-forward"></i>
- }
- @for (int i = 0; i < path.split("/").length - 1; i++) {
- <a href='@(new String(new char[path.split("/").length - i - 1]).replace("\0", "../"))'>@path.split("/")[i]</a>
- <i class="icon ion-ios-arrow-forward"></i>
- }
- @if (path.split("/").length > 0) {
- <a href="">@(path.split("/")[path.split("/").length - 1])</a>
- }
- } else { <!-- is shared -->
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="">Shared</a>
- <i class="icon ion-ios-arrow-forward"></i>
- <a href="">@(path.split("/")[path.split("/").length - 1])</a>
- }
- <span class="progress" id="progress"></span>
- </h3>
-
- <label class="upload" for="directory"><i class="icon ion-md-cloud-upload"></i></label>
- <input directory id="directory" multiple type="file" webkitdirectory/>
-
- <label class="upload" for="file"><i class="icon ion-md-add"></i></label>
- <input id="file" multiple type="file"/>
-
- <table id="table">
- <colgroup>
- <col/>
- <col/>
- <col/>
- <col/>
- <col/>
- <col/>
- </colgroup>
-
- <thead>
- <tr>
- <th data-asc="true"></th>
- <th data-asc="true">Name</th>
- <th data-asc="true">Size</th>
- <th data-asc="true">Last modified</th>
- @if (!isShared) {
- <th data-asc="true">Share</th>
- <th data-asc="true">Download</th>
- <th data-asc="true">Delete</th>
- } else {
- <th></th>
- <th></th>
- <th></th>
- }
- </tr>
- <tr data-href="/../">
- <td></td>
- <td>../</td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- </thead>
-
- <tbody>
- @for (String[] fileArray : files) {
- @if (fileArray[3] == "true") {
- <tr data-href="@fileArray[0]">
- } else {
- <tr data-path="@fileArray[0]">
- }
-
- <!-- TODO: Add more icons (more specific file types) -->
- @if (fileArray[4] == "true") {
- <td>
- <i class="icon ion-md-folder"></i>
- </td>
- } else if (fileArray[3] == "false") {
- <td>
- <i class="icon ion-md-code"></i>
- </td>
- } else {
- <td>
- <i class="icon ion-md-document"></i>
- </td>
- }
-
- <td>
- @fileArray[0]
- </td>
-
- <td data-size="@fileArray[5]">
- @fileArray[1]
- </td>
-
- <td data-date="@fileArray[6]">
- @fileArray[2]
- </td>
-
- @if (!isShared) {
- <td>
- <button class="share"><i class="icon ion-md-share"></i></button>
- </td>
-
- <!-- TODO: Fix download of shared files -->
- <td>
- <button class="downloadButton">
- <a class="download" download="@fileArray[0]" href="@fileArray[0]?raw"><i class="icon ion-md-download"></i></a>
- </button>
- </td>
-
- <td>
- <button class="delete"><i class="icon ion-md-trash"></i></button>
- </td>
- } else {
- <td></td>
- <td></td>
- <td></td>
- }
- </tr>
- }
- </tbody>
- </table>
-</div>
-}
diff --git a/src/main/resources/views/fileview.rocker.html b/src/main/resources/views/fileview.rocker.html
deleted file mode 100644
index 6be08fd..0000000
--- a/src/main/resources/views/fileview.rocker.html
+++ /dev/null
@@ -1,40 +0,0 @@
-@import space.anity.DatabaseController
-@import space.anity.UserHandler
-@import io.javalin.*
-@args (String content, String filename, String extension, Context ctx)
-
-@css => {
-<link href="/css/fileview.css" rel="stylesheet">
-<link href="/css/markdown.css" rel="stylesheet">
-
-@if((new DatabaseController()).isDarkTheme((new UserHandler()).getVerifiedUserId(ctx))) {
-<link href="/css/darkTheme.css" rel="stylesheet"/>
-} else {
-<link href="/css/lightTheme.css" rel="stylesheet"/>
-}
-}
-
-@js => {
-<script>const extension = "@extension";</script>
-<script src="/js/prettify.js"></script>
-<script src="/js/markdown.js"></script>
-<script src="/js/fileview.js"></script>
-}
-
-@layout.template("File " + filename, ctx, css, js) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="./">Files</a>
- <i class='icon ion-ios-arrow-forward'></i>
- <a href="">@filename</a>
- </h3>
-</div>
-<button class="switch" id="raw">Show preview</button>
-<span class="settings" id="settings">
- <label for="code">Linecount</label><input id="code" type="checkbox">
-</span>
-<pre class="prettyprint" id="content"><code class="lang-@extension">@content</code></pre>
-<textarea class="modify" id="modify"></textarea>
-<iframe class="preview" id="preview"></iframe>
-}
diff --git a/src/main/resources/views/index.rocker.html b/src/main/resources/views/index.rocker.html
deleted file mode 100644
index 7c9f46c..0000000
--- a/src/main/resources/views/index.rocker.html
+++ /dev/null
@@ -1,48 +0,0 @@
-@import space.anity.DatabaseController
-@import space.anity.UserHandler
-@import io.javalin.*
-@args (String username, Context ctx)
-
-@css => {
-<link href="/css/index.css" rel="stylesheet">
-}
-
-@js => {
-<script src="/js/index.js"></script>
-}
-
-@layout.template("Index", ctx, css, js) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- </h3>
-</div>
-<div class="flex">
- @if (username.length() > 0) {
- <button class="toggle" id="toggle">
- @if((new DatabaseController()).isDarkTheme((new UserHandler()).getVerifiedUserId(ctx))) {
- Light theme
- } else {
- Dark theme
- }
- </button>
- }
-
- <h1>Welcome to Kloud<span class="username">@(username == "" ? "" : ", " + username)</span>!</h1>
-
- <div>
- @if(username.length() > 0) {
- <a class="button" href="/user/logout">Logout</a>
- @if((new UserHandler()).isAdmin(username)) {
- <a class="button" href="/admin">Admin</a>
- }
- } else if (!(new DatabaseController()).isSetup()) {
- <a class="button" href="/setup">Setup</a>
- } else {
- <a class="button" href="/user/login">Login</a>
- }
-
- <a class="button" href="/files/">Files</a>
- </div>
-</div>
-}
diff --git a/src/main/resources/views/layout.rocker.html b/src/main/resources/views/layout.rocker.html
deleted file mode 100644
index 9963aad..0000000
--- a/src/main/resources/views/layout.rocker.html
+++ /dev/null
@@ -1,30 +0,0 @@
-@import space.anity.DatabaseController
-@import space.anity.UserHandler
-@import io.javalin.*
-@args (String title, Context ctx, RockerContent css, RockerContent js, RockerBody content)
-
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
- name="viewport">
- <meta content="ie=edge" http-equiv="X-UA-Compatible">
- <link href="/css/icons.css" rel="stylesheet">
- <link href="/css/layout.css" rel="stylesheet">
- @css
-
- @if((new DatabaseController()).isDarkTheme((new UserHandler()).getVerifiedUserId(ctx))) {
- <link href="/css/darkLayout.css" rel="stylesheet">
- }
-
- <title>@title</title>
-</head>
-<body>
-<div class="main">
- @content
-</div>
-<script src="/js/prefetch.js"></script>
-@js
-</body>
-</html>
diff --git a/src/main/resources/views/login.rocker.html b/src/main/resources/views/login.rocker.html
deleted file mode 100644
index b811025..0000000
--- a/src/main/resources/views/login.rocker.html
+++ /dev/null
@@ -1,44 +0,0 @@
-@import io.javalin.*
-@args (String message, Integer counter, Context ctx)
-
-@js => {
-<script>const counter = @counter;</script>
-<script src="/js/login.js"></script>
-}
-
-@layout.template("Login", ctx, RockerContent.NONE, js) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="">Login</a>
- </h3>
-</div>
-<div class="flex">
- <h1>Login</h1>
-
- <form action="/user/login" method="post">
- <div>
- <label for="username">Username:</label>
- <input autocomplete="off" autofocus id="username" name="username" required type="text"/>
- </div>
- <div>
- <label for="password">Password:</label>
- <input id="password" name="password" required type="password"/>
- </div>
-
- <div>
- @if(message.length() > 0) {
- <small>@message</small>
- }
-
- @if(counter > 0) {
- <small id="tryAgain">Please try again in <span id="counter">@counter</span> seconds.</small>
- }
- </div>
-
- <div>
- <button type="submit">Login</button>
- </div>
- </form>
-</div>
-}
diff --git a/src/main/resources/views/register.rocker.html b/src/main/resources/views/register.rocker.html
deleted file mode 100644
index c89eef3..0000000
--- a/src/main/resources/views/register.rocker.html
+++ /dev/null
@@ -1,40 +0,0 @@
-@import io.javalin.*
-@args (String username, String token, String message, Context ctx)
-
-@layout.template("Register", ctx, RockerContent.NONE, RockerContent.NONE) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="">Register</a>
- </h3>
-</div>
-<div class="flex">
- <h1>Register</h1>
-
- <form action="/user/register" method="post">
- <h3>Please set a password for user "@username"</h3>
- <div>
- <input hidden name="username" type="text" value="@username"/>
- <input hidden name="token" type="text" value="@token"/>
- </div>
- <div>
- <label for="password">Password:</label>
- <input autocomplete="off" autofocus id="password" minlength="8" name="password" required type="password"/>
- </div>
- <div>
- <label for="verifyPassword">Verify password:</label>
- <input autocomplete="off" id="verifyPassword" minlength="8" name="verifyPassword" required type="password"/>
- </div>
-
- <div>
- @if (message.length() > 0) {
- <small>@message</small>
- }
- </div>
-
- <div>
- <button type="submit">Register</button>
- </div>
- </form>
-</div>
-}
diff --git a/src/main/resources/views/setup.rocker.html b/src/main/resources/views/setup.rocker.html
deleted file mode 100644
index 7fa312c..0000000
--- a/src/main/resources/views/setup.rocker.html
+++ /dev/null
@@ -1,39 +0,0 @@
-@import io.javalin.*
-@args (String message, Context ctx)
-
-@layout.template("Setup", ctx, RockerContent.NONE, RockerContent.NONE) -> {
-<div class="navigation">
- <h3>
- <a href="/"><i class="icon ion-md-home"></i></a>
- <a href="">Setup</a>
- </h3>
-</div>
-<div class="flex">
- <h1>Setup</h1>
-
- <form action="/setup" method="post">
- <div>
- <label for="username">Username:</label>
- <input autocomplete="off" autofocus id="username" name="username" required type="text"/>
- </div>
- <div>
- <label for="password">Password:</label>
- <input id="password" name="password" required type="password"/>
- </div>
- <div>
- <label for="verifyPassword">Verify password:</label>
- <input id="verifyPassword" name="verifyPassword" required type="password"/>
- </div>
-
- <div>
- @if (message.length() > 0) {
- <small>@message</small>
- }
- </div>
-
- <div>
- <button type="submit">Setup</button>
- </div>
- </form>
-</div>
-}