Sha256: 09d73f7559220525262afaf4fea8ef5e2ece6acf108e1982eb8da5c4610e8e07

Contents?: true

Size: 545 Bytes

Versions: 6

Compression:

Stored size: 545 Bytes

Contents

# make cell available in helpers

require_relative 'helper_modules'

class ViewCell < Lux::View::Cell
end

HtmlHelper.class_eval do
  def cell name=nil, vars={}
    if name
      ViewCell.get(name, self, vars)
    else
      return @cell_base ||= ViewCell::Loader.new(self)
    end
  end
end

# make cell available in controllers
Lux::Controller.class_eval do
  def cell name=nil
    name = if name
      name.to_s.classify
    else
      self.class.to_s.split('::').last.sub('Controller')
    end

    name.constantize.new(self, vars)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lux-fw-0.5.37 ./lib/lux/view/lib/cell_helpers.rb
lux-fw-0.5.36 ./lib/lux/view/lib/cell_helpers.rb
lux-fw-0.5.35 ./lib/lux/view/lib/cell_helpers.rb
lux-fw-0.5.34 ./lib/lux/view/lib/cell_helpers.rb
lux-fw-0.5.33 ./lib/lux/view/lib/cell_helpers.rb
lux-fw-0.5.32 ./lib/lux/view/lib/cell_helpers.rb