16 lines
419 B
Ruby
16 lines
419 B
Ruby
|
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
|