Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def new
authorize @plan

# Get all of the available funders and non-funder orgs
@funders = Org.funders.sort{|x,y| x.name <=> y.name }
@funders = Org.funders.joins(:templates).where(templates: {published: true}).uniq.sort{|x,y| x.name <=> y.name }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugly syntax but only generates 1 SQL query instead of looping through orgs/templates

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me and is easy to follow

@orgs = (Org.institutions + Org.managing_orgs).flatten.uniq.sort{|x,y| x.name <=> y.name }

# Get the current user's org
Expand Down
3 changes: 3 additions & 0 deletions app/views/plans/_plan_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@
<!-- If project has phases-->
<% phases = plan.template.phases %>
<% if phases.count == 1 %>
<div class="project_description">
<%= raw plan.template.description %>
</div>
<% phases.each do |phase| %>
<div class="move_2_right">
<%= link_to _('Answer questions'), edit_plan_phase_path(plan,phase), :class => 'btn btn-primary' %>
Expand Down