Sha256: a3a896ec7a0b842320289dfd11b21bcdc863ef2978827858ea396b68b3b3a812

Contents?: true

Size: 465 Bytes

Versions: 8

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Pages
    # Command that gets called whenever a feature's page has to be created. It
    # usually happens as a callback when the feature itself is created.
    class CreatePage < Rectify::Command
      def initialize(feature)
        @feature = feature
      end

      def call
        @page = Page.new(feature: @feature)

        @page.save ? broadcast(:ok) : broadcast(:invalid)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-pages-0.1.0 app/commands/decidim/pages/create_page.rb
decidim-0.1.0 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.0.8.1 app/commands/decidim/pages/create_page.rb
decidim-0.0.8.1 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.0.7 app/commands/decidim/pages/create_page.rb
decidim-0.0.7 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.0.6 app/commands/decidim/pages/create_page.rb
decidim-0.0.6 decidim-pages/app/commands/decidim/pages/create_page.rb