Class: ODDB::Html::View::Drugs::AtcAssign

Inherits:
HtmlGrid::DivForm
  • Object
show all
Defined in:
lib/oddb/html/view/drugs/result.rb

Constant Summary collapse

COMPONENTS =
{ [0,0,0] => :toggle, [0,0,1] => :atc_assign }
EVENT =
:atc_assign
FORM_ID =
'atc-assign-form'

Instance Method Summary collapse

Instance Method Details

#atc_assign(model) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/oddb/html/view/drugs/result.rb', line 24

def atc_assign(model)
  input = HtmlGrid::InputText.new(:code, model, @session, self)
  style = 'margin-left: 4px;'
  style << ' display: none;' unless @session.error(:atc_assign)
  input.set_attribute('style', style)
  input.css_id = 'atc-assign'
  input
end

#hidden_fields(context) ⇒ Object



32
33
34
35
36
# File 'lib/oddb/html/view/drugs/result.rb', line 32

def hidden_fields(context)
  %w{query dstype}.inject(super) { |memo, key| 
    memo << context.hidden(key, @session.persistent_user_input(key))
  }
end

#toggle(model) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/oddb/html/view/drugs/result.rb', line 37

def toggle(model)
  link = HtmlGrid::Link.new(:atc_assign, model, @session, self)
  unless @session.error(:atc_assign)
    link.onclick = "dojo.lfx.toggle.fade.show('atc-assign', 500); this.onclick=null;"
  end
  link.css_id = 'atc-assign-toggle'
  link
end