Switch to side-by-side view

--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -18,7 +18,7 @@
 from pyforge.lib.search import search
 from pyforge.lib.decorators import audit, react
 from pyforge.lib.security import require, has_artifact_access
-from pyforge.model import ProjectRole, User
+from pyforge.model import ProjectRole, User, TagEvent, UserTags
 
 # Local imports
 from forgewiki import model
@@ -218,7 +218,8 @@
             require(has_artifact_access('create', self.page))
         else:
             require(has_artifact_access('edit', self.page))
-        return dict(page=self.page)
+        user_tags = UserTags.upsert(c.user, self.page.dump_ref())
+        return dict(page=self.page, user_tags=user_tags)
 
     @expose('forgewiki.templates.page_history')
     def history(self):
@@ -260,10 +261,14 @@
         redirect('.')
 
     @expose()
-    def update(self, text):
+    def update(self, text, tags, tags_old):
+        tags = tags.split(',')
         require(has_artifact_access('edit', self.page))
         self.page.text = text
         self.page.commit()
+        user_tags = UserTags.upsert(c.user, self.page.dump_ref())
+        TagEvent.remove(self.page, [tag.tag for tag in user_tags.tags if tag.tag not in tags])
+        TagEvent.add(self.page, [t for t in tags if t not in [tag.tag for tag in user_tags.tags]])
         redirect('.')
 
     @expose()