Rename “add friend” action to “follow Sone” for now.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / WebInterface.java
index e85b066..a05cd31 100644 (file)
@@ -29,8 +29,10 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.L10nFilter;
 import net.pterodactylus.sone.main.SonePlugin;
+import net.pterodactylus.sone.template.SoneAccessor;
 import net.pterodactylus.sone.web.page.CSSPage;
 import net.pterodactylus.sone.web.page.PageToadlet;
 import net.pterodactylus.sone.web.page.PageToadletFactory;
@@ -140,6 +142,7 @@ public class WebInterface extends AbstractService {
        private void registerToadlets() {
                DefaultTemplateFactory templateFactory = new DefaultTemplateFactory();
                templateFactory.addAccessor(Object.class, new ReflectionAccessor());
+               templateFactory.addAccessor(Sone.class, new SoneAccessor());
                templateFactory.addFilter("date", new DateFilter());
                templateFactory.addFilter("l10n", new L10nFilter(l10n()));
 
@@ -160,6 +163,12 @@ public class WebInterface extends AbstractService {
                Template editProfileTemplate = templateFactory.createTemplate(createReader("/templates/editProfile.html"));
                editProfileTemplate.set("formPassword", formPassword);
 
+               Template viewSoneTemplate = templateFactory.createTemplate(createReader("/templates/viewSone.html"));
+               viewSoneTemplate.set("formPassword", formPassword);
+
+               Template followSoneTemplate = templateFactory.createTemplate(createReader("/templates/addFriend.html"));
+               followSoneTemplate.set("formPassword", formPassword);
+
                Template deleteSoneTemplate = templateFactory.createTemplate(createReader("/templates/deleteSone.html"));
                deleteSoneTemplate.set("formPassword", formPassword);
 
@@ -170,6 +179,8 @@ public class WebInterface extends AbstractService {
                pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateSonePage(createSoneTemplate, this), "CreateSone"));
                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"));