Module: ProjectHelper

Defined in:
app/helpers/project_helper.rb

Instance Method Summary collapse

Instance Method Details

#project_label(project) ⇒ Object



28
29
30
31
# File 'app/helpers/project_helper.rb', line 28

def project_label(project)
  return '<b class="label unknown">&nbsp;</b>'.html_safe unless project
  "<b class=\"label #{project.color}\">#{h project.slug.gsub("_", " ")}</b>".html_safe
end

#with_most_recent_commit(project) ⇒ Object



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

def with_most_recent_commit(project)
  return if project.repo.nil?
  commit = project.find_commit_by_sha project.repo.branch("master")
  if commit
    commit.project = project.model # so that _Commit_ doesn't load project again
    yield commit
  end
end

#with_most_recent_release(project) ⇒ Object



12
13
14
15
16
17
18
# File 'app/helpers/project_helper.rb', line 12

def with_most_recent_release(project)
  release = @releases[project.id]
  if release
    release.project = project.model # so that _Release_ doesn't load project again
    yield release
  end
end

#with_most_recent_test_run(project) ⇒ Object



20
21
22
23
24
25
26
# File 'app/helpers/project_helper.rb', line 20

def with_most_recent_test_run(project)
  test_run = @test_runs[project.id]
  if test_run
    test_run.project = project.model # so that _TestRun_ doesn't load project again
    yield test_run
  end
end