✨ Use @TemplatePath annotations on most pages
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / AboutPage.kt
1 package net.pterodactylus.sone.web.pages
2
3 import net.pterodactylus.sone.main.*
4 import net.pterodactylus.sone.web.WebInterface
5 import net.pterodactylus.sone.web.page.*
6 import net.pterodactylus.util.template.Template
7 import net.pterodactylus.util.template.TemplateContext
8 import javax.inject.Inject
9
10 /**
11  * A [SoneTemplatePage] that stores information about Sone in the [TemplateContext].
12  */
13 @MenuName("About")
14 @TemplatePath("/templates/about.html")
15 class AboutPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer,
16                 private val pluginVersion: PluginVersion,
17                 private val pluginYear: PluginYear,
18                 private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.About.Title") {
19
20         override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
21                 templateContext["version"] = pluginVersion.version
22                 templateContext["year"] = pluginYear.year
23                 templateContext["homepage"] = pluginHomepage.homepage
24         }
25
26 }