Module: Campo
- Defined in:
- lib/campo.rb,
lib/campo/version.rb
Defined Under Namespace
Modules: Childish, Convenience, Helpers, Iding Classes: Base, Fieldset, Form, Haml_Ruby_Insert, Input, Label, Legend, Literal, Option, Select, Textarea
Constant Summary collapse
- VERSION =
"0.3.4"
Class Attribute Summary collapse
-
.atts ⇒ Object
Returns the value of attribute atts.
Class Method Summary collapse
-
.form(name, attributes = {}, &block) ⇒ Object
Generally, the first method you’ll call.
- .literal(*args, &block) ⇒ Object
-
.output(*args) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top.
Class Attribute Details
.atts ⇒ Object
Returns the value of attribute atts.
165 166 167 |
# File 'lib/campo.rb', line 165 def atts @atts end |
Class Method Details
.form(name, attributes = {}, &block) ⇒ Object
Generally, the first method you’ll call.
312 313 314 |
# File 'lib/campo.rb', line 312 def self.form( name, attributes={}, &block ) Form.new( name, attributes, &block ) end |
.literal(*args, &block) ⇒ Object
237 238 239 |
# File 'lib/campo.rb', line 237 def self.literal( *args, &block ) Campo::Literal.new( *args, &block ) end |
.output(*args) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/campo.rb', line 248 def self.output( *args ) s = <<STR - atts = {} if atts.nil? - atts.default = {} if atts.default.nil? - inners = {} if inners.nil? - inners.default = "" if inners.default.nil? - i = 0 # for tabindex STR # default to true whole_form = if args.first.kind_of? Campo::Base true else args.shift false end output = Base.output( *args ) output = s + output if whole_form output end |