tags: image and css - show ID in assets/index
This commit is contained in:
1 parent
49e6509a51
commit
25752b7065
4 files changed
+22
No files matched your search
@@ -54,6 +54,24 @@ module Parser
|
||||
tag.attr[I18n.locale.to_s] rescue nil
|
||||
end
|
||||
end
|
||||
c.define_tag 'css' do |tag|
|
||||
assets = Asset.any_in(:filename => tag.attr['name'].split(',').map(&:strip))
|
||||
res = ''
|
||||
assets.each do |asset|
|
||||
res << "<link href='#{asset.data.file.url}' rel='stylesheet' type='text/css' /> " if asset.data.file.content_type.eql?('text/css')
|
||||
end
|
||||
res
|
||||
end
|
||||
c.define_tag 'image' do |tag|
|
||||
asset = Asset.find(tag.attr['id'])
|
||||
if asset
|
||||
res = "<img src=#{asset.data.file.url} "
|
||||
tag.attr.each do |l|
|
||||
res << "#{l[0]}=#{l[1]} "
|
||||
end
|
||||
res << '>'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user