Class: Presentation::FieldSearch

Inherits:
Search show all
Defined in:
lib/presentation/field_search.rb

Defined Under Namespace

Classes: Field

Instance Attribute Summary collapse

Attributes inherited from Base

#controller, #presentable

Instance Method Summary collapse

Methods inherited from Search

#iname, #url

Methods inherited from Base

#render

Methods included from Presenting::Configurable

#initialize

Instance Attribute Details

#compactObject



28
29
30
# File 'lib/presentation/field_search.rb', line 28

def compact
  @compact != false
end

Instance Method Details

#fieldsObject



24
25
26
# File 'lib/presentation/field_search.rb', line 24

def fields
  @fields ||= Presenting::FieldSet.new(Field, :param, :type)
end

#fields=(args) ⇒ Object

This method supports the configuration-on-initialization paradigm. It makes:

present = Presentation::FieldSearch.new(:fields => [
  {:a => {:type => :list, :options => %w(foo bar baz)}},
  :b,
  {:c => :boolean}
])

equivalent to:

present = Presentation::FieldSearch.new
present.fields << {:a => {:type => :list, :options => %w(foo bar baz)}}
present.fields << :b
present.fields << {:c => :boolean}


18
19
20
21
22
# File 'lib/presentation/field_search.rb', line 18

def fields=(args)
  args.each do |field|
    self.fields << field
  end
end