Class: OMF::Web::Theme::StackedRenderer
- Inherits:
-
Object
- Object
- OMF::Web::Theme::StackedRenderer
- Defined in:
- lib/omf-web/theme/bright/stacked_renderer.rb
Instance Method Summary collapse
-
#initialize(stacked_widget, widgets, active_index, opts) ⇒ StackedRenderer
constructor
A new instance of StackedRenderer.
- #to_html ⇒ Object
Constructor Details
#initialize(stacked_widget, widgets, active_index, opts) ⇒ StackedRenderer
Returns a new instance of StackedRenderer.
8 9 10 11 12 13 14 |
# File 'lib/omf-web/theme/bright/stacked_renderer.rb', line 8 def initialize(, , active_index, opts) = = @active_index = active_index @helper = StackedRendererHelper.new(, active_index, opts) @opts = opts end |
Instance Method Details
#to_html ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/omf-web/theme/bright/stacked_renderer.rb', line 16 def to_html() wp = "w#{@helper.object_id}" @opts[:menu] = .each_with_index.map do |w, i| wc = w..split('/').inject([]) do |a, e| a << (a.empty? ? e : "#{a[-1]}_#{e}") end { :name => w.name, :class => wc.join(' '), :is_active => (@active_index == i), :id => "#{wp}_l_#{i}", :js_function => 'OML.show_widget', :inner_class => wp, :index => i, :widget_id => w.dom_id } end WidgetChrome.new(, @helper, @opts).to_html end |