Class: ODDB::View::Interactions::BasketSubstrates

Inherits:
HtmlGrid::List show all
Defined in:
src/view/interactions/basket.rb

Constant Summary

BACKGROUND_SUFFIX =
' bg'
COMPONENTS =
{
  [0,0]   => :substance,
  [1,0]   => :cyp450s,
  [2,0]   => :inducers,
  [3,0]   => :inhibitors,
  [4,0]   =>  :observed,
}
CSS_MAP =
{
  [0,0]   => 'bold interaction-substance',
  [1,0,3] =>  'interaction-connection',
  [4,0]   =>  'list',
}
CSS_HEAD_MAP =
{
  [0,0] =>  'th',
  [1,0] =>  'th',
  [2,0] =>  'th',
  [3,0] =>  'th',
}
CSS_CLASS =
'composite interaction-basket'
DEFAULT_CLASS =
HtmlGrid::Value
SORT_DEFAULT =
:substance
SUBHEADER =
View::Interactions::BasketHeader
LEGACY_INTERFACE =
false

Constants inherited from HtmlGrid::List

BACKGROUND_SUFFIX

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) list_index (readonly)

Returns the value of attribute list_index



123
124
125
# File 'src/view/interactions/basket.rb', line 123

def list_index
  @list_index
end

Instance Method Details

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



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'src/view/interactions/basket.rb', line 148

def cyp450s(model, session=@session)
  cyp450s = model.cyp450s
  unless(cyp450s.empty?)
    text = HtmlGrid::RichText.new(model, @session, self)
    str = cyp450s.keys.sort.join(', ')
    if(idx = str.rindex(','))
      str[idx,2] = @lookandfeel.lookup(:nbsp_and_nbsp)
    end
    text << "<b>" << str << "</b>"
    links = []
    cyp450s.sort.each { |key, item|
      links.concat item.links
    }
    links.uniq!
    links.delete_if { |lnk| lnk.empty? }
    unless(links.empty?)
      text << '<br>'
      fspan = HtmlGrid::Span.new(@model, @session, self)
      fspan.value = @lookandfeel.lookup(:flockhart_link)
      fspan.css_class = 'italic'
      text << fspan
      links.each { |link|
        if(href = link.href)
          alink = HtmlGrid::Link.new(:abstract_link, @model, @session, self)
          alink.href = href
          alink.value = link.text
          text << "<br>"
          text << alink
          text << "<br>"
          text << link.info
        end
      }
    end
    text
  end
end

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



187
188
189
# File 'src/view/interactions/basket.rb', line 187

def inducers(model, session=@session)
  interaction_list(model, :inducers)
end

- (Object) inhibitors(model, session = @sessino)



184
185
186
# File 'src/view/interactions/basket.rb', line 184

def inhibitors(model, session=@sessino)
  interaction_list(model, :inhibitors)
end

- (Object) interaction_list(model, type)



190
191
192
193
194
195
196
197
198
# File 'src/view/interactions/basket.rb', line 190

def interaction_list(model, type)
  mdl = model.send(type)
  if(mdl && !mdl.empty?)
    list = CyP450List.new(type, mdl, @session, self)
    sub = model.substance
    list.base_substance = sub.effective_form || sub
    list
  end
end

- (Object) observed(model)



199
200
201
# File 'src/view/interactions/basket.rb', line 199

def observed(model)
  FiList.new(model.observed, @session, self)
end

- (Object) substance(model)



202
203
204
205
206
207
208
209
210
211
# File 'src/view/interactions/basket.rb', line 202

def substance(model)
  sub = model.substance
  lang = @session.language
  name = sub.send(lang)
  if(sub.has_effective_form? && !sub.is_effective_form?)
    sprintf("%s (%s)", sub.effective_form.send(lang), name)
  else
    name
  end
end