Skip to content

Commit 77a8951

Browse files
New Case Contacts Table: new case contact button (#6859)
feat: add New Case Contact button to new design case contacts page Adds a primary-styled button to the header of the new design case contacts table that links to the existing new case contact flow. Accessible (aria-hidden on decorative icon) and responsive (flex-wrap on narrow viewports). Covers admin and volunteer roles in system specs. Spec structure aligned with shared_context pattern from b4758d1 to minimize future merge conflicts. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bc29a92 commit 77a8951

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

app/views/case_contacts/case_contacts_new_design/index.html.erb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<div class="title-wrapper pt-30">
2-
<div class="row align-items-center">
3-
<div class="title mb-30">
4-
<h1>Case Contacts</h1>
5-
</div>
2+
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-30">
3+
<h1>Case Contacts</h1>
4+
<%= link_to new_case_contact_path, class: "main-btn primary-btn btn-sm btn-hover" do %>
5+
<i class="lni lni-plus mr-10" aria-hidden="true"></i>
6+
New Case Contact
7+
<% end %>
68
</div>
79
</div>
810

spec/system/case_contacts/case_contacts_new_design_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,37 @@
2525
end
2626
end
2727

28+
describe "New Case Contact button" do
29+
include_context "signed in as admin"
30+
31+
it "is visible to an admin" do
32+
expect(page).to have_link("New Case Contact", href: new_case_contact_path)
33+
end
34+
35+
it "navigates to the new case contact form when clicked as an admin" do
36+
click_link "New Case Contact"
37+
expect(page).to have_current_path(%r{/case_contacts/\d+/form/details})
38+
end
39+
40+
context "when signed in as a volunteer" do
41+
let(:volunteer) { create(:volunteer, casa_org: organization) }
42+
43+
before do
44+
sign_in volunteer
45+
visit case_contacts_new_design_path
46+
end
47+
48+
it "is visible to a volunteer" do
49+
expect(page).to have_link("New Case Contact", href: new_case_contact_path)
50+
end
51+
52+
it "navigates to the new case contact form when clicked as a volunteer" do
53+
click_link "New Case Contact"
54+
expect(page).to have_current_path(%r{/case_contacts/\d+/form/details})
55+
end
56+
end
57+
end
58+
2859
describe "row expansion" do
2960
include_context "signed in as admin"
3061
it "shows the expanded content after clicking the chevron" do

0 commit comments

Comments
 (0)