Module: Bureaucrat::Quickfields

Includes:
Fields
Defined in:
lib/bureaucrat/quickfields.rb

Instance Method Summary collapse

Instance Method Details

#boolean(name, options = {}) ⇒ Object



44
45
46
# File 'lib/bureaucrat/quickfields.rb', line 44

def boolean(name, options={})
  field name, BooleanField.new(options)
end

#choice(name, choices = [], options = {}) ⇒ Object



52
53
54
# File 'lib/bureaucrat/quickfields.rb', line 52

def choice(name, choices=[], options={})
  field name, ChoiceField.new(choices, options)
end

#decimal(name, options = {}) ⇒ Object



28
29
30
# File 'lib/bureaucrat/quickfields.rb', line 28

def decimal(name, options={})
  field name, BigDecimalField.new(options)
end

#email(name, options = {}) ⇒ Object



36
37
38
# File 'lib/bureaucrat/quickfields.rb', line 36

def email(name, options={})
  field name, EmailField.new(options)
end

#file(name, options = {}) ⇒ Object



40
41
42
# File 'lib/bureaucrat/quickfields.rb', line 40

def file(name, options={})
  field name, FileField.new(options)
end

#hide(name) ⇒ Object



7
8
9
10
# File 'lib/bureaucrat/quickfields.rb', line 7

def hide(name)
  base_fields[name] = base_fields[name].dup
  base_fields[name].widget = Widgets::HiddenInput.new
end

#integer(name, options = {}) ⇒ Object



24
25
26
# File 'lib/bureaucrat/quickfields.rb', line 24

def integer(name, options={})
  field name, IntegerField.new(options)
end

#multiple_choice(name, choices = [], options = {}) ⇒ Object



60
61
62
# File 'lib/bureaucrat/quickfields.rb', line 60

def multiple_choice(name, choices=[], options={})
  field name, MultipleChoiceField.new(choices, options)
end

#null_boolean(name, options = {}) ⇒ Object



48
49
50
# File 'lib/bureaucrat/quickfields.rb', line 48

def null_boolean(name, options={})
  field name, NullBooleanField.new(options)
end

#password(name, options = {}) ⇒ Object



20
21
22
# File 'lib/bureaucrat/quickfields.rb', line 20

def password(name, options={})
  field name, CharField.new(options.merge(:widget => Widgets::PasswordInput.new))
end

#regex(name, regexp, options = {}) ⇒ Object



32
33
34
# File 'lib/bureaucrat/quickfields.rb', line 32

def regex(name, regexp, options={})
  field name, RegexField.new(regexp, options)
end

#string(name, options = {}) ⇒ Object



12
13
14
# File 'lib/bureaucrat/quickfields.rb', line 12

def string(name, options={})
  field name, CharField.new(options)
end

#text(name, options = {}) ⇒ Object



16
17
18
# File 'lib/bureaucrat/quickfields.rb', line 16

def text(name, options={})
  field name, CharField.new(options.merge(:widget => Widgets::Textarea.new))
end

#typed_choice(name, choices = [], options = {}) ⇒ Object



56
57
58
# File 'lib/bureaucrat/quickfields.rb', line 56

def typed_choice(name, choices=[], options={})
  field name, TypedChoiceField.new(choices, options)
end