Class: Lcms::Engine::GenericPresenter
Instance Method Summary
collapse
#categorized_downloads_list, #downloads_indent, #page_title, #subject_and_grade_title
Instance Method Details
#generic_title ⇒ Object
6
7
8
|
# File 'app/presenters/lcms/engine/generic_presenter.rb', line 6
def generic_title
"#{subject.try(:upcase)} #{grades.to_str}"
end
|
#pdf_preview_download ⇒ Object
20
21
22
|
# File 'app/presenters/lcms/engine/generic_presenter.rb', line 20
def pdf_preview_download
resource_downloads.find { |d| d.download.main? && d.download.attachment_content_type == 'pdf' }
end
|
#preview? ⇒ Boolean
14
15
16
17
18
|
# File 'app/presenters/lcms/engine/generic_presenter.rb', line 14
def preview?
downloads.any? { |d| d.main? && d.attachment_content_type == 'pdf' && RestClient.head(d.attachment_url) }
rescue RestClient::ExceptionWithResponse
false
end
|
#type_name ⇒ Object
10
11
12
|
# File 'app/presenters/lcms/engine/generic_presenter.rb', line 10
def type_name
I18n.t("resource_types.#{resource_type}")
end
|