Sha256: 80211f8d10de7fb9086aae50370ec0a4769e63878e4a8c490ce5c87874c9164e

Contents?: true

Size: 1.15 KB

Versions: 20

Compression:

Stored size: 1.15 KB

Contents



require 'omf-web/tab/abstract_service'
require 'omf-web/widget/graph/graph_widget'

module OMF::Web::Tab::TabbedWidgets
  
  class TabbedWidgetsService < OMF::Web::Tab::AbstractService
    
    def initialize(tab_id, opts)
      super
      debug "New TabbedWidgets Service: #{opts.inspect}"      
      @widgets = (opts[:widgets] || []).collect do |wd| 
        OMF::Web::Widget::AbstractWidget.create_widget(wd) 
      end
    end
    
    def show(req, opts)
      sname = "tw:#{opts[:tab]}"
      tid = (req.params['tid'] || OMF::Web::SessionStore[sname, :tws] || 0).to_i
      opts[:card_id] = OMF::Web::SessionStore[sname, :tws] = tid
      unless (widget = @widgets[tid])
        if @widgets.count > 0
          opts[:flash] = {:alert => "Unknown widget id '#{tid}'"}
        else
          opts[:flash] = {:alert => "No widgets defined"}
        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, @widgets, opts.merge(@opts))
      [page.to_html, 'text/html']
    end

  end # TabbedWidgets
    
end

Version data entries

20 entries across 20 versions & 1 rubygems

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