Move method to parent class so that it's available to siblings.
This commit is contained in:
parent
a8b00b247b
commit
3ba89666a7
@ -41,6 +41,20 @@ module Locomotive
|
|||||||
def open_sample_asset(url)
|
def open_sample_asset(url)
|
||||||
File.open(File.join(self.theme_path, 'public', url))
|
File.open(File.join(self.theme_path, 'public', url))
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
@ -147,20 +147,6 @@ module Locomotive
|
|||||||
parent || self.add_page(parent_fullpath)
|
parent || self.add_page(parent_fullpath)
|
||||||
end
|
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
|
def pages
|
||||||
@pages ||= self.retrieve_pages
|
@pages ||= self.retrieve_pages
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user