decidim-budgets/lib/decidim/budgets/feature.rb in decidim-0.0.3 vs decidim-budgets/lib/decidim/budgets/feature.rb in decidim-0.0.4
- old
+ new
@@ -6,10 +6,12 @@
feature.engine = Decidim::Budgets::ListEngine
feature.admin_engine = Decidim::Budgets::AdminEngine
feature.icon = "decidim/budgets/icon.svg"
feature.stylesheet = "decidim/budgets/budgets"
+ feature.actions = %(vote)
+
feature.on(:before_destroy) do |instance|
raise StandardError, "Can't remove this feature" if Decidim::Budgets::Project.where(feature: instance).any?
end
feature.register_resource do |resource|
@@ -32,10 +34,11 @@
next unless process.steps.any?
feature = Decidim::Feature.create!(
name: Decidim::Features::Namer.new(process.organization.available_locales, :budgets).i18n_name,
manifest_name: :budgets,
+ published_at: Time.current,
participatory_process: process
)
3.times do
project = Decidim::Budgets::Project.create!(
@@ -44,15 +47,23 @@
category: process.categories.sample,
title: Decidim::Faker::Localized.sentence(2),
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(3)
end,
- short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
- Decidim::Faker::Localized.paragraph(3)
- end,
budget: Faker::Number.number(8)
)
-
+ Decidim::Attachment.create!(
+ title: Decidim::Faker::Localized.sentence(2),
+ description: Decidim::Faker::Localized.sentence(5),
+ file: File.new(Decidim::Dev.asset("city.jpeg")),
+ attached_to: project
+ )
+ Decidim::Attachment.create!(
+ title: Decidim::Faker::Localized.sentence(2),
+ description: Decidim::Faker::Localized.sentence(5),
+ file: File.new(Decidim::Dev.asset("Exampledocument.pdf")),
+ attached_to: project
+ )
Decidim::Comments::Seed.comments_for(project)
end
end
end
end