|
a/Allura/allura/controllers/static.py |
|
b/Allura/allura/controllers/static.py |
|
... |
|
... |
5 |
from tg.decorators import with_trailing_slash, without_trailing_slash
|
5 |
from tg.decorators import with_trailing_slash, without_trailing_slash
|
6 |
from webob import exc
|
6 |
from webob import exc
|
7 |
|
7 |
|
8 |
from pylons import c, g
|
8 |
from pylons import c, g
|
9 |
from allura.lib import helpers as h
|
9 |
from allura.lib import helpers as h
|
|
|
10 |
from allura.lib import utils
|
10 |
from allura import model as M
|
11 |
from allura import model as M
|
11 |
|
12 |
|
12 |
class NewForgeController(object):
|
13 |
class NewForgeController(object):
|
13 |
|
14 |
|
14 |
@expose()
|
15 |
@expose('jinja:jinja_master/site_style.css', content_type='text/css')
|
15 |
@without_trailing_slash
|
16 |
@without_trailing_slash
|
16 |
def site_style(self):
|
17 |
def site_style(self, **kw):
|
17 |
"""Display the css for the default theme."""
|
18 |
"""Display the css for the default theme."""
|
18 |
theme = M.Theme.query.find(dict(name='forge_default')).first()
|
19 |
theme = M.Theme.query.find(dict(name='forge_default')).first()
|
19 |
colors = dict(color1=theme.color1,
|
|
|
20 |
color2=theme.color2,
|
|
|
21 |
color3=theme.color3,
|
|
|
22 |
color4=theme.color4,
|
|
|
23 |
color5=theme.color5,
|
|
|
24 |
color6=theme.color6,
|
|
|
25 |
g=g)
|
|
|
26 |
tpl_fn = pkg_resources.resource_filename(
|
|
|
27 |
'allura', 'templates/style.css')
|
|
|
28 |
css = h.render_genshi_plaintext(tpl_fn,**colors)
|
|
|
29 |
response.headers['Content-Type'] = ''
|
20 |
response.headers['Content-Type'] = ''
|
30 |
response.content_type = 'text/css'
|
21 |
response.content_type = 'text/css'
|
|
|
22 |
utils.cache_forever()
|
31 |
return css
|
23 |
return dict(
|
|
|
24 |
color1=theme.color1,
|
|
|
25 |
color2=theme.color2,
|
|
|
26 |
color3=theme.color3,
|
|
|
27 |
color4=theme.color4,
|
|
|
28 |
color5=theme.color5,
|
|
|
29 |
color6=theme.color6,
|
|
|
30 |
g=g,
|
|
|
31 |
extra_css='')
|
32 |
|
32 |
|
33 |
@expose()
|
33 |
@expose()
|
34 |
@without_trailing_slash
|
34 |
@without_trailing_slash
|
35 |
def markdown_to_html(self, markdown, project=None, app=None):
|
35 |
def markdown_to_html(self, markdown, project=None, app=None):
|
36 |
"""Convert markdown to html."""
|
36 |
"""Convert markdown to html."""
|