Skip to content

Commit 3b2c5c4

Browse files
authored
5169 Rework of Getting Started section (#5229)
* implement new getting started section * removed unused template * updated test for getting started section in dashboard * updated docs * addressing linting errors * dismiss returns to dashboard, and some language tweaks added links to user guide, small language tweaks, and linting fixes * removed short name to sync with main
1 parent c26c0d6 commit 3b2c5c4

17 files changed

+84
-199
lines changed

app/controllers/admin/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def destroy
7171

7272
def organization_params
7373
params.require(:organization)
74-
.permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day,
74+
.permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day, :bank_is_set_up,
7575
users_attributes: %i(name email organization_admin), account_request_attributes: %i(ndbn_member_id id))
7676
end
7777

app/controllers/dashboard_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class DashboardController < ApplicationController
33
respond_to :html, :js
44

55
def index
6-
@org_stats = OrganizationStats.new(current_organization, inventory)
6+
@org_is_set_up = current_organization.bank_is_set_up
77
@partners_awaiting_review = current_organization.partners.awaiting_review
88
@outstanding_requests = current_organization
99
.ordered_requests

app/controllers/organizations_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def update
1919
@organization = current_organization
2020

2121
if OrganizationUpdateService.update(@organization, organization_params)
22-
redirect_to organization_path, notice: "Updated your organization!"
22+
redirect_back(fallback_location: organization_path, notice: "Updated your organization!")
2323
else
2424
flash.now[:error] = @organization.errors.full_messages.join("\n")
2525
render :edit
@@ -102,6 +102,7 @@ def organization_params
102102
:ytd_on_distribution_printout, :one_step_partner_invite,
103103
:hide_value_columns_on_receipt, :hide_package_column_on_receipt,
104104
:signature_for_distribution_pdf, :receive_email_on_requests,
105+
:bank_is_set_up,
105106
:include_in_kind_values_in_exported_files,
106107
partner_form_fields: [],
107108
request_unit_names: []

app/models/organization.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Table name: organizations
44
#
55
# id :integer not null, primary key
6+
# bank_is_set_up :boolean default(FALSE), not null
67
# city :string
78
# deadline_day :integer
89
# default_storage_location :integer

app/views/dashboard/_getting_started_progress_stepper.html.erb

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 43 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,63 @@
1-
<% total_criteria = 4 %>
2-
<% partner_criteria_met = org_stats.partners_added > 0 %>
3-
<% location_criteria_met = org_stats.storage_locations_added > 0 %>
4-
<% donation_criteria_met = org_stats.donation_sites_added > 0 %>
5-
<% inventory_criteria_met = org_stats.num_locations_with_inventory > 0 %>
6-
<% criterias = [ location_criteria_met, partner_criteria_met, donation_criteria_met, inventory_criteria_met ] %>
7-
<% current_step = criterias.find_index(false) %>
81

9-
<% if current_step.present? %>
2+
3+
<% unless org_is_set_up %>
104

115
<%= render(
126
"shared/card",
13-
id: "summary",
7+
id: "getting-started-guide",
148
header: "Getting Started",
159
type: :plain,
1610
) do %>
1711
<div class="row">
1812
<div class="col-md-12">
1913
<div class="box box-primary" id="getting-started-guide">
2014
<div class="box-header with-border">
21-
<h2 class="box-title">
22-
Just Starting?
23-
<small>Here are some things you may need to set up:</small>
24-
</h2>
15+
<h5>
16+
Here are a few steps to help you in getting started
17+
</h5>
2518
</div>
2619

