Missing code in parser for displaying image in the fornt-end

This commit is contained in:
chris2tof 2011-11-19 23:11:49 +08:00
parent ad9f9bbf5c
commit 2754f49fe9
1 changed files with 5 additions and 3 deletions

View File

@ -81,9 +81,11 @@ module Parser
res
end
c.define_tag 'image' do |tag|
asset = Asset.find(tag.attr['id'])
if asset
res = "<img src=#{asset.data.file.url} "
image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
image = page.design.images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
if image
res = "<img src=#{image.file.url} "
tag.attr.each do |l|
res << "#{l[0]}='#{l[1]}' "
end