Class: BBMB::Html::View::Filter

Inherits:
HtmlGrid::DivForm
  • Object
show all
Defined in:
lib/bbmb/html/view/customers.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0]		=>	:filter,
  [1,0]		=>	:filter_button,
  [2,0]		=>	:filter_reset,
}
FORM_NAME =
'filter'

Instance Method Summary collapse

Instance Method Details

#eventObject



20
21
22
# File 'lib/bbmb/html/view/customers.rb', line 20

def event
  @session.state.direct_event
end

#filter(model) ⇒ Object



23
24
25
26
27
# File 'lib/bbmb/html/view/customers.rb', line 23

def filter(model)
  filter = HtmlGrid::InputText.new(:filter, model, @session, self)
  filter.value = @session.event_bound_user_input(:filter)
  filter
end

#filter_button(model) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/bbmb/html/view/customers.rb', line 28

def filter_button(model)
  button = HtmlGrid::Button.new(:filter_button, model, @session, self)
  url = @lookandfeel._event_url(event, :filter => nil)
script = "document.location.href='#{url}' + encodeURIComponent(document.#{formname}.filter.value); return false;"
  self.onsubmit = button.onclick = script
  #button.set_attribute('value', @lookandfeel.lookup(:filter))
  button
end

#filter_reset(model) ⇒ Object



36
37
38
39
40
41
# File 'lib/bbmb/html/view/customers.rb', line 36

def filter_reset(model)
  button = HtmlGrid::Button.new(:reset, model, @session, self)
  url = @lookandfeel._event_url(event, :filter => "*")
  button.onclick = "document.location.href='#{url}'"
  button
end