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.4.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.0.rc3 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.0.rc2 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.1.0.rc1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.0.1 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.0.0 lib/locomotive/steam/repositories/content_type_repository.rb
locomotivecms_steam-1.0.0.rc10 lib/locomotive/steam/repositories/content_type_repository.rb