Class: InventoryRequestPresenter
- Inherits:
-
Object
- Object
- InventoryRequestPresenter
- Defined in:
- app/presenters/inventory_request_presenter.rb
Instance Attribute Summary collapse
-
#inventory_request ⇒ Object
readonly
Returns the value of attribute inventory_request.
Instance Method Summary collapse
- #delete_path ⇒ Object
- #download_link ⇒ Object
- #expiration ⇒ Object
-
#initialize(inventory_request) ⇒ InventoryRequestPresenter
constructor
A new instance of InventoryRequestPresenter.
- #list_contents_url ⇒ Object
- #partial_name ⇒ Object
- #review_path ⇒ Object
- #size ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(inventory_request) ⇒ InventoryRequestPresenter
Returns a new instance of InventoryRequestPresenter.
7 8 9 |
# File 'app/presenters/inventory_request_presenter.rb', line 7 def initialize(inventory_request) @inventory_request = inventory_request end |
Instance Attribute Details
#inventory_request ⇒ Object (readonly)
Returns the value of attribute inventory_request.
3 4 5 |
# File 'app/presenters/inventory_request_presenter.rb', line 3 def inventory_request @inventory_request end |
Instance Method Details
#delete_path ⇒ Object
43 44 45 |
# File 'app/presenters/inventory_request_presenter.rb', line 43 def delete_path url_helpers.new_project_review_and_submit_path(inventory_request.id) end |
#download_link ⇒ Object
27 28 29 |
# File 'app/presenters/inventory_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/inventory_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/inventory_request_presenter.rb', line 11 def list_contents_url url_helpers.project_list_contents_path(inventory_request.project) end |
#partial_name ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/presenters/inventory_request_presenter.rb', line 15 def partial_name if inventory_request.state == InventoryRequest::COMPLETED "download_item" elsif inventory_request.state == InventoryRequest::FAILED "failed_item" end end |
#review_path ⇒ Object
39 40 41 |
# File 'app/presenters/inventory_request_presenter.rb', line 39 def review_path url_helpers.new_project_review_and_submit_path(inventory_request.id) end |
#size ⇒ Object
35 36 37 |
# File 'app/presenters/inventory_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/inventory_request_presenter.rb', line 23 def title request_details["project_title"] end |