Class: ODDB::Html::View::Drugs::PackageComposite

Inherits:
HtmlGrid::DivComposite
  • Object
show all
Includes:
Snapback
Defined in:
lib/oddb/html/view/drugs/package.rb

Direct Known Subclasses

Admin::PackageComposite

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :snapback, 
  [0,1] => InlineSearch, 
  [0,2] => :name,
  [0,3] => PackageInnerComposite,
  [0,4] => :parts_heading,
  [0,5] => :parts,
}
CSS_ID_MAP =
[ 'snapback', 'result-search', 'title' ]
CSS_MAP =
{ 0 => 'before-searchbar', 4 => 'divider' }

Instance Method Summary collapse

Instance Method Details



363
364
365
366
# File 'lib/oddb/html/view/drugs/package.rb', line 363

def breadcrumbs(model)
  [ @lookandfeel.lookup(:package_details_for, 
                        model.name.send(@session.language)) ]
end

#name(model) ⇒ Object



367
368
369
370
371
372
373
# File 'lib/oddb/html/view/drugs/package.rb', line 367

def name(model)
  name = [model.name]
  if(company = model.company)
    name.push(' - ', company.name)
  end
  name
end

#parts(model) ⇒ Object



374
375
376
# File 'lib/oddb/html/view/drugs/package.rb', line 374

def parts(model)
  Parts.new(model.parts, @session, self)
end

#parts_heading(model) ⇒ Object



377
378
379
380
# File 'lib/oddb/html/view/drugs/package.rb', line 377

def parts_heading(model)
  key = model.parts.size > 1 ? :parts : :package_and_substances
  @lookandfeel.lookup(key)
end

#snapback(model) ⇒ Object



381
382
383
# File 'lib/oddb/html/view/drugs/package.rb', line 381

def snapback(model)
  [ super, @lookandfeel.lookup(:breadcrumb_divider) ].concat breadcrumbs(model)
end