Class: ODDB::Html::View::Drugs::Parts

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

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :size,
  [1,0] => :active_agents,
}
CSS_MAP =
{ [0,0,2] => 'top' }
OMIT_HEADER =
true
SORT_DEFAULT =
nil

Constants inherited from List

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

Instance Method Summary collapse

Methods inherited from List

#query_args, #query_key, #sort_link

Instance Method Details

#active_agents(model) ⇒ Object



238
239
240
241
242
243
244
245
# File 'lib/oddb/html/view/drugs/package.rb', line 238

def active_agents(model)
  if(comp = model.composition)
    comp.active_agents.collect { |act| 
      [ (sub = act.substance) && sub.name.send(@session.language), 
        act.dose ].join(' ')
    }.join("<BR>")
  end
end

#size(model) ⇒ Object



246
247
248
249
250
251
252
253
254
255
256
# File 'lib/oddb/html/view/drugs/package.rb', line 246

def size(model)
  part = []
  if(multi = model.multi)
    part.push multi, 'x'
  end
  part.push model.size.to_i, model.unit
  if(quantity = model.quantity)
    part.push 'à', quantity
  end
  part.join(' ')
end