Sha256: cc7b409e717bba05a1988a8af94992ebae48171b76412f354e653f6512e1c869

Contents?: true

Size: 740 Bytes

Versions: 15

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

module Lcms
  module Engine
    module Partable
      def create_parts_for(template)
        template.parts.each do |part|
          document_parts.create!(
            active: true,
            anchor: part[:anchor],
            content: part[:content],
            context_type: part[:context_type],
            data: part[:data],
            materials: part[:materials],
            optional: part[:optional],
            part_type: part[:part_type],
            placeholder: part[:placeholder]
          )
        end
      end

      def layout(context_type)
        document_parts.where(part_type: :layout, context_type: DocumentPart.context_types[context_type.to_sym]).last
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.5.4 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.5.3 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.5.2 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.5.1 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.5.0 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.4.2 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.4.1 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.4.0 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.3.1 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.1.4 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.3.0 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.1.3 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.2.0 app/models/concerns/lcms/engine/partable.rb
lcms-engine-0.1.2 app/models/concerns/lcms/engine/partable.rb