27-
<div class="box-body org-stats">
28-
<div class="col-md-12">
29-
<%= render partial: "getting_started_progress_stepper", locals: {
30-
current_step: current_step,
31-
criterias: criterias,
32-
lines: ["line-right", "line-right line-left", "line-right line-left", "line-left"],
33-
step_labels: ["Storage Locations", "Partner Agencies", "Donation Sites", "Inventory"]
34-
} %>
35-
</div>
36-
37-
<div class="col-md-12 org-stats-box-container<%= current_step == 0 ? '' : ' d-none visible-xs' %>">
38-
<div class="org-stats-box">
39-
<div class="box-body text-center position-relative">
40-
<div class="org-stats-icon">
41-
<% if location_criteria_met %>
42-
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
43-
<% else %>
44-
<i class="fa fa-map-marker fa-2x" aria-hidden="true"></i>
45-
<% end %>
46-
<h4><%= pluralize(org_stats.storage_locations_added, 'Storage Location') %> Added</h4>
47-
</div>
48-
49-
<p class="org-stats-desc">
50-
Add details for all Storage Locations you use for your inventory.
51-
</p>
52-
53-
<div id="org-stats-call-to-action-storage-locations">
54-
<% location_link_text = location_criteria_met ? "Add More Storage Locations" : "Add a Storage Location" %>
55-
<%= new_button_to new_storage_location_path, { text: location_link_text, size: "md" } %>
56-
</div>
57-
</div>
58-
</div>
59-
</div>
60-
61-
<div class="col-md-12 org-stats-box-container<%= current_step == 1 ? '' : ' d-none visible-xs' %>">
62-
<div class="org-stats-box">
63-
<div class="box-body text-center position-relative">
64-
<div class="org-stats-icon">
65-
<% if partner_criteria_met %>
66-
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
67-
<% else %>
68-
<i class="fa fa-users fa-2x" aria-hidden="true"></i>
69-
<% end %>
70-
<h4><%= pluralize(org_stats.partners_added, 'Partner Agency') %> Added</h4>
71-
</div>
72-
73-
<p class="org-stats-desc">
74-
To start building your community in Human Essentials, import a list of your current partner agencies or add them individually.
75-
</p>
76-
77-
<div id="org-stats-call-to-action-partners">
78-
<%= modal_button_to("#csvImportModal", { text: "Import Partners", icon: "upload", size: "md" }) %>
79-
<% partner_link_text = partner_criteria_met ? "Add More Partners" : "Add a Partner" %>
80-
<%= new_button_to new_partner_path, { text: partner_link_text, size: "md" } %>
81-
</div>
82-
</div>
83-
</div>
84-
</div>
85-
86-
<div class="col-md-12 org-stats-box-container<%= current_step == 2 ? '' : ' d-none visible-xs' %>">
87-
<div class="org-stats-box">
88-
<div class="box-body text-center position-relative">
89-
<div class="org-stats-icon">
90-
<% if donation_criteria_met %>
91-
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
92-
<% else %>
93-
<i class="fa fa-home fa-2x" aria-hidden="true"></i>
94-
<% end %>
95-
<h4><%= pluralize(org_stats.donation_sites_added, 'Donation Site') %> Added</h4>
96-
</div>
97-
98-
<p class="org-stats-desc">
99-
Add any community sites (including your primary storage facility) that accept donations on your behalf.
100-
</p>
101-
102-
<div id="org-stats-call-to-action-donation-sites">
103-
<% donation_link_text = donation_criteria_met ? "Add More Donation Sites" : "Add a Donation Site" %>
104-
<%= new_button_to new_donation_site_path, { text: donation_link_text, size: "md" } %>
105-
</div>
106-
</div>
107-
</div>
108-
</div>
109-
110-
<div class="col-md-12 org-stats-box-container<%= current_step == 3 ? '' : ' d-none visible-xs' %>">
111-
<div class="org-stats-box">
112-
<div class="box-body text-center position-relative">
113-
<div class="org-stats-icon">
114-
<% if inventory_criteria_met %>
115-
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
116-
<% else %>
117-
<i class="fa fa-pie-chart fa-2x" aria-hidden="true"></i>
118-
<% end %>
119-
<h4><%= pluralize(org_stats.num_locations_with_inventory, 'Storage Location') %> with Inventory</h4>
120-
</div>
121-
122-
<div class="org-stats-desc">
123-
<p>
124-
As an essentials bank, you might already have inventory on hand. These items might have come from previous donations/purchases. If you have multiple sources or want to add inventory to multiple storage locations, you can create multiple donations or purchases while specifying the correct date, source, and location.
125-
</p>
126-
</div>
127-
128-
<div id="org-stats-call-to-action-inventory">
129-
<%= new_button_to new_donation_path, { text: "Add past donation", size: "md" } %>
130-
<%= new_button_to new_purchase_path, { text: "Add past purchase", size: "md" } %>
131-
</div>
132-
</div>
133-
</div>
134-
</div>
20+
<hr>
21+
22+
<div>
23+
<ul>
24+
<li>
25+
<%= link_to "Set up storage locations", storage_locations_path, target: :_blank %>
26+
</li>
27+
<li>
28+
Set up your inventory
29+
<ul>
30+
<li>
31+
<%= link_to "Add any custom items", items_path, target: :_blank %>
32+
</li>
33+
<li>
34+
<%= link_to "Do an audit to set up your current inventory levels", audits_path, target: :_blank %>
35+
-
36+
<%= link_to "(User guide)", "https://rubyforgood.github.io/human-essentials/user_guide/bank/getting_started_inventory.html", target: :_blank %>
37+
</li>
38+
</ul>
39+
</li>
40+
<li>
41+
<%= link_to "Customize your organization", edit_organization_path, target: :_blank %>
42+
-
43+
<%= link_to "(User guide)", "https://rubyforgood.github.io/human-essentials/user_guide/bank/getting_started_customization.html", target: :_blank %>
44+
</li>
45+
<li>
46+
<%= link_to "Add other users at your bank", new_user_path, target: :_blank %>
47+
</li>
48+
<li>
49+
<%= link_to "Import Partners", partners_path, target: :_blank %>
50+
or
51+
<%= link_to "Add a single partner", new_partner_path, target: :_blank %>
52+
</li>
53+
</ul>
13554
</div>
13655
</div>
13756
</div>
57+
58+
<p>When you're done, click this box to hide this section</p>
59+
<%= button_to "Dismiss", "/manage", method: :patch, params: {organization: { bank_is_set_up: true }}, class: "btn btn-primary" %>
13860
</div>
13961

