|
a/Allura/allura/controllers/project.py |
|
b/Allura/allura/controllers/project.py |
|
... |
|
... |
177 |
response.headers['Content-Type'] = ''
|
177 |
response.headers['Content-Type'] = ''
|
178 |
response.content_type = fp.content_type.encode('utf-8')
|
178 |
response.content_type = fp.content_type.encode('utf-8')
|
179 |
return fp.read()
|
179 |
return fp.read()
|
180 |
return icon.filename
|
180 |
return icon.filename
|
181 |
|
181 |
|
182 |
@expose()
|
182 |
@expose('jinja:jinja_master/site_style.css', content_type='text/css')
|
183 |
@without_trailing_slash
|
183 |
@without_trailing_slash
|
184 |
def site_style(self):
|
184 |
def site_style(self):
|
185 |
"""Display the css for the default theme."""
|
185 |
"""Display the css for the default theme."""
|
186 |
theme = M.Theme.query.find(dict(neighborhood_id=self.neighborhood._id)).first()
|
186 |
theme = M.Theme.query.find(dict(neighborhood_id=self.neighborhood._id)).first()
|
187 |
if theme == None:
|
187 |
if theme == None:
|
188 |
theme = M.Theme.query.find(dict(name='forge_default')).first()
|
188 |
theme = M.Theme.query.find(dict(name='forge_default')).first()
|
189 |
|
189 |
|
190 |
colors = dict(color1=theme.color1,
|
|
|
191 |
color2=theme.color2,
|
|
|
192 |
color3=theme.color3,
|
|
|
193 |
color4=theme.color4,
|
|
|
194 |
color5=theme.color5,
|
|
|
195 |
color6=theme.color6,
|
|
|
196 |
g=g)
|
|
|
197 |
tpl_fn = pkg_resources.resource_filename(
|
|
|
198 |
'allura', 'templates/style.css')
|
|
|
199 |
css = h.render_genshi_plaintext(tpl_fn,**colors)
|
|
|
200 |
if self.neighborhood.css:
|
|
|
201 |
tt = genshi.template.NewTextTemplate(self.neighborhood.css)
|
|
|
202 |
stream = tt.generate(**colors)
|
|
|
203 |
css = css + stream.render(encoding='utf-8').decode('utf-8')
|
|
|
204 |
response.headers['Content-Type'] = ''
|
190 |
response.headers['Content-Type'] = ''
|
205 |
response.content_type = 'text/css'
|
191 |
response.content_type = 'text/css'
|
|
|
192 |
|
206 |
return css
|
193 |
return dict(
|
|
|
194 |
color1=theme.color1,
|
|
|
195 |
color2=theme.color2,
|
|
|
196 |
color3=theme.color3,
|
|
|
197 |
color4=theme.color4,
|
|
|
198 |
color5=theme.color5,
|
|
|
199 |
color6=theme.color6,
|
|
|
200 |
g=g,
|
|
|
201 |
extra_css=self.neighborhood.css or '')
|
207 |
|
202 |
|
208 |
class NeighborhoodProjectBrowseController(ProjectBrowseController):
|
203 |
class NeighborhoodProjectBrowseController(ProjectBrowseController):
|
209 |
def __init__(self, neighborhood=None, category_name=None, parent_category=None):
|
204 |
def __init__(self, neighborhood=None, category_name=None, parent_category=None):
|
210 |
self.neighborhood = neighborhood
|
205 |
self.neighborhood = neighborhood
|
211 |
super(NeighborhoodProjectBrowseController, self).__init__(category_name=category_name, parent_category=parent_category)
|
206 |
super(NeighborhoodProjectBrowseController, self).__init__(category_name=category_name, parent_category=parent_category)
|