Skip to content

Commit

Permalink
Create description_for_phase helper method at Budget, to make it easi…
Browse files Browse the repository at this point in the history
…er to get non-active-phase description
  • Loading branch information
bertocq committed Jan 16, 2018
1 parent 5016568 commit 153b46b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/budget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class Budget < ActiveRecord::Base
scope :current, -> { where.not(phase: "finished") }

def description
description_for_phase(phase)
end

def description_for_phase(phase)
send("description_#{phase}").try(:html_safe)
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/budgets/results/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
<% content_for :meta_description do %><%= @budget.description_finished %><% end %>
<% content_for :meta_description do %><%= @budget.description_for_phase('finished') %><% end %>
<% provide :social_media_meta_tags do %>
<%= render "shared/social_media_meta_tags",
social_url: budget_results_url(@budget),
social_title: @budget.name,
social_description: @budget.description_finished %>
social_description: @budget.description_for_phase('finished') %>
<% end %>
<% content_for :canonical do %>
<%= render "shared/canonical", href: budget_results_url(@budget) %>
Expand Down

0 comments on commit 153b46b

Please sign in to comment.