140-
<%= render(
141-
layout: "shared/csv_import_modal",
142-
locals: {
143-
import_type: "Partners",
144-
csv_template_url: "/partners_template.csv",
145-
csv_import_url: import_csv_partners_path,
146-
},
147-
) do %>
148-
<li>Open the CSV file with Excel or your favourite spreadsheet program.</li>
149-
<li>Delete the sample data and enter your partner agency names and addresses in the appropriate columns.</li>
150-
<li>Save the file as a CSV file.</li>
151-
<% end %>
15262
<% end %>
15363
<% end %>

app/views/dashboard/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="container-fluid">
2020
<div class="row">
2121
<div class="col-md-12">
22-
<%= render partial: "getting_started_prompt", locals: {org_stats: @org_stats} %>
22+
<%= render partial: "getting_started_prompt", locals: {org_is_set_up: @org_is_set_up} %>
2323
</div>
2424
</div>
2525
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Migration for https://github.com/rubyforgood/human-essentials/issues/5169
2+
class AddBankIsSetUp < ActiveRecord::Migration[8.0]
3+
def up
4+
# new flag for the update to the getting started section
5+
add_column :organizations, :bank_is_set_up, :boolean, default: false, null: false
6+
7+
# any organization that has at least one donation site or distribution
8+
# is considered set up
9+
Organization
10+
.left_joins(:donation_sites, :distributions)
11+
.where.not(donation_sites: { id: nil })
12+
.or(Organization.where.not(distributions: { id: nil }))
13+
.distinct
14+
.update_all( bank_is_set_up: true )
15+
16+
end
17+
18+
def down
19+
remove_column :organizations, :bank_is_set_up
20+
end
21+
end

db/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@
493493
t.boolean "hide_package_column_on_receipt", default: false
494494
t.boolean "signature_for_distribution_pdf", default: false
495495
t.boolean "receive_email_on_requests", default: false, null: false
496+
t.boolean "bank_is_set_up", default: false, null: false
496497
t.boolean "include_in_kind_values_in_exported_files", default: false, null: false
497498
t.index ["latitude", "longitude"], name: "index_organizations_on_latitude_and_longitude"
498499
end

docs/user_guide/bank/getting_started_partners.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
For details on how to do a bulk import of your partners, please click [here](pm_importing_partners.md)
2121

2222
## Adding a single Partner
23-
For your first partner, you can Click on the "Add a Partner" button in your "Getting Started" portion of you dashboard.
23+
For your first partner, you can Click on the "Add a single partner" link in your "Getting Started" portion of you dashboard.
2424

25-
![navigation](images/getting_started/partners/gs_just_starting_step_2.png)
25+
![navigation](images/getting_started/partners/gs_add_partner_1.png)
2626

2727

2828
For any subsequent Partners, please click on "Partner Agencies", then "All Partners", then "Add a Partner")

0 commit comments

Comments
 (0)