Class: ODDB::Html::View::Drugs::Packages
Constant Summary
collapse
- EMPTY_LIST_KEY =
:empty_packages
Constants inherited
from List
List::BACKGROUND_ROW, List::BACKGROUND_SUFFIX, List::LEGACY_INTERFACE, List::SORT_DEFAULT
Instance Method Summary
collapse
-
#atc(model) ⇒ Object
-
#atc_assign ⇒ Object
-
#atc_code(model) ⇒ Object
-
#atc_opener(model, txt) ⇒ Object
-
#code_prescription(model) ⇒ Object
-
#compose_empty_list(offset) ⇒ Object
-
#compose_list(model = @model, offset = [0,0]) ⇒ Object
-
#compose_row(content, offset, attrs = {}) ⇒ Object
-
#compose_subheader(model, offset, selected = false) ⇒ Object
-
#ddd_link(atc) ⇒ Object
-
#display_switcher(model) ⇒ Object
-
#ikscat(model) ⇒ Object
-
#infos_local(model) ⇒ Object
-
#infos_remote(model) ⇒ Object
-
#init ⇒ Object
-
#package_infos(model) ⇒ Object
-
#query_args ⇒ Object
-
#variable_link(key, value, text, anchor = nil) ⇒ Object
Methods included from Google
#google
#company
#active_agents, #adjust_price, #code_boolean, #code_festbetragsgruppe, #code_festbetragsstufe, #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_key, #sort_link
Instance Method Details
#atc(model) ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/oddb/html/view/drugs/result.rb', line 85
def atc(model)
description = @lookandfeel.lookup(:atc_unknown)
parts = []
atc = model.atc
if(atc.nil? \
&& @session.allowed?('login', ODDB.config.auth_domain + '.Admin'))
parts.push AtcAssign.new(atc, @session, self)
end
if(atc)
description = sprintf("%s (%s)",
atc.name.send(@session.language), atc.code)
parts.push ddd_link(atc)
end
txt = sprintf("%s - %i %s", description, model.size,
@lookandfeel.lookup(:packages))
if(@model.overflow?)
parts.push atc_opener(atc, txt)
else
parts.push txt
end
if(@model.overflow? && @model.paged?)
parts.push Pager.new(@model, @session, self)
end
parts.reverse
end
|
#atc_assign ⇒ Object
110
111
112
113
114
115
116
117
118
|
# File 'lib/oddb/html/view/drugs/result.rb', line 110
def atc_assign
div = HtmlGrid::DivForm.new(nil, @session, self)
div.extend(HtmlGrid::FormMethods)
div.value = [
@lookandfeel.lookup(:atc_assign),
HtmlGrid::Input.new(:atc_assign, nil, @session, self),
]
div
end
|
#atc_code(model) ⇒ Object
119
120
121
|
# File 'lib/oddb/html/view/drugs/result.rb', line 119
def atc_code(model)
model ? model.code : 'X'
end
|
#atc_opener(model, txt) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/oddb/html/view/drugs/result.rb', line 122
def atc_opener(model, txt)
code = atc_code(model)
if(code == @session.persistent_user_input(:code))
link = HtmlGrid::Link.new(code, model, @session, self)
unless(code == 'X')
link.href = @lookandfeel._event_url(:search, [:query, code,
:dstype, :compare])
end
link.value = txt
link
else
variable_link(:code, code, txt, code)
end
end
|
#code_prescription(model) ⇒ Object
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/oddb/html/view/drugs/result.rb', line 136
def code_prescription(model)
if code = model.code(:prescription)
span = HtmlGrid::Span.new(model, @session, self)
if code.value
span.value = @lookandfeel.lookup(:prescription_needed)
span.css_class = 'prescription'
else
span.value = @lookandfeel.lookup(:prescription_free)
span.css_class = 'otc'
end
span
end
end
|
#compose_empty_list(offset) ⇒ Object
149
150
151
152
153
154
155
|
# File 'lib/oddb/html/view/drugs/result.rb', line 149
def compose_empty_list(offset)
if(key = @model.error)
fill_row(offset, key, 'warn')
else
super(offset, 'info')
end
end
|
#compose_list(model = @model, offset = [0,0]) ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
# File 'lib/oddb/html/view/drugs/result.rb', line 156
def compose_list(model=@model, offset=[0,0])
code = @session.persistent_user_input(:code)
if(model.overflow?)
offset = compose_row(display_switcher(model), offset,
{'id' => 'display-switcher'})
end
@model.each { |part|
ccode = atc_code(part.atc)
offset = (part, offset,
model.overflow? && ccode == code)
if(@model.show_details? || (ccode == code))
offset = super(part, offset)
end
}
end
|
#compose_row(content, offset, attrs = {}) ⇒ Object
171
172
173
174
175
176
|
# File 'lib/oddb/html/view/drugs/result.rb', line 171
def compose_row(content, offset, attrs={})
@grid.add(content, *offset)
@grid.set_colspan(offset.at(0), offset.at(1), full_colspan)
@grid.set_row_attributes(attrs, offset.at(1), 1)
resolve_offset(offset, OFFSET_STEP)
end
|
177
178
179
180
181
182
183
|
# File 'lib/oddb/html/view/drugs/result.rb', line 177
def (model, offset, selected=false)
attrs = {'class' => 'groupheader'}
if(selected)
attrs.store('id', 'selected')
end
compose_row(atc(model), offset, attrs)
end
|
#ddd_link(atc) ⇒ Object
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/oddb/html/view/drugs/result.rb', line 184
def ddd_link(atc)
while(atc && !atc.interesting? && (code = atc.parent_code))
atc = ODDB::Drugs::Atc.find_by_code(code)
end
if(atc && atc.interesting?)
link = HtmlGrid::Link.new(:who_ddd, atc, @session, self)
link.href = @lookandfeel._event_url(:ddd, [:code, atc.code])
link.css_class = 'who-ddd square'
link
end
end
|
#display_switcher(model) ⇒ Object
195
196
197
198
199
200
201
|
# File 'lib/oddb/html/view/drugs/result.rb', line 195
def display_switcher(model)
disp = @session.cookie_set_or_get(:display)
disp = (disp == 'paged') ? 'grouped' : 'paged'
link = variable_link(:display, disp,
@lookandfeel.lookup("display_#{disp}"))
link
end
|
#ikscat(model) ⇒ Object
202
203
204
205
206
207
208
209
210
211
|
# File 'lib/oddb/html/view/drugs/result.rb', line 202
def ikscat(model)
span = HtmlGrid::Span.new(model, @session, self)
span.value = code = model.ikscat.to_s
if(code =~ /[AB]/)
span.css_class = 'prescription'
else
span.css_class = 'otc'
end
span
end
|
#infos_local(model) ⇒ Object
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
# File 'lib/oddb/html/view/drugs/result.rb', line 212
def infos_local(model)
code = model.code(:cid)
span = HtmlGrid::Span.new(model, @session, self)
span.css_id = "package_infos#{code}"
infos = [ code_festbetragsgruppe(model),
code_festbetragsstufe(model), code_zuzahlungsbefreit(model),
code_prescription(model) ].compact
unless infos.empty?
span.value = infos.zip(Array.new(infos.size - 1, ' / '))
span.dojo_tooltip = @lookandfeel._event_url(:package_infos,
[:cid, code])
span
end
end
|
#infos_remote(model) ⇒ Object
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/oddb/html/view/drugs/result.rb', line 226
def infos_remote(model)
span = HtmlGrid::Span.new(model, @session, self)
infos = [ ikscat(model) ]
uid = model.uid
if(model.sl_entry)
infos.unshift(@lookandfeel.lookup(:ch_sl))
end
span.css_id = "package_infos#{uid}"
span.dojo_tooltip = @lookandfeel._event_url(:remote_infos,
[:uid, uid])
span.value = infos.zip(Array.new(infos.size - 1, ' / '))
span
end
|
#init ⇒ Object
77
78
79
80
81
82
83
84
|
# File 'lib/oddb/html/view/drugs/result.rb', line 77
def init
@components = @lookandfeel.result_components
@components.each { |key, val|
css_map.store(key, val.to_s)
}
@css_head_map = @css_map
super
end
|
#package_infos(model) ⇒ Object
239
240
241
242
243
244
245
|
# File 'lib/oddb/html/view/drugs/result.rb', line 239
def package_infos(model)
if(model.is_a?(Remote::Drugs::Package))
infos_remote(model)
else
infos_local(model)
end
end
|
#query_args ⇒ Object
246
247
248
|
# File 'lib/oddb/html/view/drugs/result.rb', line 246
def query_args
[:dstype, @model.dstype]
end
|
#variable_link(key, value, text, anchor = nil) ⇒ Object
249
250
251
252
253
254
255
256
257
|
# File 'lib/oddb/html/view/drugs/result.rb', line 249
def variable_link(key, value, text, anchor=nil)
link = HtmlGrid::Link.new(key, @model, @session, self)
args = @session.state.direct_event
event = args.shift
args.push(key, value)
link.href = @lookandfeel._event_url(event, args, anchor)
link.value = text
link
end
|