Sha256: e25939596456babb51cf857f7f2a425aa1cdc8ba79209f9c829de1ed29956021

Contents?: true

Size: 909 Bytes

Versions: 54

Compression:

Stored size: 909 Bytes

Contents

module Locomotive
  module Steam

    class ContentTypeRepository

      include Models::Repository

      # Entity mapping
      mapping :content_types, entity: ContentType do
        embedded_association :entries_custom_fields, ContentTypeFieldRepository
      end

      def by_slug(slug_or_content_type)
        if slug_or_content_type.is_a?(String)
          query { where(slug: slug_or_content_type) }.first
        else
          slug_or_content_type
        end
      end

      def look_for_unique_fields(content_type)
        return nil if content_type.nil?
        content_type.fields.unique
      end

      def fields_for(content_type)
        return nil if content_type.nil?
        content_type.fields
      end

      def select_options(content_type, name)
        return nil if content_type.nil? || name.nil?
        content_type.fields.select_options(name.to_s)
      end

    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/repositories/content_type_repository.rb