Module: CodeObjectsHelper

Defined in:
app/helpers/code_objects_helper.rb

Instance Method Summary collapse

Instance Method Details


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

def link_to_code_object(revision, code_object)
  branch = revision.branch
  project = branch.project
  path = code_object_path(project, branch.name, revision.uid, :code_object => code_object)
  link_to code_object.fullname, path, :"data-code_object-id" => code_object.id, :remote => true, :method => :get
end

#show_code_object_location?(project = @project) ⇒ Boolean

Returns:

  • (Boolean)

15
16
17
# File 'app/helpers/code_objects_helper.rb', line 15

def show_code_object_location?(project = @project)
  %w(javascript nodejs).include?(project.language.to_s.downcase)
end

#url_on_github(filename, line_no = nil) ⇒ Object


10
11
12
13
# File 'app/helpers/code_objects_helper.rb', line 10

def url_on_github(filename, line_no = nil)
  base = "https://github.com/#{@project.user_name}/#{@project.repo_name}/blob/#{@revision.uid}/#{filename}"
  line_no ? "#{base}#L#{line_no}" : base
end