require 'apps/core/components/widgets/menu/menu' module Spider; module Components class Tabs < Spider::Widget tag 'tabs' def init @tabs = [] @tabs_labels = {} end def add_tab(id, label) @tabs << id @tabs_labels[id] = label end def prepare super @active_tab ||= @tabs.first @scene << { :active_tab => @active_tab, :tabs => @tabs, :tabs_labels => @tabs_labels } end def self.parse_content(doc) content, overrides = super doc = Hpricot(content) tabs = [] tabs_override = '' doc.search('tab').each do |tab| tab_id = tab.get_attribute('id') tabs_override += '