Fix linting warnings
This commit is contained in:
@@ -10,7 +10,8 @@ class BaseView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
fun renderHome(jwtPayload: JwtPayload?) = renderPage(
|
||||
title = "Home",
|
||||
description = "A fast and simple note taking website",
|
||||
jwtPayload = jwtPayload) {
|
||||
jwtPayload = jwtPayload
|
||||
) {
|
||||
section("text-center my-2 p-2") {
|
||||
h1("text-5xl") {
|
||||
span("text-teal-300") { +"Simplenotes " }
|
||||
@@ -22,7 +23,8 @@ class BaseView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
|
||||
unsafe {
|
||||
@Language("html")
|
||||
val html = """
|
||||
val html =
|
||||
"""
|
||||
<div aria-label="demo" class="md:order-1 order-2 flipped flipped-left p-4 my-10 w-full md:w-1/2">
|
||||
<div class="flex justify-between mb-4">
|
||||
<h1 class="text-2xl underline">Notes</h1>
|
||||
@@ -78,13 +80,12 @@ class BaseView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
""".trimIndent()
|
||||
""".trimIndent()
|
||||
|
||||
+html
|
||||
}
|
||||
|
||||
welcome()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package be.simplenotes.app.views
|
||||
import be.simplenotes.app.utils.StaticFileResolver
|
||||
import be.simplenotes.app.views.components.Alert
|
||||
import be.simplenotes.app.views.components.alert
|
||||
import kotlinx.html.FlowContent
|
||||
import kotlinx.html.a
|
||||
import kotlinx.html.div
|
||||
|
||||
@@ -18,10 +17,12 @@ class ErrorView(staticFileResolver: StaticFileResolver) : View(staticFileResolve
|
||||
fun error(errorType: Type) = renderPage(errorType.title, jwtPayload = null) {
|
||||
div("container mx-auto p-4") {
|
||||
when (errorType) {
|
||||
Type.SqlTransientError -> alert(Alert.Warning,
|
||||
Type.SqlTransientError -> alert(
|
||||
Alert.Warning,
|
||||
errorType.title,
|
||||
"Please try again later",
|
||||
multiline = true)
|
||||
multiline = true
|
||||
)
|
||||
Type.NotFound -> alert(Alert.Warning, errorType.title, "Page not found", multiline = true)
|
||||
Type.Other -> alert(Alert.Warning, errorType.title)
|
||||
}
|
||||
@@ -30,5 +31,4 @@ class ErrorView(staticFileResolver: StaticFileResolver) : View(staticFileResolve
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ class NoteView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun DIV.pagination(currentPage: Int, numberOfPages: Int, tag: String?) {
|
||||
val links = mutableListOf<Pair<String, String>>()
|
||||
// if (currentPage > 1) links += "Previous" to "?page=${currentPage - 1}"
|
||||
@@ -120,7 +119,7 @@ class NoteView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
fun renderedNote(jwtPayload: JwtPayload, note: PersistedNote) = renderPage(
|
||||
note.meta.title,
|
||||
jwtPayload = jwtPayload,
|
||||
scripts = listOf("/highlight.10.1.2.js","/init-highlight.0.0.1.js")
|
||||
scripts = listOf("/highlight.10.1.2.js", "/init-highlight.0.0.1.js")
|
||||
) {
|
||||
div("container mx-auto p-4") {
|
||||
div("flex items-center justify-between mb-4") {
|
||||
|
||||
@@ -33,7 +33,9 @@ class SettingView(staticFileResolver: StaticFileResolver) : View(staticFileResol
|
||||
|
||||
form(method = FormMethod.post, action = "/export") {
|
||||
button(name = "display", classes = "btn btn-teal block", type = submit) { +"Display my data" }
|
||||
button(name = "download", classes = "btn btn-green block mt-2", type = submit) { +"Download my data" }
|
||||
button(name = "download", classes = "btn btn-green block mt-2", type = submit) {
|
||||
+"Download my data"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +74,6 @@ class SettingView(staticFileResolver: StaticFileResolver) : View(staticFileResol
|
||||
attributes["for"] = "checked"
|
||||
+" Do you want to proceed ?"
|
||||
}
|
||||
|
||||
}
|
||||
button(
|
||||
type = submit,
|
||||
|
||||
@@ -8,20 +8,21 @@ import be.simplenotes.app.views.components.submitButton
|
||||
import be.simplenotes.domain.security.JwtPayload
|
||||
import io.konform.validation.ValidationError
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.ButtonType.submit
|
||||
|
||||
class UserView(staticFileResolver: StaticFileResolver) : View(staticFileResolver) {
|
||||
fun register(
|
||||
jwtPayload: JwtPayload?,
|
||||
error: String? = null,
|
||||
validationErrors: List<ValidationError> = emptyList(),
|
||||
) = accountForm("Register",
|
||||
) = accountForm(
|
||||
"Register",
|
||||
"Registration page",
|
||||
jwtPayload,
|
||||
error,
|
||||
validationErrors,
|
||||
"Create an account",
|
||||
"Register") {
|
||||
"Register"
|
||||
) {
|
||||
+"Already have an account? "
|
||||
a(href = "/login", classes = "no-underline text-blue-500 font-bold") { +"Sign In" }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import be.simplenotes.domain.security.JwtPayload
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.stream.appendHTML
|
||||
|
||||
abstract class View(private val staticFileResolver: StaticFileResolver) {
|
||||
abstract class View(staticFileResolver: StaticFileResolver) {
|
||||
|
||||
private val styles = staticFileResolver.resolve("styles.css")!!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user