Class: UserRequestPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/user_request_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_request) ⇒ UserRequestPresenter

Returns a new instance of UserRequestPresenter.



7
8
9
# File 'app/presenters/user_request_presenter.rb', line 7

def initialize(user_request)
  @user_request = user_request
end

Instance Attribute Details

#user_requestObject (readonly)

Returns the value of attribute user_request.



3
4
5
# File 'app/presenters/user_request_presenter.rb', line 3

def user_request
  @user_request
end

Instance Method Details



27
28
29
# File 'app/presenters/user_request_presenter.rb', line 27

def download_link
  helpers.link_to(title, url_helpers.project_file_list_download_path(job_id: job_id))
end

#expirationObject



31
32
33
# File 'app/presenters/user_request_presenter.rb', line 31

def expiration
  "Expires in #{helpers.time_ago_in_words(expiration_date)}"
end

#list_contents_urlObject



11
12
13
# File 'app/presenters/user_request_presenter.rb', line 11

def list_contents_url
  url_helpers.project_list_contents_path(user_request.project)
end

#partial_nameObject



15
16
17
18
19
20
21
# File 'app/presenters/user_request_presenter.rb', line 15

def partial_name
  if user_request.state == UserRequest::COMPLETED
    "download_item"
  elsif user_request.state == UserRequest::FAILED
    "failed_item"
  end
end

#sizeObject



35
36
37
# File 'app/presenters/user_request_presenter.rb', line 35

def size
  helpers.number_to_human_size(request_details["file_size"])
end

#titleObject



23
24
25
# File 'app/presenters/user_request_presenter.rb', line 23

def title
  request_details["project_title"]
end