theme_support 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -149,6 +149,8 @@ The theme_support plugin includes patches from the following:
149
149
  Thanks guys!
150
150
 
151
151
  == Changelog
152
+ 3.0.5 - html_safe on helpers, Theme model and controller become Themesupport model and controller
153
+
152
154
  3.0.4 - [BUG] override view when we use explicitely render
153
155
 
154
156
  3.0.3 - Hack which uses layout theme but crashes if it doesn't exist ! Now it loads the default layout
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.4
1
+ 3.0.5
@@ -5,19 +5,19 @@ module ActionView::Helpers::AssetTagHelper
5
5
  # returns the public path to a theme stylesheet
6
6
  def theme_stylesheet_path( source=nil, theme=nil )
7
7
  theme = theme || controller.current_theme
8
- compute_public_path(source || "theme", "themes/#{theme}/stylesheets", 'css')
8
+ compute_public_path(source || "theme", "themes/#{theme}/stylesheets", 'css').html_safe
9
9
  end
10
10
 
11
11
  # returns the path to a theme image
12
12
  def theme_image_path( source, theme=nil )
13
13
  theme = theme || controller.current_theme
14
- compute_public_path(source, "themes/#{theme}/images", 'png')
14
+ compute_public_path(source, "themes/#{theme}/images", 'png').html_safe
15
15
  end
16
16
 
17
17
  # returns the path to a theme javascript
18
18
  def theme_javascript_path( source, theme=nil )
19
19
  theme = theme || controller.current_theme
20
- compute_public_path(source, "themes/#{theme}/javascripts", 'js')
20
+ compute_public_path(source, "themes/#{theme}/javascripts", 'js').html_safe
21
21
  end
22
22
 
23
23
  # This tag it will automatially include theme specific css files
@@ -27,7 +27,7 @@ module ActionView::Helpers::AssetTagHelper
27
27
  sources.collect { |source|
28
28
  source = theme_stylesheet_path(source)
29
29
  tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => source }.merge(options))
30
- }.join("\n")
30
+ }.join("\n").html_safe
31
31
  end
32
32
 
33
33
  # This tag will return a theme-specific IMG
@@ -42,7 +42,7 @@ module ActionView::Helpers::AssetTagHelper
42
42
  options.delete :size
43
43
  end
44
44
 
45
- tag("img", options)
45
+ tag("img", options).html_safe
46
46
  end
47
47
 
48
48
  # This tag can be used to return theme-specific javscripts
@@ -58,6 +58,6 @@ module ActionView::Helpers::AssetTagHelper
58
58
  sources.collect { |source|
59
59
  source = theme_javascript_path(source)
60
60
  content_tag("script", "", { "type" => "text/javascript", "src" => source }.merge(options))
61
- }.join("\n")
61
+ }.join("\n").html_safe
62
62
  end
63
63
  end
@@ -1,11 +1,11 @@
1
1
  module ThemeSupport
2
2
  module RoutingExtensions
3
3
  def themeing
4
- @set.with_options :controller => 'theme' do |theme|
5
- match '/themes/:theme/images/*filename', :to => 'theme#images', :as => 'theme_images'
6
- match '/themes/:theme/stylesheets/*filename', :to => 'theme#stylesheets', :as => 'theme_stylesheets'
7
- match '/themes/:theme/javascripts/*filename', :to => 'theme#javascript', :as => 'theme_javascript'
8
- match '/themes/*whatever', :to => 'theme#error'
4
+ @set.with_options :controller => 'themesupport' do |theme|
5
+ match '/themes/:theme/images/*filename', :to => 'themesupport#images', :as => 'theme_images'
6
+ match '/themes/:theme/stylesheets/*filename', :to => 'themesupport#stylesheets', :as => 'theme_stylesheets'
7
+ match '/themes/:theme/javascripts/*filename', :to => 'themesupport#javascript', :as => 'theme_javascript'
8
+ match '/themes/*whatever', :to => 'themesupport#error'
9
9
  end
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
- class Theme
1
+ class Themesupport
2
2
  cattr_accessor :cache_theme_lookup
3
3
  @@cache_theme_lookup = false
4
4
 
@@ -12,13 +12,13 @@ class Theme
12
12
 
13
13
  def description
14
14
  if @description_html.nil?
15
- @description_html = RedCloth.new(File.read( File.join(Theme.path_to_theme(name), "about.markdown") )).to_html(:markdown, :textile) rescue "#{title}"
15
+ @description_html = RedCloth.new(File.read( File.join(Themesupport.path_to_theme(name), "about.markdown") )).to_html(:markdown, :textile) rescue "#{title}"
16
16
  end
