Skip to content

Commit

Permalink
Add a link to Import Partners on the dashboard getting started sectio…
Browse files Browse the repository at this point in the history
…n beside Add a Partner link. Add system tests to ensure the Partner cta section has 2 links. (#4710)

Co-authored-by: Athira Kadampatta <[email protected]>
  • Loading branch information
Athira Kadampatta and Athira Kadampatta authored Oct 11, 2024
1 parent 93b53f3 commit 9496887
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/views/dashboard/_getting_started_prompt.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
</p>

<div id="org-stats-call-to-action-partners">
<%= modal_button_to("#csvImportModal", { text: "Import Partners", icon: "upload", size: "md" }) %>
<% partner_link_text = partner_criteria_met ? "Add More Partners" : "Add a Partner" %>
<%= new_button_to new_partner_path, { text: partner_link_text, size: "md" } %>
</div>
Expand Down Expand Up @@ -135,5 +136,18 @@
</div>
</div>
</div>

<%= render(
layout: "shared/csv_import_modal",
locals: {
import_type: "Partners",
csv_template_url: "/partners_template.csv",
csv_import_url: import_csv_partners_path,
},
) do %>
<li>Open the CSV file with Excel or your favourite spreadsheet program.</li>
<li>Delete the sample data and enter your partner agency names and addresses in the appropriate columns.</li>
<li>Save the file as a CSV file.</li>
<% end %>
<% end %>
<% end %>
20 changes: 19 additions & 1 deletion spec/support/pages/organization_dashboard_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def has_add_inventory_call_to_action?
end

def has_add_partner_call_to_action?
has_selector? "#org-stats-call-to-action-partners"
has_selector? call_to_action_partner_selector
end

def has_add_partner_call_to_action_with_two_links?
has_add_partner_call_to_action? && partner_cta_has_two_links?
end

def has_add_storage_location_call_to_action?
Expand Down Expand Up @@ -153,4 +157,18 @@ def org_logo_selector
def outstanding_selector
"#outstanding"
end

def call_to_action_partner
find call_to_action_partner_selector
end

def call_to_action_partner_selector
"#org-stats-call-to-action-partners"
end

def partner_cta_has_two_links?
within call_to_action_partner do
all("a", count: 2)
end
end
end
2 changes: 1 addition & 1 deletion spec/system/dashboard_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
org_dashboard_page.visit

expect(org_dashboard_page).to have_getting_started_guide
expect(org_dashboard_page).to have_add_partner_call_to_action
expect(org_dashboard_page).to have_add_partner_call_to_action_with_two_links
expect(org_dashboard_page).not_to have_add_storage_location_call_to_action
expect(org_dashboard_page).not_to have_add_donation_site_call_to_action
expect(org_dashboard_page).not_to have_add_inventory_call_to_action
Expand Down

0 comments on commit 9496887

Please sign in to comment.