Class: ODDB::Html::View::Drugs::Admin::CompositionList

Inherits:
HtmlGrid::DivList
  • Object
show all
Defined in:
lib/oddb/html/view/drugs/admin/sequence.rb

Constant Summary collapse

COMPONENTS =
{ [0,0] => :composition }
OFFSET_STEP =
[1,0]
OMIT_HEADER =
true

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#list_indexObject (readonly)

Returns the value of attribute list_index.



115
116
117
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 115

def list_index
  @list_index
end

Instance Method Details

#add(model) ⇒ Object



116
117
118
119
120
121
122
123
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 116

def add(model)
  link = HtmlGrid::Link.new(:create_composition, model, @session, self)
  link.css_class = 'ajax'
  args = [ :uid, @session.state.model.uid ]
  url = @session.lookandfeel.event_url(:ajax_create_composition, args)
  link.onclick = "replace_element('composition-list', '#{url}');"
  link
end

#composeObject



124
125
126
127
128
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 124

def compose
  super
  comp = @model.last
  @grid.push [add(@model)] if comp.nil? || !comp.active_agents.compact.empty?
end

#composition(model) ⇒ Object



129
130
131
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 129

def composition(model)
  ActiveAgents.new(model.active_agents, @session, self)
end