decidim-meetings/lib/decidim/meetings/feature.rb in decidim-0.4.4 vs decidim-meetings/lib/decidim/meetings/feature.rb in decidim-0.5.0

- old
+ new

@@ -21,21 +21,37 @@ meetings = meetings.where("created_at >= ?", start_at) if start_at.present? meetings = meetings.where("created_at <= ?", end_at) if end_at.present? meetings.count end + feature.settings(:global) do |settings| + settings.attribute :announcement, type: :text, translated: true, editor: true + end + + feature.settings(:step) do |settings| + settings.attribute :announcement, type: :text, translated: true, editor: true + end + feature.seeds do |process| feature = Decidim::Feature.create!( name: Decidim::Features::Namer.new(process.organization.available_locales, :meetings).i18n_name, published_at: Time.current, manifest_name: :meetings, participatory_process: process ) + if process.scope + scopes = process.scope.descendants + global = process.scope + else + scopes = process.organization.scopes + global = nil + end + 3.times do meeting = Decidim::Meetings::Meeting.create!( feature: feature, - scope: process.organization.scopes.sample, + scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample, category: process.categories.sample, title: Decidim::Faker::Localized.sentence(2), description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do Decidim::Faker::Localized.paragraph(3) end,