Sha256: 3de1b73bf17ad4932f2fe966faa343f0c3675bd08e1ddffb969638ecff4a6ebb

Contents?: true

Size: 786 Bytes

Versions: 28

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Pages
    # Importer for Pages specific data (i.e. its page content).
    class DataImporter < Decidim::Importers::Importer
      def initialize(component)
        @component = component
      end

      # Creates a new Decidim::Pages::Page associated to the given **component**
      # for the serialized page object.
      #
      # @param serialized [Hash] The serialized data read from the import file.
      # @param _user [Decidim::User] The user performing the import.
      # @return [Decidim::Pages::Page] The imported page
      def import(serialized, _user)
        return unless serialized

        Page.create!(
          component: @component,
          body: serialized["body"]
        )
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
decidim-pages-0.29.1 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.4 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.27.9 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.29.0 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.3 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.27.8 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.29.0.rc4 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.29.0.rc3 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.29.0.rc2 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.29.0.rc1 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.2 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.27.7 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.1 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.27.6 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.26.10 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.26.9 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.0 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.27.5 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.0.rc5 app/serializers/decidim/pages/data_importer.rb
decidim-pages-0.28.0.rc4 app/serializers/decidim/pages/data_importer.rb