app/forms/decidim/accountability/admin/result_form.rb in decidim-accountability-0.10.1 vs app/forms/decidim/accountability/admin/result_form.rb in decidim-accountability-0.11.0.pre1

- old
+ new

@@ -30,27 +30,27 @@ validates :parent, presence: true, if: ->(form) { form.parent_id.present? } validates :status, presence: true, if: ->(form) { form.decidim_accountability_status_id.present? } validate :scope_belongs_to_participatory_space_scope - delegate :categories, to: :current_feature + delegate :categories, to: :current_component def map_model(model) self.proposal_ids = model.linked_resources(:proposals, "included_proposals").pluck(:id) self.project_ids = model.linked_resources(:projects, "included_projects").pluck(:id) self.decidim_category_id = model.category.try(:id) end def proposals @proposals ||= Decidim.find_resource_manifest(:proposals) - .try(:resource_scope, current_feature) + .try(:resource_scope, current_component) &.where(id: proposal_ids) &.order(title: :asc) end def projects - @projects ||= Decidim.find_resource_manifest(:projects).try(:resource_scope, current_feature)&.order(title: :asc) + @projects ||= Decidim.find_resource_manifest(:projects).try(:resource_scope, current_component)&.order(title: :asc) &.select(:title, :id)&.map { |a| [a.title[I18n.locale.to_s], a.id] } end # Finds the Scope from the given decidim_scope_id, uses participatory space scope if missing. # @@ -69,14 +69,14 @@ def category @category ||= categories.find_by(id: decidim_category_id) end def parent - @parent ||= Decidim::Accountability::Result.find_by(feature: current_feature, id: parent_id) + @parent ||= Decidim::Accountability::Result.find_by(component: current_component, id: parent_id) end def status - @status ||= Decidim::Accountability::Status.find_by(feature: current_feature, id: decidim_accountability_status_id) + @status ||= Decidim::Accountability::Status.find_by(component: current_component, id: decidim_accountability_status_id) end private def scope_belongs_to_participatory_space_scope