Class: ODDB::View::Drugs::NarcoticList

Inherits:
HtmlGrid::List show all
Includes:
AlphaHeader
Defined in:
src/view/drugs/narcotics.rb

Constant Summary

COMPONENTS =
{
  [0,0] => :casrn,
  [1,0] => :swissmedic_code,
  [2,0] => :name,
  [3,0] => :category,
  [4,0] => :num_packages,
}
LEGACY_INTERFACE =
false
DEFAULT_CLASS =
HtmlGrid::Value
CSS_CLASS =
'composite'
CSS_MAP =
{
  [0,0,4] => 'list',
  [4,0]   => 'list right',
}
CSS_HEAD_MAP =
{
  [0,0] => 'th',
  [1,0] => 'th',
  [2,0] => 'th',
  [3,0] => 'th',
  [4,0] => 'th right',
}
SORT_HEADER =
false
SYMBOL_MAP =
{
  :casrn  => PointerLink,
}

Constants included from AlphaHeader

EMPTY_LIST_KEY

Constants inherited from HtmlGrid::List

BACKGROUND_SUFFIX

Instance Method Summary (collapse)

Methods included from AlphaHeader

#compose_header

Instance Method Details

- (Object) casrn(model, session = @session)



40
41
42
# File 'src/view/drugs/narcotics.rb', line 40

def casrn(model, session=@session)
  PointerLink.new(:casrn, model.narcotic, @session, self)
end

- (Object) category(model, session = @session)



43
44
45
46
47
48
49
50
# File 'src/view/drugs/narcotics.rb', line 43

def category(model, session=@session)
  txt = HtmlGrid::Span.new(model ,session, self)
  cat = model.narcotic.category.to_s
  key = "category_" + cat
  txt.value = cat
  txt.set_attribute('title', @lookandfeel.lookup(key))
  txt
end

- (Object) name(model)



54
55
56
57
58
59
60
61
62
63
64
65
# File 'src/view/drugs/narcotics.rb', line 54

def name(model)
  #link = HtmlGrid::Link.new(:narcotic, model, @session, self)
  #link.value = 
=begin
  if(sub = model.substance)
    link.value = sub.send(@session.language)
  end
=end


  #link
  model.send(@session.language)
end

- (Object) num_packages(model)



51
52
53
# File 'src/view/drugs/narcotics.rb', line 51

def num_packages(model)
  model.narcotic.packages.size
end