Class: OMF::Web::Widget::TextWidget
Overview
Supports widgets which displays text with potentially other widgets embedded.
Instance Attribute Summary
#name, #opts, #widget_id, #widget_type
Class Method Summary
collapse
Instance Method Summary
collapse
#layout?, #title, #tools_menu, #widget_info
Constructor Details
Returns a new instance of TextWidget.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 16
def initialize(opts)
opts = opts.dup super opts
unless (content_descr = opts[:content])
raise "Missing 'content' option in '#{opts.inspect}'"
end
self.content_proxy = OMF::Web::ContentRepository.create_content_proxy_for(content_descr, opts)
end
|
Class Method Details
.create_text_widget(type, wdescr) ⇒ Object
12
13
14
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 12
def self.create_text_widget(type, wdescr)
return self.new(wdescr)
end
|
Instance Method Details
#collect_data_sources(ds_set) ⇒ Object
63
64
65
66
67
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 63
def collect_data_sources(ds_set)
update()
@widgets.each {|w| w.collect_data_sources(ds_set) }
ds_set
end
|
#content ⇒ Object
36
37
38
39
40
41
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 36
def content()
update()
OMF::Web::Theme.require 'text_renderer'
@opts[:title] = @content.attributes[:title] || opts[:title]
OMF::Web::Theme::TextRenderer.new(self, @content, @opts)
end
|
#content_id ⇒ Object
55
56
57
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 55
def content_id
@content_proxy.content_url
end
|
#content_proxy=(content_proxy) ⇒ Object
32
33
34
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 32
def content_proxy=(content_proxy)
@content_proxy = content_proxy
end
|
#content_url ⇒ Object
51
52
53
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 51
def content_url
@content_proxy.content_url
end
|
#mime_type ⇒ Object
59
60
61
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 59
def mime_type
'text/html'
end
|
#update ⇒ Object
43
44
45
46
47
48
|
# File 'lib/omf-web/widget/text/text_widget.rb', line 43
def update()
@content = OMF::Web::Widget::Text::Maruku.format_content_proxy(@content_proxy)
@widgets = @content.attributes[:widgets] || []
end
|