layout_helper.rb
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module LayoutHelper
def noosfero_javascript
render :file => 'layouts/_javascript'
end
def noosfero_stylesheets
standard_stylesheets = [
'application',
'search',
'thickbox',
'lightbox',
'colorpicker',
'colorbox',
pngfix_stylesheet_path,
] + tokeninput_stylesheets
plugins_stylesheets = @plugins.select(&:stylesheet?).map { |plugin| plugin.class.public_path('style.css') }
output = ''
output += stylesheet_link_tag standard_stylesheets, :cache => 'cache'
output += stylesheet_link_tag template_stylesheet_path
output += stylesheet_link_tag icon_theme_stylesheet_path
output += stylesheet_link_tag jquery_ui_theme_stylesheet_path
unless plugins_stylesheets.empty?
output += stylesheet_link_tag plugins_stylesheets, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugins_stylesheets.to_s}"
end
output += stylesheet_link_tag theme_stylesheet_path
output
end
def pngfix_stylesheet_path
'iepngfix/iepngfix.css'
end
def tokeninput_stylesheets
['token-input', 'token-input-facebook', 'token-input-mac', 'token-input-facet']
end
def noosfero_layout_features
render :file => 'shared/noosfero_layout_features'
end
def template_stylesheet_path
if profile.nil?
"/designs/templates/#{environment.layout_template}/stylesheets/style.css"
else
"/designs/templates/#{profile.layout_template}/stylesheets/style.css"
end
end
def icon_theme_stylesheet_path
icon_themes = []
theme_icon_themes = theme_option(:icon_theme) || []
for icon_theme in theme_icon_themes do
theme_path = "/designs/icons/#{icon_theme}/style.css"
if File.exists?(File.join(RAILS_ROOT, 'public', theme_path))
icon_themes << theme_path
end
end
icon_themes
end
def jquery_ui_theme_stylesheet_path
'jquery.ui/' + jquery_theme + '/jquery-ui-1.8.2.custom'
end
def theme_stylesheet_path
theme_path + '/style.css'
end
end