Class: ODDB::Html::View::Drugs::Admin::SequenceSelect
- Inherits:
-
HtmlGrid::AbstractSelect
- Object
- HtmlGrid::AbstractSelect
- ODDB::Html::View::Drugs::Admin::SequenceSelect
- Defined in:
- lib/oddb/html/view/drugs/admin/package.rb
Instance Method Summary collapse
Instance Method Details
#compositions(model) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 30 def compositions(model) lang = @session.language res = model.compositions.collect { |comp| comp.active_agents.collect { |act| [act.substance.name.send(lang), act.dose].join(' ') }.join(', ') }.join(' + ') if(res.length > 72) res[0,69] << '...' else res end end |
#selection(context) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 43 def selection(context) lang = @session.language @selected ||= (seq = @model.sequence) && seq.uid res = [] @model.product.sequences.each_with_index { |sequence, idx| uid = sequence.uid attribs = { "value" => uid } attribs.store("selected", 1) if(uid == selected) res << context.option(attribs) { compositions(sequence) } } res end |