Skip to content

Commit 2ade8fa

Browse files
committed
Tidy up methods in the view component
1 parent 02e9b16 commit 2ade8fa

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

app/components/cms/footer_component.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,24 @@ def initialize(data:)
1212
def get_model(key)
1313
@data.get_model(key)
1414
end
15+
16+
def company_logo
17+
get_model(:company_logo).render
18+
end
19+
20+
def company_logo_link
21+
get_model(:company_logo_link).value
22+
end
23+
24+
def funder_logo
25+
get_model(:funder_logo).render
26+
end
27+
28+
def funder_logo_link
29+
get_model(:funder_logo_link).value
30+
end
31+
32+
def link_blocks
33+
get_model(:link_block).link_blocks
34+
end
1535
end

app/components/cms/footer_component/footer_component.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<%= row.with_column("full") do %>
33
<div class="cms-footer-component-wrapper">
44
<div>
5-
<a href="<%= get_model(:company_logo_link).value %>">
6-
<%= render get_model(:company_logo).render %>
5+
<a href="<%= company_logo_link %>">
6+
<%= render company_logo %>
77
</a>
88
<p class="govuk-body-s cms-footer-component--funding-text">Funded by</p>
9-
<a href="<%= get_model(:funder_logo_link).value %>">
10-
<%= render get_model(:funder_logo).render %>
9+
<a href="<%= funder_logo_link %>">
10+
<%= render funder_logo %>
1111
</a>
1212
</div>
13-
<% get_model(:link_block).link_blocks.each do |block| %>
13+
<% link_blocks.each do |block| %>
1414
<div class="cms-footer-component__link-block">
1515
<% block.each do |link| %>
1616
<%= render link.render(additional_classes: ["govuk-footer__link", "ncce-link", "ncce-link--on-dark"]) %>

0 commit comments

Comments
 (0)