Sha256: 6fd6b531c6e383cd8e8c0fceb1860d46f7a69d3588d68af0a14649351b984197

Contents?: true

Size: 466 Bytes

Versions: 56

Compression:

Stored size: 466 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

56 entries across 56 versions & 2 rubygems

Version Path
decidim-pages-0.4.3 app/commands/decidim/pages/create_page.rb
decidim-pages-0.4.2 app/commands/decidim/pages/create_page.rb
decidim-pages-0.4.1 app/commands/decidim/pages/create_page.rb
decidim-0.4.3 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-0.4.2 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-0.4.1 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.4.0 app/commands/decidim/pages/create_page.rb
decidim-0.4.0 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.3.2 app/commands/decidim/pages/create_page.rb
decidim-0.3.2 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.3.1 app/commands/decidim/pages/create_page.rb
decidim-0.3.1 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.3.0 app/commands/decidim/pages/create_page.rb
decidim-0.3.0 decidim-pages/app/commands/decidim/pages/create_page.rb
decidim-pages-0.2.0 app/commands/decidim/pages/create_page.rb
decidim-0.2.0 decidim-pages/app/commands/decidim/pages/create_page.rb