Sha256: bd8288e097fb7fe2623d57af78691a402de37b579fbc126ff3801bc873a983d6

Contents?: true

Size: 1.05 KB

Versions: 20

Compression:

Stored size: 1.05 KB

Contents

require 'omf-web/tab/abstract_service'
require 'omf-web/widget/code/code'

module OMF::Web::Tab::Code
  
  class CodeService < OMF::Web::Tab::AbstractService
    
    def initialize(tab_id, opts)
      super
      @widgets = []
    end 
    
    def show(req, opts)
      tid = opts[:card_id] = (req.params['tid'] || 0).to_i
      unless (widget = @widgets[tid])
        if descr = OMF::Web::Widget::Code[tid]
          widget = @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] = widget
        opts[:card_title] = widget.name
      end
      
      OMF::Web::Theme.require 'multi_card_page'
      page = OMF::Web::Theme::MultiCardPage.new(widget, :code, OMF::Web::Widget::Code, opts)
      [page.to_html, 'text/html']
    end

  end # CodeService
  
  
end # OMF::Web::Tab::Code

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
omf_web-1.2.9 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.8 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.7 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.6 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.5 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.4 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.3 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.2 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.1 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.2.0 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-1.0.0 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.9 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.8 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.7 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.6 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.5 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.4 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.3 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9.1 lib/omf-web/UNUSED/tab/code/code_service.rb
omf_web-0.9 lib/omf-web/UNUSED/tab/code/code_service.rb