Orbit/lib/parsers/parser_layout_widget.rb

16 lines
419 B
Ruby
Raw Normal View History

2012-11-01 12:42:40 +00:00
module ParserLayoutWidget
require 'nokogiri'
def parse_widget_for_images(widget)
widge = Nokogiri::HTML(widget.widget_layout.body)
widge.css('.widget_image').each do |page_image|
image = widget.images.where( file: File.basename(page_image['src']))[0]
image.update_attributes(:html_id => page_image['id'], :html_class => page_image['class'], :in_html => true) if image
end
end
end