Class: Lcms::Engine::ResourceDetailsSerializer
- Inherits:
-
ResourceSerializer
- Object
- ActiveModel::Serializer
- ResourceSerializer
- Lcms::Engine::ResourceDetailsSerializer
- Includes:
- ResourceHelper
- Defined in:
- app/serializers/lcms/engine/resource_details_serializer.rb
Overview
This is a superset of ResourceSerializer, meant to be used were we need associations and other info. Currently is used on ExploreCurriculums (together with the CurriculumResourceSerializer)
Instance Method Summary collapse
- #copyright ⇒ Object
- #downloads ⇒ Object
-
#has_related ⇒ Object
rubocop:disable Naming/PredicateName.
- #opr_standards ⇒ Object
Methods included from ResourceHelper
#back_to_resource_path, #copyrights_text, #download_per_category_limit, #prerequisites_standards, #resource_breadcrumbs_with_links, #show_resource_path, #type_name
Methods inherited from ResourceSerializer
#breadcrumb_title, #grade, #is_assessment, #is_foundational, #is_opr, #is_prerequisite, #path, #type
Instance Method Details
#copyright ⇒ Object
32 33 34 |
# File 'app/serializers/lcms/engine/resource_details_serializer.rb', line 32 def copyright copyrights_text(object) end |
#downloads ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/serializers/lcms/engine/resource_details_serializer.rb', line 15 def downloads serialize_download = lambda do |download| next unless download.is_a?(ResourceDownload) indent = object.pdf_downloads? download.download_category { id: download.id, icon: h.file_icon(download.download.), title: download.download.title, url: download_path(download, slug: object.slug), preview_url: preview_download_path(id: download, slug: object.slug), indent: indent } end object.download_categories.map { |k, v| [k, v.map(&serialize_download)] } end |
#has_related ⇒ Object
rubocop:disable Naming/PredicateName
36 37 38 |
# File 'app/serializers/lcms/engine/resource_details_serializer.rb', line 36 def # rubocop:disable Naming/PredicateName false end |
#opr_standards ⇒ Object
40 41 42 43 44 |
# File 'app/serializers/lcms/engine/resource_details_serializer.rb', line 40 def opr_standards return unless object.opr? && object.document.present? DocumentGenerator.document_presenter.new(object.document).standards end |