Class: OMF::Web::Widget::MustacheWidget
- Inherits:
-
AbstractWidget
- Object
- Erector::Widget
- AbstractWidget
- OMF::Web::Widget::MustacheWidget
- Defined in:
- lib/omf-web/widget/mustache_widget.rb
Overview
Renders the content of a moustache file in the context of a data source
Instance Attribute Summary collapse
-
#content_proxy ⇒ Object
Returns the value of attribute content_proxy.
Attributes inherited from AbstractWidget
#name, #opts, #widget_id, #widget_type
Class Method Summary collapse
Instance Method Summary collapse
- #collect_data_sources(ds_set) ⇒ Object
- #content ⇒ Object
-
#initialize(opts) ⇒ MustacheWidget
constructor
A new instance of MustacheWidget.
- #title ⇒ Object
Methods inherited from AbstractWidget
#layout?, #mime_type, #tools_menu, #widget_info
Methods included from Common::Loggable
#_logger, #debug, #error, #fatal, #info, init_log, logger, set_environment, #warn
Constructor Details
#initialize(opts) ⇒ MustacheWidget
Returns a new instance of MustacheWidget.
17 18 19 20 21 22 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 17 def initialize(opts) super opts # if (content_descr = opts[:content]) # opts[:content_proxy] = OMF::Web::ContentRepository.create_content_proxy_for(content_descr, opts) # end end |
Instance Attribute Details
#content_proxy ⇒ Object
Returns the value of attribute content_proxy.
15 16 17 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 15 def content_proxy @content_proxy end |
Class Method Details
.create_mustache_widget(type, wdescr) ⇒ Object
11 12 13 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 11 def self.(type, wdescr) return self.new(wdescr) end |
Instance Method Details
#collect_data_sources(ds_set) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 33 def collect_data_sources(ds_set) if @opts[:data_sources] @opts[:data_sources].each do |ds| ds_set.add(ds[:stream]) end end ds_set end |
#content ⇒ Object
28 29 30 31 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 28 def content() OMF::Web::Theme.require 'mustache_renderer' OMF::Web::Theme::MustacheRenderer.new(self, @opts) end |
#title ⇒ Object
24 25 26 |
# File 'lib/omf-web/widget/mustache_widget.rb', line 24 def title @opts[:title] || 'No Title' end |