Class: OMF::Web::Tab::Code::CodeService
- Inherits:
-
AbstractService
- Object
- MObject
- AbstractService
- OMF::Web::Tab::Code::CodeService
- Defined in:
- lib/omf-web/UNUSED/tab/code/code_service.rb
Instance Method Summary collapse
-
#initialize(tab_id, opts) ⇒ CodeService
constructor
A new instance of CodeService.
- #show(req, opts) ⇒ Object
Constructor Details
#initialize(tab_id, opts) ⇒ CodeService
Returns a new instance of CodeService.
9 10 11 12 |
# File 'lib/omf-web/UNUSED/tab/code/code_service.rb', line 9 def initialize(tab_id, opts) super @widgets = [] end |
Instance Method Details
#show(req, opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/omf-web/UNUSED/tab/code/code_service.rb', line 14 def show(req, opts) tid = opts[:card_id] = (req.params['tid'] || 0).to_i unless ( = @widgets[tid]) if descr = OMF::Web::Widget::Code[tid] = @widgets[tid] = descr[:widget_class].new(descr) #.create_widget else if OMF::Web::Widget::Code.count > 0 opts[:flash] = {:alert => "Unknown script id '#{tid}'"} else opts[:flash] = {:alert => "No scripts defined"} end end end if opts[:widget] = opts[:card_title] = .name end OMF::Web::Theme.require 'multi_card_page' page = OMF::Web::Theme::MultiCardPage.new(, :code, OMF::Web::Widget::Code, opts) [page.to_html, 'text/html'] end |