Sha256: ad646e8dbda6f1ee8a1d49083702c5e9e835190abfcdb979728846c13169d488

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 Bytes

Contents

module ThemeHelper

  # NB: This overrides an undocumented rails function in order to add
  # a search path. We need this to get themes working, but I'd be
  # happier if we didn't have to override undocumented methods. Ho
  # hum. -- pdcawley

  def search_paths
    ["../themes/#{this_blog.theme}/views",     # for components
     "../../themes/#{this_blog.theme}/views",  # for normal views
     ".",
     "../app/views"]
  end

  def full_template_path(template_path, extension)
    search_paths.each do |path|
      themed_path = File.join(@base_path, path, "#{template_path}.#{extension}")
      return themed_path if File.exist?(themed_path)
    end
    # Can't find a themed version, so fall back to the default behaviour
    super
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
typo-3.99.0 app/helpers/theme_helper.rb
typo-3.99.3 app/helpers/theme_helper.rb
typo-3.99.2 app/helpers/theme_helper.rb
typo-3.99.1 app/helpers/theme_helper.rb
typo-4.0.2 app/helpers/theme_helper.rb
typo-3.99.4 app/helpers/theme_helper.rb
typo-4.0.1 app/helpers/theme_helper.rb
typo-4.0.0 app/helpers/theme_helper.rb
typo-4.0.3 app/helpers/theme_helper.rb
typo-4.1.1 app/helpers/theme_helper.rb
typo-4.1 app/helpers/theme_helper.rb