Sha256: 217086684dc11e8adbb5fb171b8ca85b3c414acffe30be63bb5f212b4c1e0a3e
Contents?: true
Size: 1.37 KB
Versions: 4
Compression:
Stored size: 1.37 KB
Contents
class Rtml::Dom::FrontendElement < Rtml::Dom::Element def screen return @screen if @screen p = self while (p = p.parent).kind_of?(Rtml::Dom::Element) return @screen = p if p.name == 'screen' end raise "Could not find screen for #{self.inspect}" end def inner_content=(text) self.property 'inner_content', text end def content_options=(hash) hash.each do |key, value| self.property key, value end end def to_tml if self.property('inner_content').blank? options = HashWithIndifferentAccess.new properties.each { |p| options[p.name] = p.value unless p.blank? } if (options.keys - ['layout']).empty? options[:file] = screen.path elsif document && document.name options.each do |key, value| case key.to_s when 'partial', 'file', 'template' unless document.nil? or document.name.blank? or value =~ /\// value = "#{document.name}/#{value}" options[key] = value end end end end # Options is passed directly into the document's view. if document document.render(options) else raise Rtml::Errors::MissingDocumentError, "No document through which to render options: #{options.inspect}" end else self.property('inner_content').to_s end end end
Version data entries
4 entries across 4 versions & 1 rubygems