diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8cfd288..43bcc93 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -30,6 +30,8 @@ module ApplicationHelper
include AccountHelper
+ include LayoutHelper
+
def locale
(@page && !@page.language.blank?) ? @page.language : FastGettext.locale
end
@@ -352,10 +354,6 @@ module ApplicationHelper
end
end
- def theme_stylesheet_path
- theme_path + '/style.css'
- end
-
def current_theme
@current_theme ||=
begin
@@ -873,14 +871,6 @@ module ApplicationHelper
content_tag('div', labelled_check_box(_('Public'), 'profile_data[fields_privacy]['+name+']', 'public', profile.public_fields.include?(name)), :class => 'field-privacy-selector')
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 login_url
options = Noosfero.url_options.merge({ :controller => 'account', :action => 'login' })
url_for(options)
@@ -919,18 +909,6 @@ module ApplicationHelper
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 page_title
(@page ? @page.title + ' - ' : '') +
(profile ? profile.short_name + ' - ' : '') +
@@ -942,40 +920,11 @@ module ApplicationHelper
(@category ? " - #{@category.full_name}" : '')
end
- def noosfero_javascript
- render :file => 'layouts/_javascript'
- end
-
- def noosfero_stylesheets
- [
- 'application',
- 'search',
- 'thickbox',
- 'lightbox',
- 'colorpicker',
- 'colorbox',
- pngfix_stylesheet_path,
- ] +
- tokeninput_stylesheets
- end
-
# DEPRECATED. Do not use thisĀ·
def import_controller_stylesheets(options = {})
stylesheet_import( "controller_"+ @controller.controller_name(), options )
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 link_to_email(email)
javascript_tag('var array = ' + email.split('@').to_json + '; document.write("" + array.join("@") + "")')
end
@@ -1018,10 +967,6 @@ module ApplicationHelper
theme_option(:jquery_theme) || 'smoothness_mod'
end
- def jquery_ui_theme_stylesheet_path
- 'jquery.ui/' + jquery_theme + '/jquery-ui-1.8.2.custom'
- end
-
def ui_error(message)
content_tag('div', ui_icon('ui-icon-alert') + message, :class => 'alert fg-state-error ui-state-error')
end
diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb
new file mode 100644
index 0000000..abcaa4b
--- /dev/null
+++ b/app/helpers/layout_helper.rb
@@ -0,0 +1,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
+
diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml
index 480e3f9..adc041d 100644
--- a/app/views/layouts/application-ng.rhtml
+++ b/app/views/layouts/application-ng.rhtml
@@ -8,15 +8,7 @@
<%= noosfero_javascript %>
- <%= stylesheet_link_tag noosfero_stylesheets, :cache => 'cache' %>
- <%= stylesheet_link_tag template_stylesheet_path %>
- <%= stylesheet_link_tag icon_theme_stylesheet_path %>
- <%= stylesheet_link_tag jquery_ui_theme_stylesheet_path %>
- <%
- plugins_stylesheets = @plugins.select(&:stylesheet?).map { |plugin| plugin.class.public_path('style.css') }
- %>
- <%= stylesheet_link_tag(plugins_stylesheets, :cache => 'cache/plugins-' + Digest::MD5.hexdigest(plugins_stylesheets.to_s)) unless plugins_stylesheets.empty? %>
- <%= stylesheet_link_tag theme_stylesheet_path %>
+ <%= noosfero_stylesheets %>
<%# Add custom tags/styles/etc via content_for %>
<%= yield :head %>
--
libgit2 0.21.2