Module: Jsdoc::DocumentationHelper

Defined in:
app/helpers/jsdoc/documentation_helper.rb

Instance Method Summary collapse

Instance Method Details

#anchorName(member) ⇒ Object



44
45
46
47
48
49
50
51
# File 'app/helpers/jsdoc/documentation_helper.rb', line 44

def anchorName(member)
  anchor = ''

  anchor += 'static_' if member.is_static
  anchor += 'method_' if member.is_a?(Jsdoc::Function) and member.symbol.present?
  anchor += 'property_' if member.is_a?(Jsdoc::Property)
  anchor += member.name
end

#full_class_listObject



53
54
55
56
57
58
59
60
# File 'app/helpers/jsdoc/documentation_helper.rb', line 53

def full_class_list
  output = '<ul>'
  Jsdoc::Symbol.where(:member_of => nil).each do |child|
    output += '<li>' + link_to(list_namespace(child), symbol_path(child.alias)) + '</li>'
  end
  output += '</ul>'
  return output.html_safe
end


76
77
78
79
80
81
82
83
# File 'app/helpers/jsdoc/documentation_helper.rb', line 76

def link_to_symbol(symbol_type)
  return nil if symbol_type.blank?

  symbol = Jsdoc::Symbol.where(:alias => symbol_type).first
  return symbol_type if symbol.nil?

  return link_to(symbol_type, symbol.alias)
end

#list_namespace(namespace) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/helpers/jsdoc/documentation_helper.rb', line 62

def list_namespace(namespace)
  output = namespace.name
  if namespace.children.size > 0
    output += '<ul>'
    for child in namespace.children
      output += '<li>' + link_to(list_namespace(child), symbol_path(child.alias)) + '</li>'
    end
    output += '</ul>'
  end


  return output.html_safe
end

#namespacesObject



40
41
42
# File 'app/helpers/jsdoc/documentation_helper.rb', line 40

def namespaces
  return Jsdoc::Symbol.namespaces
end

#raw_source_path(*args) ⇒ Object



27
28
29
30
31
32
33
# File 'app/helpers/jsdoc/documentation_helper.rb', line 27

def raw_source_path(*args)
  if Jsdoc::Engine.single_project
    version_raw_source_path(@version.version_number, *args)
  else
    project_raw_source_path(@project.slug, @version.version_number, *args)
  end
end

#source_path(*args) ⇒ Object



19
20
21
22
23
24
25
# File 'app/helpers/jsdoc/documentation_helper.rb', line 19

def source_path(*args)
  if Jsdoc::Engine.single_project
    version_source_path(@version.version_number, *args)
  else
    project_source_path(@project.slug, @version.version_number, *args)
  end
end

#symbol_path(*args) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/jsdoc/documentation_helper.rb', line 11

def symbol_path(*args)
  if Jsdoc::Engine.single_project
    version_symbol_path(@version.version_number, *args)
  else
    project_symbol_path(@project.slug, @version.version_number, *args)
  end
end

#symbolsObject



36
37
38
# File 'app/helpers/jsdoc/documentation_helper.rb', line 36

def symbols
  return Jsdoc::Symbol.order(:alias)
end

#welcome_path(*args) ⇒ Object

Path helpers



3
4
5
6
7
8
9
# File 'app/helpers/jsdoc/documentation_helper.rb', line 3

def welcome_path(*args)
  if Jsdoc::Engine.single_project
    version_welcome_path(@version.version_number, *args)
  else
    project_welcome_path(@project.slug, @version.version_number, *args)
  end
end