Sha256: a2e0cb6c97c33255339ab0b44c1999af730460ea435f4b2da3425e49510b91ab

Contents?: true

Size: 959 Bytes

Versions: 5

Compression:

Stored size: 959 Bytes

Contents

# CytoTable Helper

def CytoTable(options={})
	if block_given?
		options = Cytoplasm::addClass(options,"cytoTable")
		content_tag("table",options) do
			yield CytoTableHelper.new
		end
	else
		
	end
end

class CytoTableHelper
	include ActionView::Helpers::TagHelper
	
	def tr(html="",options={})
		if html.is_a? Hash
			options = html
			html = ""
		end
		html = yield if block_given?
		content_tag("tr",html,options)
	end
	def td(html="",type=nil,options={})
		html = yield if block_given?
		if html.is_a? Hash
			options = html
			html = ""
		elsif type.is_a? Hash
			options = type
			type = nil
		end
		if type.is_a? String
			options[:data] ||= {}
			options[:data][:type] ||= type 
		end
		content_tag("td",html,options)
	end
	
	def header_row(html="Title",tag="h3",options={})
		tr{td(html,"header",options){content_tag(tag,html)}}
	end
	def button_row(html="Submit",options={})
		tr{td("",nil,{:colspan => "100"}){CytoButton(html,options)}}
	end
	
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cytoplasm-0.4.5 lib/cytoplasm/plugins/table.rb
cytoplasm-0.4.4 lib/cytoplasm/plugins/table.rb
cytoplasm-0.4.3 lib/cytoplasm/plugins/table.rb
cytoplasm-0.4.2 lib/cytoplasm/plugins/table.rb
cytoplasm-0.4.1 lib/cytoplasm/plugins/table.rb