Module: ProjectMembersHelper

Defined in:
app/helpers/project_members_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
# File 'app/helpers/project_members_helper.rb', line 3

def add_project_member_link(project_id)
  link_to('Add project member', new_project_member_path(project_member: {project_id: project_id} )) if is_superuser?
end

#user_last_seen_in_project_tag(project_member) ⇒ Object



7
8
9
10
11
12
13
# File 'app/helpers/project_members_helper.rb', line 7

def user_last_seen_in_project_tag(project_member)
  if !project_member.last_seen_at.blank?
    time_ago_in_words(project_member.last_seen_at) + '  ago'
  else
    (:em, 'never')
  end
end

#user_time_active_in_project(project_member) ⇒ Object

In hours



16
17
18
# File 'app/helpers/project_members_helper.rb', line 16

def user_time_active_in_project(project_member)
  (project_member.time_active.to_f / 3600.to_f || 0.0).round(1)
end

#user_time_active_in_project_tag(project_member) ⇒ Object

In hours



21
22
23
24
25
26
27
28
29
# File 'app/helpers/project_members_helper.rb', line 21

def user_time_active_in_project_tag(project_member)
  t = user_time_active_in_project(project_member)

  if t == 0.0
    nil
  else
    (project_member.time_active.to_f / 3600.to_f || 0.0).round(1).to_s + ' hours'
  end
end