Class: UserRequestPresenter
- Inherits:
-
Object
- Object
- UserRequestPresenter
- Defined in:
- app/presenters/user_request_presenter.rb
Instance Attribute Summary collapse
-
#user_request ⇒ Object
readonly
Returns the value of attribute user_request.
Instance Method Summary collapse
- #download_link ⇒ Object
- #expiration ⇒ Object
-
#initialize(user_request) ⇒ UserRequestPresenter
constructor
A new instance of UserRequestPresenter.
- #list_contents_url ⇒ Object
- #partial_name ⇒ Object
- #size ⇒ Object
- #title ⇒ Object
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_request ⇒ Object (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
#download_link ⇒ Object
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 |
#expiration ⇒ Object
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_url ⇒ Object
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_name ⇒ Object
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 |
#size ⇒ Object
35 36 37 |
# File 'app/presenters/user_request_presenter.rb', line 35 def size helpers.number_to_human_size(request_details["file_size"]) end |
#title ⇒ Object
23 24 25 |
# File 'app/presenters/user_request_presenter.rb', line 23 def title request_details["project_title"] end |