--- a/web/views/actions.py Mon Sep 28 10:55:36 2009 +0200
+++ b/web/views/actions.py Mon Sep 28 10:56:37 2009 +0200
@@ -9,7 +9,7 @@
_ = unicode
from cubicweb.appobject import objectify_selector
-from cubicweb.selectors import (EntitySelector,
+from cubicweb.selectors import (EntitySelector, yes,
one_line_rset, two_lines_rset, one_etype_rset, relation_possible,
nonempty_rset, non_final_entity,
authenticated_user, match_user_groups, match_search_state,
@@ -359,6 +359,18 @@
__select__ = match_user_groups('users','managers')
+class PoweredByAction(Action):
+ id = 'poweredby'
+ __select__ = yes()
+
+ category = 'footer'
+ order = 3
+ title = _('powered by CubicWeb')
+
+ def url(self):
+ return 'http://www.cubicweb.org'
+
+
from logilab.common.deprecation import class_moved
from cubicweb.web.views.bookmark import FollowAction
FollowAction = class_moved(FollowAction)
--- a/web/views/basetemplates.py Mon Sep 28 10:55:36 2009 +0200
+++ b/web/views/basetemplates.py Mon Sep 28 10:56:37 2009 +0200
@@ -425,14 +425,13 @@
def call(self, **kwargs):
req = self.req
self.w(u'<div class="footer">')
- # XXX Take object from the registry if in there? would be
- # better anyway
- from cubicweb.web.views.wdoc import ChangeLogView
- self.w(u'<a href="%s">%s</a> | ' % (req.build_url('changelog'),
- req._(ChangeLogView.title).lower()))
- self.w(u'<a href="%s">%s</a> | ' % (req.build_url('doc/about'),
- req._('about this site')))
- self.w(u'<a href="http://www.cubicweb.org">%s</a>' % req._('powered by CubicWeb'))
+ actions = self.vreg['actions'].possible_actions(self.req, rset=self.rset)
+ footeractions = actions.get('footer', ())
+ for i, action in enumerate(footeractions):
+ self.w(u'<a href="%s">%s</a>' % (action.url(),
+ self.req._(action.title)))
+ if i < (len(footeractions) - 1):
+ self.w(u' | ')
self.w(u'</div>')
--- a/web/views/wdoc.py Mon Sep 28 10:55:36 2009 +0200
+++ b/web/views/wdoc.py Mon Sep 28 10:56:37 2009 +0200
@@ -15,12 +15,11 @@
from logilab.common.changelog import ChangeLog
from logilab.mtconverter import CHARSET_DECL_RGX
-from cubicweb.selectors import match_form_params
+from cubicweb.selectors import match_form_params, yes
from cubicweb.view import StartupView
from cubicweb.utils import strptime, todate
from cubicweb.common.uilib import rest_publish
-from cubicweb.web import NotFound
-
+from cubicweb.web import NotFound, action
_ = unicode
# table of content management #################################################
@@ -235,3 +234,28 @@
break
w('') # blank line
self.w(rest_publish(self, '\n'.join(restdata)))
+
+
+class ChangeLogAction(action.Action):
+ id = 'changelog'
+ __select__ = yes()
+
+ category = 'footer'
+ order = 1
+ title = ChangeLogView.title
+
+ def url(self):
+ return self.req.build_url('changelog')
+
+
+class AboutAction(action.Action):
+ id = 'about'
+ __select__ = yes()
+
+ category = 'footer'
+ order = 2
+ title = _('about this site')
+
+ def url(self):
+ return self.req.build_url('doc/about')
+