lib/decidim/pages/feature.rb in decidim-pages-0.5.1 vs lib/decidim/pages/feature.rb in decidim-pages-0.6.0
- old
+ new
@@ -30,44 +30,33 @@
pages = pages.where("created_at >= ?", start_at) if start_at.present?
pages = pages.where("created_at <= ?", end_at) if end_at.present?
pages.count
end
- feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
- pages = Decidim::Pages::Page.where(feature: features)
- pages = pages.where("created_at >= ?", start_at) if start_at.present?
- pages = pages.where("created_at <= ?", end_at) if end_at.present?
- Decidim::Comments::Comment.where(root_commentable: pages).count
- end
-
feature.settings(:global) do |settings|
- settings.attribute :comments_enabled, type: :boolean, default: true
settings.attribute :announcement, type: :text, translated: true, editor: true
end
feature.settings(:step) do |settings|
- settings.attribute :comments_blocked, type: :boolean, default: false
settings.attribute :announcement, type: :text, translated: true, editor: true
end
feature.register_resource do |resource|
resource.model_class_name = "Decidim::Pages::Page"
end
- feature.seeds do |process|
+ feature.seeds do |participatory_space|
feature = Decidim::Feature.create!(
- name: Decidim::Features::Namer.new(process.organization.available_locales, :pages).i18n_name,
+ name: Decidim::Features::Namer.new(participatory_space.organization.available_locales, :pages).i18n_name,
manifest_name: :pages,
published_at: Time.current,
- participatory_process: process
+ participatory_space: participatory_space
)
- page = Decidim::Pages::Page.create!(
+ Decidim::Pages::Page.create!(
feature: feature,
body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
Decidim::Faker::Localized.paragraph(3)
end
)
-
- Decidim::Comments::Seed.comments_for(page)
end
end