Sha256: 68cb8a8e278138b0164d53d690503004532cef7f17fe2480b731cb3fac8b9cc7

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

# encoding: utf-8
module ThemesForRails
  
  module ActionView

    extend ActiveSupport::Concern

    included do
      include ThemesForRails::CommonMethods
    end

    def current_theme_stylesheet_path(asset)
      base_theme_stylesheet_path(:theme => self.theme_name, :asset => "#{asset}.css")
    end
    
    def current_theme_javascript_path(asset)
      base_theme_javascript_path(:theme => self.theme_name, :asset => "#{asset}.js")
    end

    def current_theme_image_path(asset)
      base_theme_image_path(:theme => self.theme_name, :asset => asset)
    end

    def theme_stylesheet_path(asset, new_theme_name = self.theme_name)
      base_theme_stylesheet_path(:theme => new_theme_name, :asset => "#{asset}.css")
    end

    def theme_javascript_path(asset, new_theme_name = self.theme_name)
      base_theme_javascript_path(:theme => new_theme_name, :asset => "#{asset}.js")
    end

    def theme_image_path(asset, new_theme_name = self.theme_name)
      base_theme_image_path(:theme => new_theme_name, :asset => asset)
    end
    
    def theme_image_tag(source, options = {})
      image_tag(theme_image_path(source), options)
    end

    def theme_image_submit_tag(source, options = {})
      image_submit_tag(theme_image_path(source), options)
    end

    def theme_javascript_include_tag(*files)
      options = files.extract_options!
      options.merge!({ :type => "text/javascript" })
      files.collect! {|file| theme_javascript_path(file) }
      javascript_include_tag(*files, options)
    end

    def theme_stylesheet_link_tag(*files)
      options = files.extract_options!
      options.merge!({ :type => "text/css" })
      files.collect! {|file| theme_stylesheet_path(file) }
      stylesheet_link_tag(*files, options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
themes_for_rails-0.5.0 lib/themes_for_rails/action_view.rb
themes_for_rails-0.5.0.pre lib/themes_for_rails/action_view.rb