Class: OMF::Web::Theme::TextRenderer
- Inherits:
-
Erector::Widget
- Object
- Erector::Widget
- OMF::Web::Theme::TextRenderer
- Defined in:
- lib/omf-web/theme/bright/text_renderer.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(text_widget, content, opts) ⇒ TextRenderer
constructor
A new instance of TextRenderer.
- #render_content_observer(wid) ⇒ Object
Constructor Details
#initialize(text_widget, content, opts) ⇒ TextRenderer
Returns a new instance of TextRenderer.
8 9 10 11 12 |
# File 'lib/omf-web/theme/bright/text_renderer.rb', line 8 def initialize(, content, opts) super opts @widget = @content = content end |
Instance Method Details
#content ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/omf-web/theme/bright/text_renderer.rb', line 15 def content wid = "w#{@widget.object_id}" div :class => "text" do rawtext @content.to_html render_content_observer(wid) end end |
#render_content_observer(wid) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/omf-web/theme/bright/text_renderer.rb', line 24 def render_content_observer(wid) javascript(%{ OHUB.bind("content.changed.#{@widget.content_id}", function(evt) { $.ajax({ url: '/widget/#{@widget.}?embedded&body_only', type: 'GET' }).done(function(data) { $('\##{wid}_b').replaceWith(data); var i = 0; }); }); }) end |