Sha256: 7ca5aaa0125df2f185f4c5288150976fc19945bd8ae7e7d19f68ce8239d59ffe

Contents?: true

Size: 963 Bytes

Versions: 20

Compression:

Stored size: 963 Bytes

Contents

##
# ExtJS::Helpers::Component
#
module ExtJS::Helpers
  module Component
    ##
    # add class-var @@extjs_on_ready
    def self.included(helper)

    end

    def extjs_component(*params)
      options = params.extract_options!
      options[:controller] = self
      ExtJS::Component.new(options)
    end

    ##
    # Adds a script or ExtJS::Component instance to on_ready queue.  The queue is emptied and rendered to
    # <script></script> via #extjs_render
    #
    def extjs_onready(*params)
      @onready_queue = [] if @onready_queue.nil?
      params.each do |cmp|
        @onready_queue << cmp
      end
    end

    ##
    # Empties the on_ready queue.  Renders within <script></script> tags
    #
    def extjs_render
      @onready_queue = [] if @onready_queue.nil?
      "<script>\nExt.onReady(function() {\n\t#{@onready_queue.collect {|cmp| (cmp.kind_of?(ExtJS::Component)) ? cmp.render : cmp}.join("\n\t")}\n });\n</script>"
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
extjs-mvc-0.3.10 lib/helpers/component.rb
extjs-mvc-0.3.9 lib/helpers/component.rb
extjs-mvc-0.3.8 lib/helpers/component.rb
extjs-mvc-0.3.7 lib/helpers/component.rb
extjs-mvc-0.3.6 lib/helpers/component.rb
extjs-mvc-0.3.5 lib/helpers/component.rb
extjs-mvc-0.3.4 lib/helpers/component.rb
extjs-mvc-0.3.3 lib/helpers/component.rb
extjs-mvc-0.3.2 lib/helpers/component.rb
extjs-mvc-0.3.1 lib/helpers/component.rb
extjs-mvc-0.3.0 lib/helpers/component.rb
extjs-mvc-0.2.8 lib/helpers/component.rb
extjs-mvc-0.2.7 lib/helpers/component.rb
extjs-mvc-0.2.6 lib/helpers/component.rb
extjs-mvc-0.2.5 lib/helpers/component.rb
extjs-mvc-0.2.4 lib/helpers/component.rb
extjs-mvc-0.2.3 lib/helpers/component.rb
extjs-mvc-0.2.2 lib/helpers/component.rb
extjs-mvc-0.2.1 lib/helpers/component.rb
extjs-mvc-0.2.0 lib/helpers/component.rb