Create description_for_phase helper method at Budget, to make it easier to get non-active-phase description
This commit is contained in:
@@ -34,6 +34,10 @@ class Budget < ActiveRecord::Base
|
|||||||
scope :current, -> { where.not(phase: "finished") }
|
scope :current, -> { where.not(phase: "finished") }
|
||||||
|
|
||||||
def description
|
def description
|
||||||
|
description_for_phase(phase)
|
||||||
|
end
|
||||||
|
|
||||||
|
def description_for_phase(phase)
|
||||||
send("description_#{phase}").try(:html_safe)
|
send("description_#{phase}").try(:html_safe)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
|
<% 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 %>
|
<% provide :social_media_meta_tags do %>
|
||||||
<%= render "shared/social_media_meta_tags",
|
<%= render "shared/social_media_meta_tags",
|
||||||
social_url: budget_results_url(@budget),
|
social_url: budget_results_url(@budget),
|
||||||
social_title: @budget.name,
|
social_title: @budget.name,
|
||||||
social_description: @budget.description_finished %>
|
social_description: @budget.description_for_phase('finished') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% content_for :canonical do %>
|
<% content_for :canonical do %>
|
||||||
<%= render "shared/canonical", href: budget_results_url(@budget) %>
|
<%= render "shared/canonical", href: budget_results_url(@budget) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user