Module: Decidim::CommandUtils

Included in:
Solutions::Admin::CreateSolution, Solutions::Admin::UpdateSolution, Solutions::CreateSolution
Defined in:
app/commands/decidim/command_utils.rb

Instance Method Summary collapse

Instance Method Details

#challenge_idObject



9
10
11
12
13
14
15
16
17
18
# File 'app/commands/decidim/command_utils.rb', line 9

def challenge_id
  challenge = form.decidim_challenges_challenge_id
  problem = Decidim::Problems::Problem.find_by(id: form.decidim_problems_problem_id)

  if challenge.present?
    Decidim::Challenges::Challenge.find(form.decidim_challenges_challenge_id).id
  else
    problem&.decidim_challenges_challenge_id.presence
  end
end

#parsed_attribute(attribute) ⇒ Object



5
6
7
# File 'app/commands/decidim/command_utils.rb', line 5

def parsed_attribute(attribute)
  Decidim::ContentProcessor.parse_with_processor(:hashtag, form.send(attribute), current_organization: form.current_organization).rewrite
end