Class: ODDB::View::ExplainResult

Inherits:
HtmlGrid::Composite show all
Includes:
AdditionalInformation, ExternalLinks
Defined in:
src/view/resultfoot.rb

Direct Known Subclasses

Drugs::ExplainVaccines

Constant Summary

COMPONENTS =
{}
CSS_MAP =
{}
CSS_KEYMAP =
{
  'explain_unknown'       => 'infos bold',
  'explain_expired'       => 'infos bold expired',
  :explain_cas            =>  'infos',
  :explain_comarketing    =>  'infos',
  :explain_complementary  =>'infos',
  :explain_vaccine        =>  'infos',
  :explain_ddd_price      => 'infos',
  :explain_deductible     =>  'infos',
  :explain_phytotherapy   =>  'infos',
  :explain_anthroposophy  => 'infos',
  :explain_homeopathy     =>  'infos',
  :explain_parallel_import=>  'infos',
  :explain_fachinfo       => 'infos',
  'explain_pbp'           => 'infos',
  :explain_patinfo    =>  'infos',
  :explain_narc           => 'infos',
  :explain_limitation     =>  'infos',
  :explain_google_search          =>  'infos',
  :explain_feedback       => 'infos',
}

Instance Method Summary (collapse)

Methods included from AdditionalInformation

#_fachinfo, #atc_ddd_link, #atc_description, #comarketing, #complementary_type, #compositions, #ddd_price, #deductible, #fachinfo, #feedback, #google_search, #ikscat, #limitation_link, #limitation_text, #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 included from ExternalLinks

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

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Constructor Details

- (ExplainResult) initialize(model, session, container, components = nil)

A new instance of ExplainResult



37
38
39
40
# File 'src/view/resultfoot.rb', line 37

def initialize model, session, container, components=nil
  @components = components
  super model, session, container
end

Instance Method Details

- (Object) explain_anthroposophy(model, session = @session)



67
68
69
# File 'src/view/resultfoot.rb', line 67

def explain_anthroposophy(model, session=@session)
  [square(:anthroposophy), @lookandfeel.lookup(:explain_anthroposophy) ]
end

- (Object) explain_cas(model, session = @session)



113
114
115
116
117
118
# File 'src/view/resultfoot.rb', line 113

def explain_cas(model, session=@session)
  link = HtmlGrid::Link.new(:explain_cas,
    model, @session, self)
  link.href = "http://cas.org"
  link
end

- (Object) explain_comarketing(model, session = @session)



56
57
58
59
60
# File 'src/view/resultfoot.rb', line 56

def explain_comarketing(model, session=@session)
  link = HtmlGrid::Link.new(:square_comarketing, model, @session, self)
  link.href = CoMarketingPlugin::SOURCE_URI
  [square(:comarketing, link), @lookandfeel.lookup(:explain_comarketing) ]
end

- (Object) explain_complementary(model, session = @session)



70
71
72
73
74
# File 'src/view/resultfoot.rb', line 70

def explain_complementary(model, session=@session)
  link = HtmlGrid::Link.new(:square_complementary, model, session, self)
  link.href = @lookandfeel.lookup(:explain_complementary_url)
  [square(:complementary, link), @lookandfeel.lookup(:explain_complementary) ]
end

- (Object) explain_ddd_price(model, session = @session)



61
62
63
# File 'src/view/resultfoot.rb', line 61

def explain_ddd_price(model, session=@session)
  explain_link(model, :ddd_price)
end

- (Object) explain_deductible(model, session = @session)



64
65
66
# File 'src/view/resultfoot.rb', line 64

def explain_deductible(model, session=@session)
  explain_link(model, :deductible)
end

- (Object) explain_fachinfo(model, session = @session)



75
76
77
# File 'src/view/resultfoot.rb', line 75

def explain_fachinfo(model, session=@session)
  [square(:fachinfo), @lookandfeel.lookup(:explain_fachinfo) ]
end

- (Object) explain_feedback(model, session = @session)



78
79
80
# File 'src/view/resultfoot.rb', line 78

