Skip to content

Commit b67d05e

Browse files
committed
WIP
1 parent f0e1dd9 commit b67d05e

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

app/components/form_header_component/view.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def initialize(current_context:, mode:, hosting_environment: HostingEnvironment)
1212
def call
1313
if @current_context.present?
1414
homepage_url = @mode.preview? ? Settings.forms_admin.base_url : GOVUK_BASE_URL
15-
navigation_items = [{ text: "Your questions", href: your_questions_url }]
1615

1716
safe_join([
1817
govuk_header(homepage_url:,
@@ -67,7 +66,18 @@ def form_start_page_url
6766
form_path(mode: @mode.to_s, form_id: @current_context.form.id, form_slug: @current_context.form.form_slug)
6867
end
6968

69+
def navigation_items
70+
[
71+
{
72+
text: I18n.t("preview_header.your_questions"),
73+
href: your_questions_url,
74+
},
75+
]
76+
end
77+
7078
def your_questions_url
79+
return "#{Settings.forms_admin.base_url}/forms/#{@current_context.form.id}/live/pages" if @mode.preview_live?
80+
7181
"#{Settings.forms_admin.base_url}/forms/#{@current_context.form.id}/pages/"
7282
end
7383
end

config/locales/cy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ cy:
466466
preview_banner:
467467
heading: This is a preview of this form. Do not enter personal information.
468468
title: Important
469+
preview_header:
470+
your_questions: ''
469471
privacy:
470472
changes:
471473
heading: Newidiadau i’r hysbysiad hwn

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ en:
466466
preview_banner:
467467
heading: This is a preview of this form. Do not enter personal information.
468468
title: Important
469+
preview_header:
470+
your_questions: Your questions
469471
privacy:
470472
changes:
471473
heading: Changes to this notice

spec/components/form_header_component/view_spec.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
it "links to the form start page" do
2222
render_inline(described_class.new(current_context:, mode:))
2323

24-
expect(page).to have_link "test_form_name", href: "/form/1/test"
24+
expect(page).to have_link("test_form_name", href: "/form/1/test")
2525
end
2626

2727
context "when mode is preview_draft" do
@@ -36,9 +36,10 @@
3636
end
3737

3838
it "has a link to Your Questions in admin" do
39+
allow(Settings.forms_admin).to receive(:base_url).and_return("http://forms-admin")
3940
render_inline(described_class.new(current_context:, mode:))
4041

41-
expect(page).to have_link("Your questions")
42+
expect(page).to have_link("Your questions", href: "#{Settings.forms_admin.base_url}/forms/1/pages/")
4243
end
4344

4445
it "links to the forms-admin homepage" do
@@ -80,6 +81,18 @@
8081
expect(page).to have_selector(".app-header--preview-live")
8182
expect(page).to have_content("test_form_name")
8283
end
84+
85+
it "has a link to Your Questions in admin" do
86+
render_inline(described_class.new(current_context:, mode:))
87+
88+
expect(page).to have_link("Your questions")
89+
end
90+
91+
it "does not have a link to Edit your question" do
92+
render_inline(described_class.new(current_context:, mode:))
93+
94+
expect(page).to have_no_link("Edit your question")
95+
end
8396
end
8497

8598
context "when the environment is production" do

0 commit comments

Comments
 (0)