49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
module JobsHelper
|
|
def total_progress_bar(job)
|
|
progress_bar(job.done_ratio,
|
|
legend: "#{job.done_ratio}%
|
|
(#{l_hours_short(job.total_time_logged)}/#{l_hours_short(job.total_time_budget)})",
|
|
class: "progress")
|
|
end
|
|
|
|
def progress_bar_for(budget)
|
|
progress_bar(budget.done_ratio,
|
|
legend: "#{budget.done_ratio}%
|
|
(#{l_hours_short(budget.total_time_logged)}/#{l_hours_short(budget.hours)})",
|
|
class: "progress")
|
|
end
|
|
|
|
def job_history_tabs
|
|
tabs = []
|
|
|
|
if @journals.present?
|
|
has_notes = @journals.any? { |journal| journal.notes.present? }
|
|
tabs <<
|
|
{
|
|
name: "history",
|
|
label: "History",
|
|
onclick: 'showJobHistory("history", this.href)',
|
|
partial: "jobs/tabs/history",
|
|
locals: {
|
|
job: @job,
|
|
journals: @journals
|
|
}
|
|
}
|
|
if has_notes
|
|
tabs << {
|
|
name: "notes",
|
|
label: "Notes",
|
|
onclick: 'showJobHistory("notes", this.href)',
|
|
}
|
|
end
|
|
end
|
|
tabs
|
|
end
|
|
|
|
def job_history_default_tab
|
|
return params[:tab] if params[:tab].present?
|
|
|
|
"history"
|
|
end
|
|
end
|