Skip to content

Commit

Permalink
Fix proposal answer templates (#84)
Browse files Browse the repository at this point in the history
* remove extra code, override controller

* remove extra premissions spec

* fir order of avaliablity_options
  • Loading branch information
antopalidi authored Apr 23, 2024
1 parent 59ead81 commit 353bf20
Show file tree
Hide file tree
Showing 18 changed files with 15 additions and 621 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ module ProposalAnswerTemplatesControllerOverride
extend ActiveSupport::Concern

included do
def avaliablity_options
@avaliablity_options = []

Decidim::Component.includes(:participatory_space).where(manifest_name: accepted_components)
.select { |a| a.participatory_space.decidim_organization_id == current_organization.id }.each do |component|
@avaliablity_options.push [formatted_name(component), component.id]
end

@avaliablity_options.sort_by!(&:first)
@avaliablity_options.prepend [t("global_scope", scope: "decidim.templates.admin.proposal_answer_templates.index"), 0]
end

private

def accepted_components
[:proposals, :reporting_proposals]
end
Expand Down

This file was deleted.

Loading

0 comments on commit 353bf20

Please sign in to comment.