Class: ODDB::View::Drugs::FiChapterChooserLink

Inherits:
HtmlGrid::Link
  • Object
show all
Defined in:
src/view/drugs/fachinfo.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) init



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'src/view/drugs/fachinfo.rb', line 15

def init
  @document = @model.send(@session.language)
  if(@document.respond_to?(:amzv))
    @value = @lookandfeel.lookup("fi_#{@name.to_s}_amzv")
  end
  @value ||= @lookandfeel.lookup("fi_" << @name.to_s)
  @attributes['title'] = if(@document.respond_to?(@name) \
    && (chapter = @document.send(@name)))
    title = chapter.heading
    if(title.empty? && (section = chapter.sections.first))
      section.subheading
    else
      title
    end
  else
    @lookandfeel.lookup(@name)
  end
  args = [
    :chapter, @name,
    :pointer, @model.pointer,
  ]
  unless(@session.user_input(:chapter) == @name.to_s)
    if(@model.pointer.skeleton == [:create])
      self.href = @lookandfeel.event_url(:self, {:chapter => @name})
    else
      self.href = @lookandfeel._event_url(:resolve, args)
    end
  end
end