Class: ODDB::Html::View::Drugs::CompareList

Inherits:
List
  • Object
show all
Includes:
PackageMethods, ProductMethods, Google
Defined in:
lib/oddb/html/view/drugs/compare.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :product,
  [1,0] => :company,
  [2,0] => :active_agents,
  [3,0] => :size, 
  [4,0] => :price_exfactory,
  [5,0] => :price_public,
  [6,0] => :ddd_prices,
  [7,0] => :difference,
  [8,0] => :google,
}
CSS_MAP =
css_map
CSS_HEAD_MAP =
css_map
EMPTY_LIST_KEY =
:empty_comparison

Constants inherited from List

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

Instance Method Summary collapse

Methods included from Google

#google

Methods included from ProductMethods

#company

Methods included from PackageMethods

#active_agents, #adjust_price, #code_boolean, #code_festbetragsgruppe, #code_festbetragsstufe, #code_prescription, #code_registration, #code_zuzahlungsbefreit, #ddd_prices, #fachinfo_link, #feedback, #patinfo_link, #price_difference, #price_exfactory, #price_festbetrag, #price_public, #price_zuzahlung, #product, #product_local, #product_remote, #row_css, #size

Methods inherited from List

#query_args, #sort_link

Instance Method Details

#compose_header(offset = [0,0]) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/oddb/html/view/drugs/compare.rb', line 39

def compose_header(offset=[0,0])
  offset = super
  mdl = @model.origin
  _compose(mdl, offset)
  css = ['origin', row_css(mdl, nil)].compact.join(' ')
  @grid.set_row_attributes({'class' => css}, offset.at(1))
  resolve_offset(offset, self::class::OFFSET_STEP)
end

#difference(model) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/oddb/html/view/drugs/compare.rb', line 47

def difference(model)
  if(model.respond_to?(:difference) && (difference = model.difference))
    span = HtmlGrid::Span.new(model, @session, self)
    if(difference < 0)
      span.css_class = 'less'
    elsif(difference > 0)
      span.css_class = 'more'
    else
      span.css_class = 'same'
    end
    span.value = sprintf("%+2.1f%%", difference)
    span
  end
end

#query_keyObject



61
62
63
# File 'lib/oddb/html/view/drugs/compare.rb', line 61

def query_key
  @model.origin.is_a?(Remote::Drugs::Package) ? :uid : :cid
end