49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/decidim/assemblies/seeds.rb', line 49
def create_assembly!(parent: nil)
n = rand(2)
params = {
title: Decidim::Faker::Localized.sentence(word_count: 5),
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.sentence(word_count: 3)
end,
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
organization:,
hero_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? hero_image : nil,
banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil,
promoted: true,
published_at: 2.weeks.ago,
meta_scope: Decidim::Faker::Localized.word,
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
target: Decidim::Faker::Localized.sentence(word_count: 3),
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
scope: n.positive? ? Decidim::Scope.all.sample : nil,
purpose_of_action: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
creation_date: 1.day.from_now,
created_by: "others",
created_by_other: Decidim::Faker::Localized.word,
duration: 2.days.from_now,
included_at: 5.days.from_now,
closing_date: 5.days.from_now,
closing_date_reason: Decidim::Faker::Localized.sentence(word_count: 3),
internal_organisation: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
is_transparent: true,
special_features: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
twitter_handler: ::Faker::Lorem.word,
facebook_handler: ::Faker::Lorem.word,
instagram_handler: ::Faker::Lorem.word,
youtube_handler: ::Faker::Lorem.word,
github_handler: ::Faker::Lorem.word,
parent:
}
Decidim.traceability.perform_action!(
"publish",
Decidim::Assembly,
organization.users.first,
visibility: "all"
) do
Decidim::Assembly.create!(params)
end
end
|