Class: OMF::Web::Theme::MustacheRenderer

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

Instance Method Summary collapse

Constructor Details

#initialize(widget, opts) ⇒ MustacheRenderer

Returns a new instance of MustacheRenderer.



8
9
10
11
12
# File 'lib/omf-web/theme/bright/mustache_renderer.rb', line 8

def initialize(widget, opts)
  super opts
  @widget = widget
  @opts = opts
end

Instance Method Details

#contentObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/omf-web/theme/bright/mustache_renderer.rb', line 14

def content()
  base_id = "mr#{self.object_id}"
  opts = @opts.dup
  opts[:base_id] = base_id
  div :id => base_id, :class => "mustache_widget" do
    javascript(%{
      L.require('#OML.mustache', 'js/mustache', function() {
        OML.mustache(#{opts.to_json});
      });
    })
  end
end