Skip to content

Commit 5739cf0

Browse files
committed
Merge branch 'main' into 4947-update-default-email-text
2 parents aa37242 + e4f2a01 commit 5739cf0

25 files changed

+305
-556
lines changed

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ group :development do
184184
gem "rails-erd"
185185
# Allows to create a console in the browser.
186186
gem "web-console"
187+
# Middleware that displays speed badge for every HTML page
188+
gem "rack-mini-profiler"
189+
# Adds memory profiling to rack-mini-profiler
190+
gem "memory_profiler"
191+
# Adds call-stack profiling flamegraphs to rack-mini-profiler
192+
gem "stackprof"
187193
end
188194

189195
group :test do

Gemfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ GEM
370370
net-smtp
371371
marcel (1.0.4)
372372
matrix (0.4.2)
373+
memory_profiler (1.1.0)
373374
method_source (1.1.0)
374375
mini_magick (4.13.2)
375376
mini_mime (1.1.5)
@@ -494,6 +495,8 @@ GEM
494495
nio4r (~> 2.0)
495496
racc (1.8.1)
496497
rack (3.1.8)
498+
rack-mini-profiler (3.3.1)
499+
rack (>= 1.2.0)
497500
rack-protection (4.0.0)
498501
base64 (>= 0.1.0)
499502
rack (>= 3.0.0, < 4)
@@ -657,6 +660,7 @@ GEM
657660
actionpack (>= 5.2)
658661
activesupport (>= 5.2)
659662
sprockets (>= 3.0.0)
663+
stackprof (0.2.27)
660664
standard (1.43.0)
661665
language_server-protocol (~> 3.17.0.2)
662666
lint_roller (~> 1.0)
@@ -775,6 +779,7 @@ DEPENDENCIES
775779
lograge
776780
magic_test
777781
matrix
782+
memory_profiler
778783
money-rails
779784
newrelic_rpm
780785
nokogiri (>= 1.10.4)
@@ -791,6 +796,7 @@ DEPENDENCIES
791796
pry-rails
792797
pry-remote
793798
puma
799+
rack-mini-profiler
794800
rails (= 7.2.2)
795801
rails-controller-testing
796802
rails-erd
@@ -806,6 +812,7 @@ DEPENDENCIES
806812
simplecov
807813
solid_cache (~> 1.0)
808814
sprockets (~> 4.2.1)
815+
stackprof
809816
standard (~> 1.40)
810817
standard-performance
811818
standard-rails

app/javascript/application.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ import 'utils/purchases'
3535

3636
import Rails from "@rails/ujs"
3737
Rails.start()
38+
39+
// Initialize Active Storage
40+
import * as ActiveStorage from "@rails/activestorage";
41+
ActiveStorage.start();
42+
3843
// Disable turbo by default to avoid issues with turbolinks
3944
Turbo.session.drive = false
4045

@@ -107,4 +112,3 @@ $(document).ready(function(){
107112
});
108113
picker.setDateRange(startDate, endDate);
109114
});
110-
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Controller } from "@hotwired/stimulus"
2+
3+
// Connects to data-controller="file-input-label"
4+
//
5+
// Reproduces the native browser behavior of updating a file input label
6+
// to show the selected file's name. This is necessary when using a custom
7+
// file input, such as with Bootstrap, that does not update automatically.
8+
//
9+
// Key Features:
10+
// 1. Handles initial display of a default label text (e.g., "Choose file..." or
11+
// the previously selected file name if present).
12+
// 2. Updates the label dynamically when a new file is selected.
13+
//
14+
// How it works:
15+
// - When a file is selected, the `fileSelected` method updates the text of the
16+
// label to reflect the name of the selected file.
17+
// - On page load, the `connect` method ensures the label is initialized to the
18+
// correct state (default text or file name, if a file was previously selected).
19+
//
20+
// This controller is used in coordination with direct uploads in Active Storage.
21+
// When a validation error occurs, previously selected files persist on the server
22+
// (via direct upload), and the file name can be displayed to the user.
23+
export default class extends Controller {
24+
static targets = ["input", "label"];
25+
static values = {
26+
defaultText: { type: String, default: 'Choose file...' }
27+
}
28+
29+
connect() {
30+
this.updateLabel();
31+
}
32+
33+
updateLabel() {
34+
const input = this.inputTarget;
35+
const label = this.labelTarget;
36+
37+
// Check if the file input has a file selected
38+
if (input.files.length > 0) {
39+
label.textContent = input.files[0].name;
40+
} else {
41+
label.textContent = this.defaultTextValue;
42+
}
43+
}
44+
45+
// Update the label when a file is selected
46+
fileSelected() {
47+
this.updateLabel();
48+
}
49+
}

app/views/partners/_documents.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="card card-info card-outline">
22
<div class="card-header">
3-
<h2 class="card-title">Documents</h2>
3+
<h2 class="card-title fs-3">Documents</h2>
44
</div>
55
<div class="card-body p-0">
66
<div class="tab-content" id="custom-tabs-three-tabContent">

app/views/partners/_show_header.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="card card-info card-outline">
22
<div class="card-header">
3-
<h2 class="card-title"><%= partner.name %></h2>
3+
<h2 class="card-title fs-3"><%= partner.name %></h2>
44
</div>
55
<div class="card-body p-0">
66
<div class="row">

