Class: ODDB::Html::View::Drugs::Admin::CompositionSelect
- Inherits:
-
HtmlGrid::AbstractSelect
- Object
- HtmlGrid::AbstractSelect
- ODDB::Html::View::Drugs::Admin::CompositionSelect
- Defined in:
- lib/oddb/html/view/drugs/admin/package.rb
Instance Method Summary collapse
Instance Method Details
#selection(context) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 16 def selection(context) lang = @session.language @selected ||= (comp = @model.composition) && comp.to_s(lang) res = [] @model.sequence.compositions.each_with_index { |composition, idx| comp = composition.to_s(lang) attribs = { "value" => idx } attribs.store("selected", 1) if(comp == selected) res << context.option(attribs) { comp } } res end |