17
17
  @description_html
18
18
  end
19
19
 
20
20
  def has_preview?
21
- File.exists?( File.join( Theme.path_to_theme(name), 'images', 'preview.png' ) ) rescue false
21
+ File.exists?( File.join( Themesupport.path_to_theme(name), 'images', 'preview.png' ) ) rescue false
22
22
  end
23
23
 
24
24
  def preview_image
@@ -1,6 +1,6 @@
1
1
  # The controller for serving/cacheing theme content...
2
2
  #
3
- class ThemeController < ActionController::Base
3
+ class ThemesupportController < ActionController::Base
4
4
 
5
5
  after_filter :cache_theme_files
6
6
 
@@ -24,13 +24,13 @@ class ThemeController < ActionController::Base
24
24
 
25
25
  def render_theme_item(type, file, theme, mime = mime_for(file))
26
26
  render :text => "Not Found", :status => 404 and return if file.split(%r{[\\/]}).include?("..")
27
- send_file "#{Theme.path_to_theme(theme)}/#{type}/#{file}", :type => mime, :content_type => mime, :disposition => 'inline'
27
+ send_file "#{Themesupport.path_to_theme(theme)}/#{type}/#{file}", :type => mime, :content_type => mime, :disposition => 'inline'
28
28
  end
29
29
 
30
30
  def cache_theme_files
31
31
  path = request.fullpath
32
32
  begin
33
- ThemeController.cache_page( response.body, path )
33
+ ThemesupportController.cache_page( response.body, path )
34
34
  rescue
35
35
  STERR.puts "Cache Exception: #{$!}"
36
36
  end
@@ -1,4 +1,4 @@
1
1
  # <tt>ThemeError</tt> is thrown when <tt>force_liquid</tt> is true, and
2
2
  # a <tt>.liquid</tt> template isn't found.
3
- class ThemeError < StandardError
3
+ class ThemesupportError < StandardError
4
4
  end
@@ -1,3 +1,3 @@
1
1
  # this is here so that Rails doesn't complain about a missing default helper...
2
- module ThemeHelper
3
- end
2
+ module ThemesupportHelper
3
+ end
data/lib/theme_support.rb CHANGED
@@ -2,8 +2,8 @@
2
2
  require 'theme_support/railtie'
3
3
 
4
4
  # Load the Theme model and ThemeController
5
- require 'theme_support/theme'
6
- require 'theme_support/theme_controller'
5
+ require 'theme_support/themesupport'
6
+ require 'theme_support/themesupport_controller'
7
7
 
8
8
  # Initializes theme support by extending some of the core Rails classes
9
9
  require 'theme_support/patches/abstractcontroller_ex'
@@ -5,7 +5,7 @@ spec = Gem::Specification.new do |s|
5
5
  s.name = 'theme_support'
6
6
  s.author = 'Pierre Yager and Sylvain Claudel'
7
7
  s.email = "pierre@levosgien.net"
8
- s.version = ("$Release: 3.0.4" =~ /[\.\d]+/) && $&
8
+ s.version = ("$Release: 3.0.5" =~ /[\.\d]+/) && $&
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.homepage = 'http://github.com/zedalaye/theme_support'
11
11
  s.rubyforge_project = 'theme-support'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme_support
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 4
10
- version: 3.0.4
9
+ - 5
10
+ version: 3.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pierre Yager and Sylvain Claudel
@@ -41,12 +41,12 @@ files:
41
41
  - lib/theme_support/patches/abstractcontroller_ex.rb
42
42
  - lib/theme_support/patches/routeset_ex.rb
43
43
  - lib/theme_support/patches/actionmailer_ex.rb
44
- - lib/theme_support/theme_controller.rb
45
- - lib/theme_support/theme_helper.rb
44
+ - lib/theme_support/themesupport.rb
45
+ - lib/theme_support/themesupport_error.rb
46
+ - lib/theme_support/themesupport_helper.rb
46
47
  - lib/theme_support/tasks.rb
47
- - lib/theme_support/theme.rb
48
48
  - lib/theme_support/railtie.rb
49
- - lib/theme_support/theme_error.rb
49
+ - lib/theme_support/themesupport_controller.rb
50
50
  - lib/theme_support/helpers/erb_theme_tags.rb
51
51
  - lib/theme_support/helpers/liquid_theme_tags.rb
52
52
  - Gemfile