Class: ODDB::View::Migel::ProductInnerComposite

Inherits:
HtmlGrid::Composite show all
Includes:
AdditionalInformation, DataFormat
Defined in:
src/view/migel/product.rb

Constant Summary

SYMBOL_MAP =
{
  :date   => HtmlGrid::DateValue,
  :feedback_label => HtmlGrid::LabelText,
}
COMPONENTS =
{
  [0,0] => :migel_code,
  [0,1] => :group,
  [0,2] => :subgroup,
  [0,3] => :description,
  [0,4] => :product_text,
  [0,5] => :limitation_text,
  [0,6] => :date,
  [0,7] => :price,
  [1,7] => :qty_unit, 
  [0,8] => :feedback_label,
  [1,8] => :feedback,
}
CSS_MAP =
{
  [0,0,1,9] => 'list top',
  [1,0,1,9] => 'list',
}
LABELS =
true
DEFAULT_CLASS =
HtmlGrid::Value
LEGACY_INTERFACE =
false
@@migel_pattern =
/Pos(?:ition|\.)?\s*(\d\d)(?:\.(\d\d)(?:\.(\d\d\.\d\d\.\d))?)?/u

Instance Method Summary (collapse)

Methods included from DataFormat

#breakline, #company_name, #most_precise_dose, #name_base, #price, #price_exfactory, #price_public

Methods included from ExternalLinks

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

Methods included from AdditionalInformation

#_fachinfo, #atc_ddd_link, #atc_description, #comarketing, #complementary_type, #compositions, #ddd_price, #deductible, #fachinfo, #feedback, #google_search, #ikscat, #limitation_link, #minifi, #narcotic, #notify, #patent, #patinfo, #qty_unit, #square, #twitter_share

Methods included from PartSize

#comparable_size, #part_size

Methods included from Drugs::AtcDddLink

#atc_ddd_link

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) description(model, key = :migel_product)



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'src/view/migel/product.rb', line 70

def description(model, key = :migel_product)
  value = HtmlGrid::Value.new(key, model, @session, self)
  if(model && (str = model.send(@session.language)))
    value.value = str.gsub(@@migel_pattern) {
      code = $~[1]
      ptr = Persistence::Pointer.new([:migel_group, code])
      if(code = $~[2])
        ptr += [:subgroup, code]
        if(code = $~[3])
          ptr += [:product, code]
        end
      end
      args = {:pointer => ptr}
      '<a class="list" href="' << @lookandfeel._event_url(:resolve, args) << 
        '">' << $~[0] << '</a>'
    }
  end
  value
end

- (Object) group(model)



89
90
91
# File 'src/view/migel/product.rb', line 89

def group(model)
  pointer_link(model.group)
end

- (Object) limitation_text(model)



92
93
94
# File 'src/view/migel/product.rb', line 92

def limitation_text(model)
  description(model.limitation_text, :limitation_text)
end


98
99
100
101
102
# File 'src/view/migel/product.rb', line 98

def pointer_link(model)
  link = PointerLink.new(:to_s, model, @session, self)
  link.value = model.send(@session.language)
  link
end

- (Object) product_text(model)



103
104
105
# File 'src/view/migel/product.rb', line 103

def product_text(model)
  description(model.product_text, :product_text)
end

- (Object) subgroup(model)



95
96
97
# File 'src/view/migel/product.rb', line 95

def subgroup(model)
  pointer_link(model.subgroup)
end