* A [SoneTemplatePage] that stores information about Sone in the [TemplateContext].
*/
@MenuName("About")
+@TemplatePath("/templates/about.html")
class AboutPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer,
private val pluginVersion: PluginVersion,
private val pluginYear: PluginYear,
* Page that lets the user browse all his bookmarked posts.
*/
@MenuName("Bookmarks")
+@TemplatePath("/templates/bookmarks.html")
class BookmarksPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
SoneTemplatePage("bookmarks.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Bookmarks.Title") {
/**
* Page that lets the user create a new album.
*/
+@TemplatePath("/templates/createAlbum.html")
class CreateAlbumPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("createAlbum.html", template, "Page.CreateAlbum.Title", webInterface, loaders, templateRenderer) {
/**
* This page lets the user create a new [Post].
*/
+@TemplatePath("/templates/createPost.html")
class CreatePostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("createPost.html", template, "Page.CreatePost.Title", webInterface, loaders, templateRenderer) {
/**
* This page lets the user post a reply to a post.
*/
+@TemplatePath("/templates/createReply.html")
class CreateReplyPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("createReply.html", template, "Page.CreateReply.Title", webInterface, loaders, templateRenderer) {
* The “create Sone” page lets the user create a new Sone.
*/
@MenuName("CreateSone")
+@TemplatePath("/templates/createSone.html")
class CreateSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("createSone.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.CreateSone.Title") {
/**
* Page that lets the user delete an {@link Album}.
*/
+@TemplatePath("/templates/deleteAlbum.html")
class DeleteAlbumPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deleteAlbum.html", template, "Page.DeleteAlbum.Title", webInterface, loaders, templateRenderer) {
/**
* Page that lets the user delete an {@link Image}.
*/
+@TemplatePath("/templates/deleteImage.html")
class DeleteImagePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deleteImage.html", template, "Page.DeleteImage.Title", webInterface, loaders, templateRenderer) {
/**
* Lets the user delete a post they made.
*/
+@TemplatePath("/templates/deletePost.html")
class DeletePostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deletePost.html", template, "Page.DeletePost.Title", webInterface, loaders, templateRenderer) {
/**
* Page that lets the user confirm the deletion of a profile field.
*/
+@TemplatePath("/templates/deleteProfileField.html")
class DeleteProfileFieldPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deleteProfileField.html", template, "Page.DeleteProfileField.Title", webInterface, loaders, templateRenderer) {
/**
* This page lets the user delete a reply.
*/
+@TemplatePath("/templates/deleteReply.html")
class DeleteReplyPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deleteReply.html", template, "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) {
* installation.
*/
@MenuName("DeleteSone")
+@TemplatePath("/templates/deleteSone.html")
class DeleteSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("deleteSone.html", template, "Page.DeleteSone.Title", webInterface, loaders, templateRenderer) {
/**
* Page that lets the user edit the name of a profile field.
*/
+@TemplatePath("/templates/editProfileField.html")
class EditProfileFieldPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
LoggedInPage("editProfileField.html", template, "Page.EditProfileField.Title", webInterface, loaders, templateRenderer) {
* This page lets the user edit her profile.
*/
@MenuName("EditProfile")
+@TemplatePath("/templates/editProfile.html")
class EditProfilePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
LoggedInPage("editProfile.html", template, "Page.EditProfile.Title", webInterface, loaders, templateRenderer) {
* The image browser page is the entry page for the image management.
*/
@MenuName("ImageBrowser")
+@TemplatePath("/templates/imageBrowser.html")
class ImageBrowserPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("imageBrowser.html", template, "Page.ImageBrowser.Title", webInterface, loaders, templateRenderer) {
* of all friends of the current user.
*/
@MenuName("Index")
+@TemplatePath("/templates/index.html")
class IndexPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val postVisibilityFilter: PostVisibilityFilter) :
LoggedInPage("index.html", template, "Page.Index.Title", webInterface, loaders, templateRenderer) {
* This page shows all known Sones.
*/
@MenuName("KnownSones")
+@TemplatePath("/templates/knownSones.html")
class KnownSonesPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("knownSones.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.KnownSones.Title") {
* The login page lets the user log in.
*/
@MenuName("Login")
+@TemplatePath("/templates/login.html")
class LoginPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("login.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Login.Title") {
* [PostVisibilityFilter.isPostVisible(Sone, Post)] and sorted by time.
*/
@MenuName("New")
-class NewPage @Inject constructor( template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
+@TemplatePath("/templates/new.html")
+class NewPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("new.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.New.Title") {
override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) =
* This page lets the user edit the options of the Sone plugin.
*/
@MenuName("Options")
+@TemplatePath("/templates/options.html")
class OptionsPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("options.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Options.Title") {
* Page that lets the user control the rescue mode for a Sone.
*/
@MenuName("Rescue")
+@TemplatePath("/templates/rescue.html")
class RescuePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("rescue.html", template, "Page.Rescue.Title", webInterface, loaders, templateRenderer) {
* This page lets the user search for posts and replies that contain certain
* words.
*/
+@TemplatePath("/templates/search.html")
class SearchPage(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, ticker: Ticker = Ticker.systemTicker()) :
SoneTemplatePage("search.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Search.Title") {
/**
* Page implementation that lets the user upload an image.
*/
+@TemplatePath("/templates/invalid.html")
class UploadImagePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
LoggedInPage("uploadImage.html", template, "Page.UploadImage.Title", webInterface, loaders, templateRenderer) {
/**
* This page lets the user view a post and all its replies.
*/
+@TemplatePath("/templates/viewPost.html")
class ViewPostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("viewPost.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.ViewPost.Title") {
/**
* Lets the user browser another Sone.
*/
+@TemplatePath("/templates/viewSone.html")
class ViewSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
SoneTemplatePage("viewSone.html", webInterface, loaders, template, templateRenderer) {
assertThat(page.menuName, equalTo("About"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/about.html"))
+ }
+
}
assertThat(page.menuName, equalTo("Bookmarks"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/bookmarks.html"))
+ }
}
import net.pterodactylus.sone.test.selfMock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<CreateAlbumPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/createAlbum.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.utils.asOptional
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<CreatePostPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/createPost.html"))
+ }
+
}
import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<CreateReplyPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/createReply.html"))
+ }
+
}
assertThat(page.menuName, equalTo("CreateSone"))
}
+ @Test
+ fun `page is annotated with the correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/createSone.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<DeleteAlbumPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteAlbum.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<DeleteImagePage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteImage.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<DeletePostPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deletePost.html"))
+ }
+
}
import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<DeleteProfileFieldPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteProfileField.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<DeleteReplyPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteReply.html"))
+ }
+
}
assertThat(page.menuName, equalTo("DeleteSone"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteSone.html"))
+ }
+
}
import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<EditProfileFieldPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/editProfileField.html"))
+ }
+
}
assertThat(page.menuName, equalTo("EditProfile"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/editProfile.html"))
+ }
+
}
assertThat(page.menuName, equalTo("ImageBrowser"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/imageBrowser.html"))
+ }
+
}
assertThat(page.menuName, equalTo("Index"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/index.html"))
+ }
+
}
assertThat(page.menuName, equalTo("KnownSones"))
}
+ @Test
+ fun `page is annotated with corrrect template path`() {
+ assertThat(page.templatePath, equalTo("/templates/knownSones.html"))
+ }
+
}
assertThat(page.menuName, equalTo("Login"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/login.html"))
+ }
+
}
assertThat(page.menuName, equalTo("New"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/new.html"))
+ }
+
}
assertThat(page.menuName, equalTo("Options"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/options.html"))
+ }
+
}
assertThat(page.menuName, equalTo("Rescue"))
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/rescue.html"))
+ }
+
}
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.utils.asOptional
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<SearchPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/search.html"))
+ }
+
}
import net.pterodactylus.sone.test.mockBuilder
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<UploadImagePage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/invalid.html"))
+ }
+
}
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.notNullValue
assertThat(baseInjector.getInstance<ViewPostPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/viewPost.html"))
+ }
+
}
import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.utils.asOptional
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.equalTo
assertThat(baseInjector.getInstance<ViewSonePage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/viewSone.html"))
+ }
+
}