Class: ProjectDashboardPresenter
  
  
  
  Instance Attribute Summary
  
  
  #project, #project_metadata
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  
  #created, #data_manager, #data_sponsor, #description, #formatted_quota_percentage, #formatted_storage_capacity, #initialize, #project_directory, #project_in_rails?, #project_purpose, #quota_percentage, #quota_usage, #storage_capacity, #title, #to_xml, #updated, #xml_document, xml_presenter_class
  
    Instance Method Details
    
      
  
  
    #last_activity  ⇒ Object 
  
  
  
  
    
      
26
27
28
29
30
31
32 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 26
def last_activity
  if project_metadata.updated_on.nil?
    "Not yet active"
  else
    "#{remove_about time_ago_in_words(project_metadata.updated_on)} ago"
  end
end
     | 
  
 
    
      
  
  
    #latest_file_list_time  ⇒ Object 
  
  
  
  
    
      
15
16
17
18
19
20
21
22
23
24 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 15
def latest_file_list_time
  requests = FileInventoryRequest.where(project_id: project.id).order(completion_time: :desc)
  if requests.empty?
    "No Downloads"
  elsif requests.first.completion_time
    "Prepared #{time_ago_in_words(requests.first.completion_time)} ago"
  else
    "Preparing now"
  end
end
     | 
  
 
    
      
  
  
    #path  ⇒ Object 
  
  
  
  
    
      
44
45
46 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 44
def path
  "/#{project_metadata.project_directory}"
end
     | 
  
 
    
      
  
  
    #remove_about(time_ago)  ⇒ Object 
  
  
  
  
    
Removes “about” (as in “about 1 month ago”) from time_ago_in_words
   
 
  
  
    
      
49
50
51 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 49
def remove_about(time_ago)
  time_ago.gsub("about ", "")
end
     | 
  
 
    
      
  
  
    #role(user)  ⇒ Object 
  
  
  
  
    
      
34
35
36
37
38
39
40
41
42 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 34
def role(user)
  if  == user.uid
    "Sponsor"
  elsif data_manager == user.uid
    "Data Manager"
  else
    "Data User"
  end
end
     | 
  
 
    
      
  
  
    #type  ⇒ Object 
  
  
  
  
    
      
7
8
9
10
11
12
13 
     | 
    
      # File 'app/presenters/project_dashboard_presenter.rb', line 7
def type
  if storage_performance_expectations["approved"].nil?
    "Requested #{storage_performance_expectations['requested']}"
  else
    storage_performance_expectations["approved"]
  end
end
     |