# HG changeset patch # User Nicolas Chauvat # Date 1272523153 -7200 # Node ID 2d5c46e78ae96e129d8285eef1116e6cad5a6fde # Parent ee87c5352e636f37982d2689cfb592ed07376cfa [css] introducing scale and rhythm composition diff -r ee87c5352e63 -r 2d5c46e78ae9 selectors.py --- a/selectors.py Wed May 05 18:10:33 2010 +0200 +++ b/selectors.py Thu Apr 29 08:39:13 2010 +0200 @@ -1288,6 +1288,10 @@ return None super(is_in_state, self).__init__(score) +@objectify_selector +def debug_mode(cls, req, rset=None, **kwargs): + """Return 1 if running in debug mode""" + return req.vreg.config.debugmode and 1 or 0 ## deprecated stuff ############################################################ diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/cubicweb.css --- a/web/data/cubicweb.css Wed May 05 18:10:33 2010 +0200 +++ b/web/data/cubicweb.css Thu Apr 29 08:39:13 2010 +0200 @@ -8,6 +8,8 @@ /* xhtml tags */ /***************************************/ +.rhythm_bg { background: url(/data/rhythm20.png) repeat ! important; } + html, body { background: #e2e2e2; } diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/cubicweb.rhythm.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/data/cubicweb.rhythm.js Thu Apr 29 08:39:13 2010 +0200 @@ -0,0 +1,6 @@ +$(document).ready(function() { + $('a.rhythm').click(function (event){ + $('div#pageContent').toggleClass('rhythm_bg'); + event.preventDefault(); + }); + }); diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm15.png Binary file web/data/rhythm15.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm18.png Binary file web/data/rhythm18.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm20.png Binary file web/data/rhythm20.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm22.png Binary file web/data/rhythm22.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm24.png Binary file web/data/rhythm24.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/data/rhythm26.png Binary file web/data/rhythm26.png has changed diff -r ee87c5352e63 -r 2d5c46e78ae9 web/views/actions.py --- a/web/views/actions.py Wed May 05 18:10:33 2010 +0200 +++ b/web/views/actions.py Thu Apr 29 08:39:13 2010 +0200 @@ -29,7 +29,7 @@ one_line_rset, multi_lines_rset, one_etype_rset, relation_possible, nonempty_rset, non_final_entity, authenticated_user, match_user_groups, match_search_state, - has_permission, has_add_permission, implements, + has_permission, has_add_permission, implements, debug_mode, ) from cubicweb.web import uicfg, controller, action from cubicweb.web.views import linksearch_select_url, vid_from_rset @@ -412,6 +412,21 @@ def url(self): return 'http://www.cubicweb.org' +class GotRhythmAction(action.Action): + __regid__ = 'rhythm' + __select__ = debug_mode() + + category = 'footer' + order = 3 + title = _('Got rhythm?') + + def url(self): + from logilab.mtconverter import xml_escape + return xml_escape(self._cw.url()+'#') + + def html_class(self): + self._cw.add_js('cubicweb.rhythm.js') + return 'rhythm' ## default actions ui configuration ########################################### diff -r ee87c5352e63 -r 2d5c46e78ae9 web/views/basetemplates.py --- a/web/views/basetemplates.py Wed May 05 18:10:33 2010 +0200 +++ b/web/views/basetemplates.py Thu Apr 29 08:39:13 2010 +0200 @@ -394,8 +394,10 @@ rset=self.cw_rset) footeractions = actions.get('footer', ()) for i, action in enumerate(footeractions): - self.w(u'%s' % (action.url(), - self._cw._(action.title))) + self.w(u'%s' % self._cw._(action.title)) if i < (len(footeractions) - 1): self.w(u' | ') self.w(u'')