Skip to content

Commit

Permalink
Apply fixes in create solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime committed Oct 14, 2024
1 parent c6bdbec commit 46ae5b1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def new

def create
enforce_permission_to :create, :solution
@form = form(Decidim::Solutions::Admin::SolutionsForm).from_params(params, author_id: current_user.id)
@form = form(Decidim::Solutions::Admin::SolutionsForm).from_params(params.merge({author_id: current_user.id}))

Decidim::Solutions::Admin::CreateSolution.call(@form) do
on(:ok) do
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/decidim/solutions/solutions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def new

def create
enforce_permission_to :create, :solution
@form = form(Decidim::Solutions::SolutionsForm).from_params(params,
author_id: current_user.id)
@form = form(Decidim::Solutions::SolutionsForm).from_params(params.merge({author_id: current_user.id}))

Decidim::Solutions::CreateSolution.call(@form) do
on(:ok) do
Expand Down
22 changes: 20 additions & 2 deletions app/views/decidim/solutions/solutions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
<% if current_participatory_space.components.where(manifest_name: "problems").present? && @solution.problem.present? %>
<div class="definition-data__item status">
<span class="definition-data__title"><%= t("status", scope: "activemodel.attributes.problem") %></span>
<%= t(@solution.problem.state, scope: "decidim.problems.states") %>
<% if @solution.author.admin? %>
<%= t(@solution.challenge.state, scope: "decidim.challenges.states") %>
<% else %>
<%= t(@solution.project_status, scope: "decidim.solutions.solutions.form.project_statuses") %>
<% end %>
</div>
<% else %>
<div class="definition-data__item status">
<span class="definition-data__title"><%= t("status", scope: "activemodel.attributes.problem") %></span>
<%= t(@solution.challenge.state, scope: "decidim.challenges.states") %>
<% if @solution.author.admin? %>
<%= t(@solution.challenge.state, scope: "decidim.challenges.states") %>
<% else %>
<%= t(@solution.project_status, scope: "decidim.solutions.solutions.form.project_statuses") %>
<% end %>
</div>
<% end %>
Expand Down Expand Up @@ -163,6 +171,16 @@
<h3><strong><%= t("tags", scope: "activemodel.attributes.solution") %></strong></h3>
<p class="tags"><%= present(@solution).tags %></p>
<% end %>
<% if present(@solution).project_url.present? %>
<h3><strong><%= t("project_url", scope: "activemodel.attributes.solution") %></strong></h3>
<%= link_to @solution.project_url, "http://#{@solution.project_url}", target: "_blank" %>
<% end %>
<% if present(@solution).coordinating_entity.present? %>
<h3><strong><%= t("coordinating_entity", scope: "activemodel.attributes.solution") %></strong></h3>
<p class="coordinating-entity"><%= present(@solution).coordinating_entity %></p>
<% end %>
</div>
</div>
</div>
Expand Down

0 comments on commit 46ae5b1

Please sign in to comment.