import java.util.logging.Logger;
import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.L10nFilter;
import net.pterodactylus.sone.main.SonePlugin;
-import net.pterodactylus.sone.web.page.CSSPage;
+import net.pterodactylus.sone.template.PostAccessor;
+import net.pterodactylus.sone.template.SoneAccessor;
import net.pterodactylus.sone.web.page.PageToadlet;
import net.pterodactylus.sone.web.page.PageToadletFactory;
+import net.pterodactylus.sone.web.page.StaticPage;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.service.AbstractService;
import net.pterodactylus.util.template.DateFilter;
private void registerToadlets() {
DefaultTemplateFactory templateFactory = new DefaultTemplateFactory();
templateFactory.addAccessor(Object.class, new ReflectionAccessor());
+ templateFactory.addAccessor(Sone.class, new SoneAccessor());
+ templateFactory.addAccessor(Post.class, new PostAccessor(core()));
templateFactory.addFilter("date", new DateFilter());
templateFactory.addFilter("l10n", new L10nFilter(l10n()));
Template viewSoneTemplate = templateFactory.createTemplate(createReader("/templates/viewSone.html"));
viewSoneTemplate.set("formPassword", formPassword);
+ Template followSoneTemplate = templateFactory.createTemplate(createReader("/templates/followSone.html"));
+ followSoneTemplate.set("formPassword", formPassword);
+
Template deleteSoneTemplate = templateFactory.createTemplate(createReader("/templates/deleteSone.html"));
deleteSoneTemplate.set("formPassword", formPassword);
pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CreatePostPage(createPostTemplate, this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new ViewSonePage(viewSoneTemplate, this)));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new FollowSonePage(followSoneTemplate, this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new DeleteSonePage(deleteSoneTemplate, this), "DeleteSone"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new LoginPage(loginTemplate, this), "Login"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(logoutTemplate, this), "Logout"));
- pageToadlets.add(pageToadletFactory.createPageToadlet(new CSSPage("css/", "/static/css/")));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new StaticPage("css/", "/static/css/", "text/css")));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new StaticPage("javascript/", "/static/javascript/", "text/javascript")));
ToadletContainer toadletContainer = sonePlugin.pluginRespirator().getToadletContainer();
toadletContainer.getPageMaker().addNavigationCategory("/Sone/index.html", "Navigation.Menu.Name", "Navigation.Menu.Tooltip", sonePlugin);