Skip to content

Commit

Permalink
Fixing DEPRECATION WARNING: The InstanceMethods module inside ActiveS…
Browse files Browse the repository at this point in the history
…upport::Concern will be no longer included automatically. Please define instance methods directly in ActionView::Base instead.
  • Loading branch information
lucasefe committed Jan 27, 2012
1 parent a934eb4 commit ba4b897
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 60 deletions.
6 changes: 2 additions & 4 deletions lib/themes_for_rails/controller_methods.rb
Expand Up @@ -12,10 +12,8 @@ def theme(name, options = {})
end
end
end
module InstanceMethods
def theme(name)
set_theme(name)
end
def theme(name)
set_theme(name)
end
end
end
Expand Down
11 changes: 4 additions & 7 deletions lib/themes_for_rails/mailer_methods.rb
Expand Up @@ -6,14 +6,11 @@ module MailerMethods
alias_method_chain :mail, :theme
end

module InstanceMethods
def mail_with_theme(headers = {}, &block)
theme_opts = headers[:theme] || self.class.default[:theme]
theme(theme_opts) if theme_opts

def mail_with_theme(headers = {}, &block)
theme_opts = headers[:theme] || self.class.default[:theme]
theme(theme_opts) if theme_opts

mail_without_theme(headers, &block)
end
mail_without_theme(headers, &block)
end
end
end
Expand Down
21 changes: 10 additions & 11 deletions lib/themes_for_rails/url_helpers.rb
Expand Up @@ -7,17 +7,16 @@ module UrlHelpers
:current_theme_javascript_path,
:current_theme_image_path
end
module InstanceMethods
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)
image, extension = asset.split(".")
base_theme_image_path(:theme => self.theme_name, :asset => "#{image}.#{extension}")
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)
image, extension = asset.split(".")
base_theme_image_path(:theme => self.theme_name, :asset => "#{image}.#{extension}")
end
end
end
74 changes: 36 additions & 38 deletions lib/themes_for_rails/view_helpers.rb
Expand Up @@ -6,44 +6,42 @@ module ViewHelpers
included do
include ThemesForRails::CommonMethods
end
module InstanceMethods
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_javascript_include_tag(*files)
files.collect! {|file| theme_javascript_path(file) }
javascript_include_tag *files
end

def theme_stylesheet_link_tag(*files)
options = files.extract_options!
files.collect! {|file| theme_stylesheet_path(file) }
files << options
stylesheet_link_tag(*files)
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_javascript_include_tag(*files)
files.collect! {|file| theme_javascript_path(file) }
javascript_include_tag *files
end

def theme_stylesheet_link_tag(*files)
options = files.extract_options!
files.collect! {|file| theme_stylesheet_path(file) }
files << options
stylesheet_link_tag(*files)
end
end
end
Expand Down

0 comments on commit ba4b897

Please sign in to comment.