def explain_feedback(model, session=@session)
  [square(:feedback), @lookandfeel.lookup(:explain_feedback) ]
end

- (Object) explain_generic(model, session = @session)



81
82
83
# File 'src/view/resultfoot.rb', line 81

def explain_generic(model, session=@session)
  explain_link(model, :generic)
end

- (Object) explain_google_search(model, session = @session)



84
85
86
# File 'src/view/resultfoot.rb', line 84

def explain_google_search(model, session=@session)
  [square(:google_search), @lookandfeel.lookup(:explain_google_search) ]
end

- (Object) explain_homeopathy(model, session = @session)



99
100
101
# File 'src/view/resultfoot.rb', line 99

def explain_homeopathy(model, session=@session)
  [square(:homeopathy), @lookandfeel.lookup(:explain_homeopathy) ]
end

- (Object) explain_limitation(model, session = @session)



87
88
89
# File 'src/view/resultfoot.rb', line 87

def explain_limitation(model, session=@session)
  [square(:limitation), @lookandfeel.lookup(:explain_limitation) ]
end


127
128
129
130
131
132
133
134
# File 'src/view/resultfoot.rb', line 127

def explain_link(model, key)
  link = external_link(model, "explain_#{key}")
  unless @lookandfeel.disabled?(:explain_link)
    link.href = @lookandfeel.lookup("explain_#{key}_url")
  end
  link.attributes['class'] = "explain #{key}"
  link 
end

- (Object) explain_lppv(model, session = @session)



119
120
121
122
123
# File 'src/view/resultfoot.rb', line 119

def explain_lppv(model, session=@session)
  link = HtmlGrid::Link.new(:explain_lppv, model, @session, self)
  link.href = @lookandfeel.lookup(:lppv_url)
  link
end

- (Object) explain_minifi(model, session = @session)



90
91
92
# File 'src/view/resultfoot.rb', line 90

def explain_minifi(model, session=@session)
  [square(:minifi), @lookandfeel.lookup(:explain_minifi) ]
end

- (Object) explain_narc(model, session = @session)



124
125
126
# File 'src/view/resultfoot.rb', line 124

def explain_narc(model, session=@session)
  [square(:narc), @lookandfeel.lookup(:explain_narc) ]
end

- (Object) explain_original(model, session = @session)



93
94
95
# File 'src/view/resultfoot.rb', line 93

def explain_original(model, session=@session)
  explain_link(model, :original)
end

- (Object) explain_parallel_import(model, session = @session)



102
103
104
# File 'src/view/resultfoot.rb', line 102

def explain_parallel_import(model, session=@session)
  [square(:parallel_import), @lookandfeel.lookup(:explain_parallel_import) ]
end

- (Object) explain_patinfo(model, session = @session)



96
97
98
# File 'src/view/resultfoot.rb', line 96

def explain_patinfo(model, session=@session)
  [square(:patinfo), @lookandfeel.lookup(:explain_patinfo) ]
end

- (Object) explain_phytotherapy(model, session = @session)



105
106
107
# File 'src/view/resultfoot.rb', line 105

def explain_phytotherapy(model, session=@session)
  [square(:phytotherapy), @lookandfeel.lookup(:explain_phytotherapy) ]
end

- (Object) explain_vaccine(model, session = @session)



108
109
110
111
112
# File 'src/view/resultfoot.rb', line 108

def explain_vaccine(model, session=@session)
  link = HtmlGrid::Link.new(:square_vaccines, model, session, self)
  link.href = @lookandfeel.lookup(:explain_vaccine_url)
  [square(:vaccine, link), @lookandfeel.lookup(:explain_vaccine) ]
end

- (Object) init



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'src/view/resultfoot.rb', line 41

def init
  @components ||= @lookandfeel.explain_result_components
  width = 1
  height = 1
  @components.each { |key, val| 
    if(klass = CSS_KEYMAP[val])
      css_map.store(key, klass)
    end
    x, y, = key
    width = [x, width].max
    height = [y.next, height].max
  }
  @css_map.store([0, 0, width.next, height], 'infos')
  super
end