Skip to content

Commit aacb811

Browse files
committed
Add page position id method
This will be used to identify the corresponding id for the appropriate element on the routes page matching the page in that position, so that it can be anchored to by links going to that page.
1 parent bceb5bc commit aacb811

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

app/models/page.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ def normalise_welsh!
133133
routing_conditions.each(&:normalise_welsh!)
134134
end
135135

136+
def page_position_id
137+
"page-#{position}"
138+
end
139+
136140
private
137141

138142
def guidance_fields_presence

spec/models/page_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,4 +872,10 @@
872872
end
873873
end
874874
end
875+
876+
describe "#page_position_id" do
877+
it "returns a string for the page position id" do
878+
expect(page.page_position_id).to eq "page-#{page.position}"
879+
end
880+
end
875881
end

0 commit comments

Comments
 (0)