module Knitkit::Extensions::ActionController::ThemeSupport::ActsAsThemedController::InstanceMethods
Public Instance Methods
add_theme_view_paths()
click to toggle source
# File lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb, line 40 def add_theme_view_paths ThemeSupport::Cache.theme_resolvers = [] if ThemeSupport::Cache.theme_resolvers.nil? if respond_to?(:current_theme_paths) current_theme_paths.each do |theme| resolver = case Rails.application.config.erp_tech_svcs.file_storage when :s3 path = File.join(theme[:url], "templates") cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path } if cached_resolver.nil? resolver = ActionView::S3Resolver.new(path) ThemeSupport::Cache.theme_resolvers << resolver resolver else cached_resolver end when :filesystem path = "#{theme[:path]}/templates" cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path } if cached_resolver.nil? resolver = ActionView::CompassAeFileResolver.new(path) ThemeSupport::Cache.theme_resolvers << resolver resolver else cached_resolver end end prepend_view_path(resolver) end end end
allowed_template_type?(ext)
click to toggle source
# File lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb, line 80 def allowed_template_type?(ext) force_template_types.blank? || force_template_types.include?(ext) end
current_theme_paths()
click to toggle source
# File lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb, line 71 def current_theme_paths current_themes ? current_themes.map { |theme| {:path => theme.path.to_s, :url => theme.url.to_s} } : [] end
current_themes()
click to toggle source
# File lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb, line 30 def current_themes # the lambda broke in rails 3.2, changing this to an instance variable @current_themes ||= self.website.themes.collect{|t| t if t.active == 1}.compact rescue [] # @current_themes ||= case accessor = self.class.read_inheritable_attribute(:current_themes) # when Symbol then accessor == :current_themes ? raise("screwed") : send(accessor) # when Proc then accessor.call(self) # else accessor # end end