module HtmlGeneratorUnit
Copyright © 2003-2006 Kouichirou Eto, All rights reserved. This is free software with ABSOLUTELY NO WARRANTY. You can redistribute it and/or modify it under the terms of the GNU GPL 2.
Public Instance Methods
a(arg=[], title=nil, &block)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 6 def a(arg=[], title=nil, &block) if arg.kind_of?(String) ha = {:href=>arg} ha.update(:title=>title) if title return make(:a, ha, &block) end make(:a, arg, &block) end
contenttype(content='')
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 91 def contenttype(content='') make(:meta, {'http-equiv'=>'Content-Type', :content=>content}) end
form(a=nil, b=nil, c=nil, &block)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 31 def form(a=nil, b=nil, c=nil, &block) ar = [] if a.is_a? Hash ar << a else ar << {:method=>a} if a ar << {:action=>b} if b ar << {:enctype=>c} if c end make(:form, ar, &block) end
img(src='', alt='')
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 15 def img(src='', alt='') make(:img, {:src=>src, :alt=>alt}) end
password(name='', value=nil, size=nil)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 25 def password(name='', value=nil, size=nil) hash = {:type=>'password', :name=>name, :value=>value, :size=>size} hash.delete_if {|k, v| v.nil? } make(:input, hash) end
radio(a='', b=nil, c=nil)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 77 def radio(a='', b=nil, c=nil) ar = [] if a.is_a? Hash a.update(:type=>'radio') ar << a else ar << {:type=>'radio'} ar << {:name=>a} ar << {:value=>b} if b ar << {:checkd=>'checkd'} if c end make(:input, ar) end
refresh(sec=0, url='')
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 101 def refresh(sec=0, url='') make(:meta, {'http-equiv'=>'Refresh', :content=>"#{sec}; url=#{url}"}) end
select(name='', *args)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 55 def select(name='', *args) ar = [] args.each {|arg| ar << make(:option, {:name=>arg}){arg} } make(:select, {:name=>name}){ar} end
stylesheet(url='', media=nil)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 95 def stylesheet(url='', media=nil) hash = {:rel=>'stylesheet', :type=>'text/css', :href=>url, :media=>media} hash.delete_if {|k, v| v.nil? } make(:link, hash) end
submit(value=nil, name=nil)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 71 def submit(value=nil, name=nil) hash = {:type=>'submit', :name=>name, :value=>value} hash.delete_if {|k, v| v.nil? } make(:input, hash) end
text(name='', value=nil, size=nil, maxsize=nil)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 19 def text(name='', value=nil, size=nil, maxsize=nil) hash = {:name=>name, :value=>value, :size=>size, :maxsize=>maxsize} hash.delete_if {|k, v| v.nil? } make(:input, hash) end
textarea(name='', cols=nil, rows=nil, &block)
click to toggle source
# File vendor/qwik/lib/qwik/html-generator.rb, line 63 def textarea(name='', cols=nil, rows=nil, &block) hash = {:name=>name, :cols=>cols, :rows=>rows} hash.delete_if {|k, v| v.nil? } make(:textarea, hash){ block.call } end