This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/lib/parsers/parser_layout_widget.rb

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