Skip to content

Commit da6e937

Browse files
Elle Meredithelle
authored andcommitted
Rename is_landing_page? to the Ruby convention
- Also added specs - And removed references for it in the graphql layout, since it can just be defined as false
1 parent 26debbd commit da6e937

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

app/controllers/pages_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def beta?
2828
end
2929
helper_method :beta?
3030

31-
def is_landing_page?
32-
@page && @page.is_landing_page?
31+
def landing_page?
32+
@page && @page.landing_page?
3333
end
34-
helper_method :is_landing_page?
34+
helper_method :landing_page?
3535

3636
def layout_by_path
3737
if request.path.starts_with? "/docs/apis/graphql"

app/models/page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def initialize(view, name)
8888
@name = name
8989
end
9090

91-
def is_landing_page?
91+
def landing_page?
9292
LandingPages.all.include? @name
9393
end
9494

app/views/layouts/application.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<main id="main" role="main">
99
<div class="Docs__page-container StandardWhiteContentPage">
1010
<div class="Docs__page-container__inner PageContainer">
11-
<div class="Docs__article<%= is_landing_page? ? ' Docs__article--is-landing-page' : '' %>">
11+
<div class="Docs__article<%= landing_page? ? ' Docs__article--is-landing-page' : '' %>">
1212
<div class="column1">
1313
<%= render "notification" %>
1414
<div class="TextContent">
1515
<%= yield %>
1616
</div>
17-
<%= render "footer", :embed_emojicom => !is_landing_page? %>
17+
<%= render "footer", :embed_emojicom => !landing_page? %>
1818
</div>
1919
<div class="column2"></div>
2020
</div>

app/views/layouts/graphql.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<main id="main" role="main">
99
<div class="Docs__page-container StandardWhiteContentPage">
1010
<div class="Docs__page-container__inner PageContainer">
11-
<div class="Docs__article<%= is_landing_page? ? ' Docs__article--is-landing-page' : '' %>">
11+
<div class="Docs__article">
1212
<div class="column1">
1313
<%= render "notification" %>
1414
<div class="TextContent">
1515
<%= yield %>
1616
</div>
17-
<%= render "footer", :embed_emojicom => !is_landing_page? %>
17+
<%= render "footer", :embed_emojicom => false %>
1818
</div>
1919
<div class="column2"></div>
2020
</div>

spec/models/page_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,24 @@
2020
end
2121
end
2222
end
23+
24+
describe "#landing_page?" do
25+
context "when page's path is defined in LandingPages" do
26+
it "returns true" do
27+
allow(LandingPages).to receive(:all).and_return(["integrations"])
28+
page = Page.new(double, "integrations")
29+
30+
expect(page).to be_landing_page
31+
end
32+
end
33+
34+
context "when page's path is not defined in the LandingPages" do
35+
it "returns false" do
36+
allow(LandingPages).to receive(:all).and_return([])
37+
page = Page.new(double, "apis/agent-api")
38+
39+
expect(page).not_to be_landing_page
40+
end
41+
end
42+
end
2343
end

0 commit comments

Comments
 (0)