app/views/partners/_uninvited_header.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="card card-info card-outline">
22
<div class="card-header">
3-
<h2 class="card-title"><%= partner.name %></h2>
3+
<h2 class="card-title fs-3"><%= partner.name %></h2>
44
</div>
55
<div class="card-body p-0">
66
</div>

app/views/partners/profiles/edit/_agency_information.html.erb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@
1010
<%= form.input :name, label: "Agency Name", class: "form-control", wrapper: :input_group %>
1111
<%= profile_form.input :agency_type, collection: Partner::AGENCY_TYPES.values, label: "Agency Type", class: "form-control", wrapper: :input_group %>
1212
<%= profile_form.input :other_agency_type, label: "Other Agency Type", class: "form-control", wrapper: :input_group %>
13-
<div class="form-group row">
14-
<label class="control-label col-md-3">501(c)(3) IRS Determination Letter or other Proof of Agency Status</label>
15-
<% if profile.proof_of_partner_status.attached? %>
16-
<div class="col-md-8">
17-
Attached
18-
file: <%= link_to profile.proof_of_partner_status.blob['filename'], rails_blob_path(profile.proof_of_partner_status), class: "font-weight-bold" %>
19-
<%= profile_form.file_field :proof_of_partner_status, class: "form-control-file form-control" %>
20-
</div>
21-
<% else %>
22-
<div class="col-md-8">
23-
<%= profile_form.file_field :proof_of_partner_status, class: "form-control-file" %>
24-
</div>
25-
<% end %>
26-
</div>
13+
14+
<%= render "shared/custom_file_input",
15+
form_builder: profile_form,
16+
attachment: profile.proof_of_partner_status,
17+
attachment_name: :proof_of_partner_status,
18+
label_for: "partner_profile_proof_of_partner_status",
19+
label_text: "501(c)(3) IRS Determination Letter or other Proof of Agency Status" %>
20+
2721
<%= profile_form.input :agency_mission, label: "Agency Mission", class: "form-control", wrapper: :input_group %>
2822
<%= profile_form.input :address1, label: "Address (line 1)", class: "form-control", wrapper: :input_group %>
2923
<%= profile_form.input :address2, label: "Address (line 2)", class: "form-control", wrapper: :input_group %>

app/views/partners/profiles/edit/_agency_stability.html.erb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@
1010
<%= form.input :founded, label: "Year Founded", class: "form-control", wrapper: :input_group %>
1111
<%= form.input :form_990, label: "Form 990 Filed", as: :radio_buttons, class: "form-control",
1212
wrapper: :input_group, wrapper_html: {class: "form-yesno"}, input_html: {class: "radio-yesno"} %>
13-
<label class="control-label col-md-3">Form 990</label>
14-
<% if profile.proof_of_form_990.attached? %>
15-
<div class="col-md-8">
16-
Attached
17-
file: <%= link_to profile.proof_of_form_990.blob['filename'], rails_blob_path(profile.proof_of_form_990), class: "font-weight-bold" %>
18-
<%= form.file_field :proof_of_form_990, class: "form-control-file form-control" %>
19-
</div>
20-
<% else %>
21-
<div class="col-md-8">
22-
<%= form.file_field :proof_of_form_990, class: "form-control-file" %>
23-
</div>
24-
<% end %>
13+
14+
<%= render "shared/custom_file_input",
15+
form_builder: form,
16+
attachment: profile.proof_of_form_990,
17+
attachment_name: :proof_of_form_990,
18+
label_for: "partner_profile_proof_of_form_990",
19+
label_text: "Form 990" %>
20+
2521
<%= form.input :program_name, label: "Program Name(s)", class: "form-control", wrapper: :input_group %>
2622
<%= form.input :program_description, label: "Program Description(s)", class: "form-control", wrapper: :input_group %>
2723
<%= form.input :program_age, label: "Agency Age", class: "form-control", wrapper: :input_group %>

app/views/partners/profiles/step/_agency_information_form.html.erb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,12 @@
1111
<%= pf.input :other_agency_type, label: "Other Agency Type", class: "form-control" %>
1212
</div>
1313

14-
<div class="form-group row">
15-
<label class="control-label col-md-3">501(c)(3) IRS Determination Letter or other Proof of Agency Status</label>
16-
<% if profile.proof_of_partner_status.attached? %>
17-
<div class="col-md-8">
18-
Attached file: <%= link_to profile.proof_of_partner_status.blob['filename'], rails_blob_path(profile.proof_of_partner_status), class: "font-weight-bold" %>
19-
<%= pf.file_field :proof_of_partner_status, class: "form-control-file" %>
20-
</div>
21-
<% else %>
22-
<div class="col-md-8">
23-
<%= pf.file_field :proof_of_partner_status, class: "form-control-file" %>
24-
</div>
25-
<% end %>
26-
</div>
14+
<%= render "shared/custom_file_input",
15+
form_builder: pf,
16+
attachment: profile.proof_of_partner_status,
17+
attachment_name: :proof_of_partner_status,
18+
label_for: "partner_profile_proof_of_partner_status",
19+
label_text: "501(c)(3) IRS Determination Letter or other Proof of Agency Status" %>
2720

2821
<div class="form-group">
2922
<%= pf.input :agency_mission, as: :text, label: "Agency Mission", class: "form-control" %>

0 commit comments

Comments
 (0)