lib/decidim/initiatives/participatory_space.rb in decidim-initiatives-0.24.3 vs lib/decidim/initiatives/participatory_space.rb in decidim-initiatives-0.25.0.rc1
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
Decidim.register_participatory_space(:initiatives) do |participatory_space|
- participatory_space.icon = "decidim/initiatives/icon.svg"
+ participatory_space.icon = "media/images/decidim_initiatives.svg"
participatory_space.stylesheet = "decidim/initiatives/initiatives"
participatory_space.context(:public) do |context|
context.engine = Decidim::Initiatives::Engine
context.layout = "layouts/decidim/initiative"
@@ -19,10 +19,12 @@
end
participatory_space.query_type = "Decidim::Initiatives::InitiativeType"
participatory_space.register_resource(:initiative) do |resource|
+ resource.actions = %w(comment)
+ resource.permissions_class_name = "Decidim::Initiatives::Permissions"
resource.model_class_name = "Decidim::Initiative"
resource.card = "decidim/initiatives/initiative"
resource.searchable = true
end
@@ -57,11 +59,16 @@
3.times do |n|
type = Decidim::InitiativesType.create!(
title: Decidim::Faker::Localized.sentence(word_count: 5),
description: Decidim::Faker::Localized.sentence(word_count: 25),
organization: organization,
- banner_image: File.new(File.join(seeds_root, "city2.jpeg"))
+ banner_image: ActiveStorage::Blob.create_after_upload!(
+ io: File.open(File.join(seeds_root, "city2.jpeg")),
+ filename: "banner_image.jpeg",
+ content_type: "image/jpeg",
+ metadata: nil
+ )
)
organization.top_scopes.each do |scope|
Decidim::InitiativesTypeScope.create(
type: type,
@@ -102,10 +109,16 @@
Decidim::Attachment.create!(
title: Decidim::Faker::Localized.sentence(word_count: 2),
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: initiative,
- file: File.new(File.join(seeds_root, "city.jpeg"))
+ content_type: "image/jpeg",
+ file: ActiveStorage::Blob.create_after_upload!(
+ io: File.open(File.join(seeds_root, "city.jpeg")),
+ filename: "city.jpeg",
+ content_type: "image/jpeg",
+ metadata: nil
+ )
)
Decidim::Initiatives.default_components.each do |component_name|
component = Decidim::Component.create!(
name: Decidim::Components::Namer.new(initiative.organization.available_locales, component_name).i18n_name,