aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/views/fileview.rocker.html
blob: 6be08fd2441b4000ee166dc2a4edd6437b54d3d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@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>
}