Sha256: 0bebea8975fedd628d45a012124cac1b8c32d693c27c057e40fdcc968fb4f646

Contents?: true

Size: 962 Bytes

Versions: 13

Compression:

Stored size: 962 Bytes

Contents

module GeoConcerns
  module FileSetActionsHelper
    def file_set_actions(presenter, locals = {})
      render file_set_actions_partial(presenter),
             locals.merge(file_set: presenter)
    end

    def file_set_actions_partial(file_set)
      format = file_set_actions_format(file_set)
      'geo_concerns/file_sets/actions/' +
        if format
          format
        else
          'default_actions'
        end
    end

    def file_set_actions_format(file_set)
      geo_mime_type = file_set.solr_document.fetch(:geo_mime_type_ssim, []).first
      if GeoConcerns::ImageFormatService.include?(geo_mime_type)
        'image_actions'
      elsif GeoConcerns::VectorFormatService.include?(geo_mime_type)
        'vector_actions'
      elsif GeoConcerns::RasterFormatService.include?(geo_mime_type)
        'raster_actions'
      elsif GeoConcerns::MetadataFormatService.include?(geo_mime_type)
        'metadata_actions'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.3.3 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.3.2 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.3.1 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.3.0 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.2.0 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.1.1 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.1.0 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.0.10 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.0.9 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.0.8 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.0.7 app/helpers/geo_concerns/file_set_actions_helper.rb
geo_concerns-0.0.6 app/helpers/geo_concerns/file_set_actions_helper.rb