Browse Source

Make hidden text dynamic

pull/428/head
baarkerlounger 3 years ago
parent
commit
6ef3bc03ca
  1. 2
      app/views/users/edit.html.erb
  2. 2
      app/views/users/new.html.erb
  3. 2
      app/views/users/show.html.erb
  4. 2
      spec/features/user_spec.rb

2
app/views/users/edit.html.erb

@ -31,7 +31,7 @@
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are they a data protection officer?", size: "m" } legend: { text: "Are #{current_user == @user ? "you" : "they"} a data protection officer?", size: "m" }
%> %>
<%= f.govuk_submit "Save changes" %> <%= f.govuk_submit "Save changes" %>

2
app/views/users/new.html.erb

@ -36,7 +36,7 @@
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are they a data protection officer?", size: "m" } legend: { text: "Are #{current_user == @user ? "you" : "they"} a data protection officer?", size: "m" }
%> %>
<%= f.govuk_submit "Continue" %> <%= f.govuk_submit "Continue" %>

2
app/views/users/show.html.erb

@ -48,7 +48,7 @@
<%= summary_list.row do |row| <%= summary_list.row do |row|
row.key { 'Data protection officer' } row.key { 'Data protection officer' }
row.value { @user.is_data_protection_officer? ? "Yes" : "No" } row.value { @user.is_data_protection_officer? ? "Yes" : "No" }
row.action(visually_hidden_text: 'are they a data protection officer?', href: edit_user_path, html_attributes: { 'data-qa': 'change-are-they-a-data-protection-officer' }) row.action(visually_hidden_text: "are #{current_user == @user ? "you" : "they"} a data protection officer?", href: edit_user_path, html_attributes: { "data-qa": "change-are-#{current_user == @user ? "you" : "they"}-a-data-protection-officer" })
end %> end %>
<% end %> <% end %>
</div> </div>

2
spec/features/user_spec.rb

@ -245,7 +245,7 @@ RSpec.describe "User Features" do
choose("user-is-dpo-true-field") choose("user-is-dpo-true-field")
click_button("Continue") click_button("Continue")
expect( expect(
User.find_by(name: "New User", email: "newuser@example.com", role: "data_provider", is_dpo: true) User.find_by(name: "New User", email: "newuser@example.com", role: "data_provider", is_dpo: true),
).to be_a(User) ).to be_a(User)
end end

Loading…
Cancel
Save