Class: OMF::Web::Theme::StackedRendererHelper

Inherits:
Erector::Widget
  • Object
show all
Defined in:
lib/omf-web/theme/bright/stacked_renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(widgets, active_index, opts) ⇒ StackedRendererHelper

Returns a new instance of StackedRendererHelper.



40
41
42
43
44
# File 'lib/omf-web/theme/bright/stacked_renderer.rb', line 40

def initialize(widgets, active_index, opts)
  super opts
  @widgets = widgets
  @active_index = active_index
end

Instance Method Details

#contentObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/omf-web/theme/bright/stacked_renderer.rb', line 46

def content()
  #widget @active_widget
  widgets = @widgets
  prefix = "w#{self.object_id}"
  @widgets.each_with_index do |w, i|
    style = i == @active_index ? '' : 'display:none'
    div :id => "#{prefix}_#{i}", :class => prefix, :style => style do
     rawtext w.content.to_html
    end
  end
end