Module: Engine2::ActionTabSupport

Included in:
ActionFormSupport, ActionListSupport, ActionViewSupport
Defined in:
lib/engine2/action.rb

Instance Method Summary collapse

Instance Method Details

#field_tabs(hash) ⇒ Object



450
451
452
# File 'lib/engine2/action.rb', line 450

def field_tabs hash
    @meta[:tabs] = hash.map{|k, v| {name: k, loc: LOCS[k], fields: v} }
end

#lazy_tab(tab_name) ⇒ Object

Raises:



454
455
456
457
458
459
460
# File 'lib/engine2/action.rb', line 454

def lazy_tab tab_name
   tabs = @meta[:tabs]
   raise E2Error.new("No tabs defined") unless tabs
   tab = tabs.find{|t| t[:name] == tab_name}
   raise E2Error.new("No tab #{tab_name} defined") unless tab
   tab[:lazy] = true
end

#select_tabs(tabs, *args, &blk) ⇒ Object



445
446
447
448
# File 'lib/engine2/action.rb', line 445

def select_tabs tabs, *args, &blk
    field_tabs tabs
    select *tabs.map{|name, fields|fields}.flatten, *args, &blk
end