Merge branch 'master' of https://github.com/karlbright/engine into karlbright-master
This commit is contained in:
commit
2f72d26d4c
@ -38,6 +38,16 @@ module Locomotive
|
||||
|
||||
asset_url(input)
|
||||
end
|
||||
|
||||
# Write a theme image tag
|
||||
# input: name of file including folder
|
||||
# example: 'about/myphoto.jpg' | theme_image # <img src="images/about/myphoto.jpg" />
|
||||
def theme_image_tag(input, *args)
|
||||
return '' if input.nil?
|
||||
input = "images/#{input}" unless input.starts_with?('/')
|
||||
image_options = inline_options(args_to_options(args))
|
||||
"<img src=\"#{asset_url(input)}\" #{image_options}/>"
|
||||
end
|
||||
|
||||
# Write an image tag
|
||||
# input: url of the image OR asset drop
|
||||
|
@ -44,6 +44,14 @@ describe Locomotive::Liquid::Filters::Html do
|
||||
javascript_tag('/trash/main.js').should == result
|
||||
javascript_tag('/trash/main').should == result
|
||||
end
|
||||
|
||||
it 'should return an image tag for a given theme file without parameters' do
|
||||
theme_image_tag('foo.jpg').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" />"
|
||||
end
|
||||
|
||||
it 'should return an image tag for a given theme file with size' do
|
||||
theme_image_tag('foo.jpg', 'width:100', 'height:100').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" height=\"100\" width=\"100\" />"
|
||||
end
|
||||
|
||||
it 'should return an image tag without parameters' do
|
||||
image_tag('foo.jpg').should == "<img src=\"foo.jpg\" />"
|
||||
|
Loading…
Reference in New Issue
Block a user