Class: ODDB::Html::View::Drugs::AtcList

Inherits:
List
  • Object
show all
Defined in:
lib/oddb/html/view/drugs/atc_browser.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :name,
  [1,0] => :ddd_link,
}
OMIT_HEADER =
true
STRIPED_BG =
false

Constants inherited from List

List::BACKGROUND_ROW, List::BACKGROUND_SUFFIX, List::LEGACY_INTERFACE, List::SORT_DEFAULT

Instance Method Summary collapse

Methods inherited from List

#query_args, #query_key, #sort_link

Instance Method Details

CSS_MAP = { [1,0] => ‘atc’ }



20
21
22
23
24
25
26
27
# File 'lib/oddb/html/view/drugs/atc_browser.rb', line 20

def ddd_link(model)
  if(model.interesting?)
    link = HtmlGrid::Link.new(:who_ddd, model, @session, self)
    link.href = @lookandfeel._event_url(:ddd, [:code, model.code])
    link.css_class = 'who-ddd square'
    link
  end
end

#name(model) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oddb/html/view/drugs/atc_browser.rb', line 28

def name(model)
  css_map.update( [0,0] => "atc level#{model.level} browser", 
                  [1,0] => "atc level#{model.level}" )
  value = if(name = model.name.send(@session.language))
            [name, " (" << model.code.to_s << ")"]
          else
            model.code
          end
  search_level = model.level > 1 && (code = @session.user_input(:code)) \
                    && /^#{model.code}/.match(code) || model.level == 5
  if search_level && model.packages.empty?
    return value
  end
  link = HtmlGrid::Link.new(model.code, model, @session, self)
  if search_level
    link.href = @lookandfeel._event_url(:search, 
                                        [:query, model.code, :dstype, :compare])
    link.css_class = 'search'
  else
    link.href = @lookandfeel._event_url(:atc_browser, :code => model.code)
  end
  link.value = value
  link
end