Move method to parent class so that it's available to siblings.

This commit is contained in:
Pietro Giorgianni 2012-02-15 17:22:14 +01:00
parent a8b00b247b
commit 3ba89666a7
2 changed files with 14 additions and 14 deletions

View File

@ -41,6 +41,20 @@ module Locomotive
def open_sample_asset(url)
File.open(File.join(self.theme_path, 'public', url))
end
def replace_images!(template)
return if template.blank?
template.gsub!(/\/samples\/(.*\.[a-zA-Z0-9]{3})/) do |match|
name = File.basename($1)
if asset = site.assets.where(:source_filename => name).first
asset.source.url
else
match
end
end
end
end
end
end

View File

@ -147,20 +147,6 @@ module Locomotive
parent || self.add_page(parent_fullpath)
end
def replace_images!(template)
return if template.blank?
template.gsub!(/\/samples\/(.*\.[a-zA-Z0-9]{3})/) do |match|
name = File.basename($1)
if asset = site.assets.where(:source_filename => name).first
asset.source.url
else
match
end
end
end
def pages
@pages ||= self.retrieve_pages
end