Class: ODDB::View::Drugs::DDDTree

Inherits:
HtmlGrid::Composite show all
Includes:
ExternalLinks
Defined in:
src/view/drugs/ddd.rb

Constant Summary

SORT_DEFAULT =
nil
CSS_CLASS =
'composite'
COMPONENTS =
{
  [0,0]   =>  :description,
  [1,0,0] =>  :ddd_version,
  [1,0,1] =>  :source,
  [0,1]   =>  View::Drugs::DDDTreeList,
}
COLSPAN_MAP =
{
  [0,1] =>  2,
}
CSS_MAP =
{
  [0,0] =>  'th',
  [1,0] =>  'th right',
}

Instance Method Summary (collapse)

Methods included from ExternalLinks

#contact_link, #data_declaration, #external_link, #faq_link, #generic_definition, #help_link, #legal_note, #meddrugs_update, #wiki_link

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) ddd_version(model, session)



110
111
112
113
114
# File 'src/view/drugs/ddd.rb', line 110

def ddd_version(model, session)
  if(atc = model.last)
    @lookandfeel.lookup(:ddd_version)
  end
end

- (Object) description(model, session)



115
116
117
118
119
# File 'src/view/drugs/ddd.rb', line 115

def description(model, session)
  if(atc = model.last)
    [ atc.code, atc.en ].join(' - ')
  end
end

- (Object) init



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'src/view/drugs/ddd.rb', line 97

def init
  if(@model)
    atc = @model
    @model = [atc]
    while((code = atc.parent_code) \
      && (atc = @session.app.atc_class(code)))
      @model.unshift(atc) if(atc.has_ddd?)
    end
  else
    @model = []
  end
  super
end

- (Object) source(model, session)



120
121
122
123
124
125
126
127
128
# File 'src/view/drugs/ddd.rb', line 120

def source(model, session)
  if(atc = model.last)
    link = external_link(atc, :ddd_source)
    href = "http://www.whocc.no/atcddd/indexdatabase/index.php?query="
    href << atc.code
    link.href = href
    link
  end
end