Sha256: c998c0a1c50704dab8688c73fde32a1ead44268284eab7703ac04e448900ae73
Contents?: true
Size: 1.13 KB
Versions: 13
Compression:
Stored size: 1.13 KB
Contents
module TableBuilder class Tag class << self attr_accessor :level, :tag_name end def level self.class.level end def tag_name self.class.tag_name end include ActionView::Helpers::TagHelper attr_reader :options, :parent def initialize(parent = nil, options = {}) @parent = parent @options = options end def collection_class table.collection_class end def collection_name table.collection_name end def table is_a?(Table) ? self : parent.try(:table) end def head? is_a?(Head) || !!parent.try(:head?) end def render(content = nil) content = '' if content.nil? yield(content) if content.empty? && block_given? content = content.html_safe content_tag(tag_name, content, options) end def add_class(klass) add_class!(options, klass) end protected def add_class!(options, klass) unless klass.blank? options[:class] ||= '' options[:class] = options[:class].split(' ').push(klass).join(' ') end end end end
Version data entries
13 entries across 13 versions & 1 rubygems