Class: ODDB::Html::View::Drugs::AtcGuidelineList
- Inherits:
-
HtmlGrid::DivList
- Object
- HtmlGrid::DivList
- ODDB::Html::View::Drugs::AtcGuidelineList
- Includes:
- AtcMethods
- Defined in:
- lib/oddb/html/view/drugs/atc_guidelines.rb
Constant Summary collapse
- COMPONENTS =
{ [0,0] => :atc_description, [1,0] => :guidelines, [2,0] => :ddd_guidelines, [3,0] => :ddds, }
- @@atc_re =
/\b[A-Z]\d{2}([A-Z]([A-Z](\d{2})?)?)?\b/
Instance Method Summary collapse
- #atc_description(model) ⇒ Object
- #ddd_guidelines(model) ⇒ Object
- #ddds(model) ⇒ Object
- #div(value, klass = "atc") ⇒ Object
- #guidelines(model) ⇒ Object
Instance Method Details
#atc_description(model) ⇒ Object
42 43 44 |
# File 'lib/oddb/html/view/drugs/atc_guidelines.rb', line 42 def atc_description(model) div(super, "atc groupheader") end |
#ddd_guidelines(model) ⇒ Object
59 60 61 |
# File 'lib/oddb/html/view/drugs/atc_guidelines.rb', line 59 def ddd_guidelines(model) div(model.ddd_guidelines.en, "atc ddd") end |
#ddds(model) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/oddb/html/view/drugs/atc_guidelines.rb', line 62 def ddds(model) ddds = model.ddds unless(ddds.empty?) Ddds.new(ddds, @session, self) end end |
#div(value, klass = "atc") ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/oddb/html/view/drugs/atc_guidelines.rb', line 45 def div(value, klass="atc") unless(value.to_s.strip.empty?) div = HtmlGrid::Div.new(value, @session, self) div.value = value.gsub(@@atc_re) { |match| sprintf("<a href='%s'>%s</a>", @lookandfeel._event_url(:ddd, [:code, match]), match) } div.css_class = klass div end end |
#guidelines(model) ⇒ Object
56 57 58 |
# File 'lib/oddb/html/view/drugs/atc_guidelines.rb', line 56 def guidelines(model) div(model.guidelines.en) end |