blob: cb77ffdbae95cebb3c9d8a91b6a0a877c2a00752 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
helpers do
def embedded_svg image, options={}
doc = Nokogiri::HTML::DocumentFragment.parse image
svg = doc.at_css 'svg'
title = doc.at_css 'title'
if options[:class].present?
svg['class'] = options[:class]
end
if options[:title].present?
if options[:title] == "x"
title.children.remove
else
title.children.remove
text_node = Nokogiri::XML::Text.new(options[:title], doc)
title.add_child(text_node)
end
end
doc.to_html.html_safe
end
def is_mongoid?
self.match(/^[a-f\d]{24}$/i) ? true : false
end
end
|