Sha256: 1090a0196adab7eb197c8d9be568464cd6ee1a4255c3b3b483e277323ba7395b

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

module Pageflow
  module LinkmapPage
    class PageType < Pageflow::PageType
      name 'linkmap_page'

      def file_types
        [
          LinkmapPage.color_map_file_type,
          LinkmapPage.masked_image_file_type
        ]
      end

      def view_helpers
        [AreasHelper]
      end

      def thumbnail_candidates
        [
          {attribute: 'thumbnail_image_id', file_collection: 'image_files'},
          {attribute: 'panorama_image_id', file_collection: 'image_files'},
          {attribute: 'panorama_video_id', file_collection: 'video_files'}
        ]
      end
    end

    def self.color_map_file_type
      FileType.new(model: ColorMapFile,
                   custom_attributes: [:source_image_file_id],
                   partial: 'pageflow/linkmap_page/color_map_files/color_map_file',
                   editor_partial: 'pageflow/linkmap_page/editor/color_map_files/color_map_file')
    end

    def self.masked_image_file_type
      FileType.new(model: MaskedImageFile,
                   custom_attributes: [:source_image_file_id, :color_map_file_id],
                   editor_partial: 'pageflow/linkmap_page/editor/' \
                     'masked_image_files/masked_image_file',
                   css_background_image_urls: lambda do |masked_image_file|
                     masked_image_file.present_styles.each_with_object({}) do |color, result|
                       result[color] = masked_image_file.url_for_color(color)
                     end
                   end)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-linkmap-page-2.5.0 lib/pageflow/linkmap_page/page_type.rb
pageflow-linkmap-page-2.4.0 lib/pageflow/linkmap_page/page_type.rb
pageflow-linkmap-page-2.3.0 lib/pageflow/linkmap_page/page_type.rb
pageflow-linkmap-page-2.2.0 lib/pageflow/linkmap_page/page_type.rb
pageflow-linkmap-page-2.1.0 lib/pageflow/linkmap_page/page_type.rb
pageflow-linkmap-page-2.0.0 lib/pageflow/linkmap_page/page_type.rb