Switch to side-by-side view

--- a/ForgeHg/forgehg/hg_main.py
+++ b/ForgeHg/forgehg/hg_main.py
@@ -25,7 +25,7 @@
 from pymongo.bson import ObjectId
 
 # Pyforge-specific imports
-from pyforge.app import Application, ConfigOption, SitemapEntry
+from pyforge.app import Application, ConfigOption, SitemapEntry, DefaultAdminController
 from pyforge.lib.helpers import push_config, DateTimeConverter, mixin_reactors
 from pyforge.lib.search import search
 from pyforge.lib.decorators import audit, react
@@ -51,6 +51,7 @@
     def __init__(self, project, config):
         Application.__init__(self, project, config)
         self.root = RootController()
+        self.admin = HgAdminController(self)
 
     @property
     def sitemap(self):
@@ -60,10 +61,12 @@
                 SitemapEntry(menu_id, '.')[self.sidebar_menu()] ]
 
     def admin_menu(self):
-        return []
+        return super(ForgeHgApp, self).admin_menu()
 
     def sidebar_menu(self):
         links = [ SitemapEntry('Home',c.app.url, ui_icon='home') ]
+        if has_artifact_access('admin', app=c.app)():
+            links.append(SitemapEntry('Admin', c.project.url()+'admin/'+self.config.options.mount_point, ui_icon='wrench'))
         repo = c.app.repo
         if repo and repo.status == 'ready':
             branches= repo.branchmap().keys()
@@ -123,6 +126,14 @@
         model.HgRepository.query.remove(dict(app_config_id=self.config._id))
         super(ForgeHgApp, self).uninstall(project_id=data['project_id'])
 
+
+class HgAdminController(DefaultAdminController):
+
+    @with_trailing_slash
+    def index(self):
+        redirect('permissions')
+
+
 class RootController(object):
 
     @expose('forgehg.templates.index')