Sha256: 777c39315899e9219e35b5608bb02c3846cba8ab408828b5e11ef03db774150f

Contents?: true

Size: 532 Bytes

Versions: 3

Compression:

Stored size: 532 Bytes

Contents

module Netzke
  class ExtComponent
    attr_accessor :name
    
    def initialize(name, config = {})
      @name = name
      @config = config
    end
    
    def config
      @config ||= {}
    end
    
    # Rendering
    def js_component_render
      %Q{Ext.ComponentMgr.create(#{config.to_nifty_json}).render("ext-#{name.to_s.split('_').join('-')}");}
    end

    # Container for rendering
    def js_component_html
      %Q{<div id="ext-#{name.to_s.split('_').join('-')}" class="ext-component"></div>}
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netzke-core-0.6.2 lib/netzke/ext_component.rb
netzke-core-0.6.1 lib/netzke/ext_component.rb
netzke-core-0.6.0 lib/netzke/ext_component.rb