Class: Decidim::Feeds::Seeds

Inherits:
Seeds
  • Object
show all
Defined in:
lib/decidim/feeds/seeds.rb

Instance Method Summary collapse

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
# File 'lib/decidim/feeds/seeds.rb', line 8

def call
  # create_content_block!

  feed = create_feed!

  seed_components_manifests!(participatory_space: feed)

  # Decidim::ContentBlocksCreator.new(feed).create_default!
end

#create_feed!Object

def create_content_block! Decidim::ContentBlock.create( organization:, weight: 32, scope_name: :homepage, manifest_name: :highlighted_feeds, published_at: Time.current ) end



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/decidim/feeds/seeds.rb', line 28

def create_feed!
  params = {
    title: Decidim::Faker::Localized.sentence(word_count: 5),
    slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
    organization:,
    created_by: "others",
  }

  Decidim.traceability.perform_action!(
    "publish",
    Decidim::Feeds::Feed,
    organization.users.first,
    visibility: "all"
  ) do
    Decidim::Feeds::Feed.create!(params)
  end
end