Skip to content

Commit 31f7212

Browse files
authored
Merge branch 'main' into 5086/rename-executive-director
2 parents af864e7 + fc95a66 commit 31f7212

44 files changed

Lines changed: 1155 additions & 332 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ gem 'bootsnap', require: false
106106
# Technically they don't need to be in this Gemfile at all, but we are pinning them to
107107
# specific versions for compatibility reasons.
108108
gem "nokogiri", ">= 1.10.4"
109-
gem "sprockets", "~> 4.2.1"
109+
gem "sprockets", "~> 4.2.2"
110110

111111
group :production, :staging do
112112
# Reduce the noise of logs and include custom fields to it for easier access

Gemfile.lock

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ GEM
130130
autoprefixer-rails (>= 9.1.0)
131131
popper_js (>= 2.11.6, < 3)
132132
sassc-rails (>= 2.0.0)
133-
brakeman (7.0.0)
133+
brakeman (7.0.2)
134134
racc
135135
bugsnag (6.27.1)
136136
concurrent-ruby (~> 1.0)
137137
builder (3.3.0)
138-
bullet (8.0.0)
138+
bullet (8.0.5)
139139
activesupport (>= 3.0.0)
140140
uniform_notifier (~> 1.11)
141141
capybara (3.40.0)
@@ -157,7 +157,7 @@ GEM
157157
tzinfo
158158
coderay (1.1.3)
159159
concurrent-ruby (1.3.5)
160-
connection_pool (2.5.0)
160+
connection_pool (2.5.3)
161161
crack (1.0.0)
162162
bigdecimal
163163
rexml
@@ -330,7 +330,7 @@ GEM
330330
activesupport (>= 5.0.0)
331331
jmespath (1.6.2)
332332
json (2.10.2)
333-
jwt (2.9.1)
333+
jwt (2.10.1)
334334
base64
335335
kaminari (1.2.2)
336336
activesupport (>= 4.1.0)
@@ -344,7 +344,7 @@ GEM
344344
activerecord
345345
kaminari-core (= 1.2.2)
346346
kaminari-core (1.2.2)
347-
knapsack_pro (8.1.0)
347+
knapsack_pro (8.1.2)
348348
rake
349349
language_server-protocol (3.17.0.4)
350350
launchy (3.0.0)
@@ -412,14 +412,14 @@ GEM
412412
net-protocol
413413
newrelic_rpm (9.16.0)
414414
nio4r (2.7.4)
415-
nokogiri (1.18.7)
415+
nokogiri (1.18.8)
416416
mini_portile2 (~> 2.8.2)
417417
racc (~> 1.4)
418-
nokogiri (1.18.7-arm64-darwin)
418+
nokogiri (1.18.8-arm64-darwin)
419419
racc (~> 1.4)
420-
nokogiri (1.18.7-x86_64-darwin)
420+
nokogiri (1.18.8-x86_64-darwin)
421421
racc (~> 1.4)
422-
nokogiri (1.18.7-x86_64-linux-gnu)
422+
nokogiri (1.18.8-x86_64-linux-gnu)
423423
racc (~> 1.4)
424424
notiffany (0.1.3)
425425
nenv (~> 0.1)
@@ -431,7 +431,7 @@ GEM
431431
rack (>= 1.2, < 4)
432432
snaky_hash (~> 2.0)
433433
version_gem (~> 1.1)
434-
omniauth (2.1.2)
434+
omniauth (2.1.3)
435435
hashie (>= 3.4.6)
436436
rack (>= 2.2.3)
437437
rack-protection
@@ -505,7 +505,7 @@ GEM
505505
puma (6.6.0)
506506
nio4r (~> 2.0)
507507
racc (1.8.1)
508-
rack (3.1.12)
508+
rack (3.1.13)
509509
rack-mini-profiler (3.3.1)
510510
rack (>= 1.2.0)
511511
rack-protection (4.0.0)
@@ -663,8 +663,9 @@ GEM
663663
activejob (>= 7.2)
664664
activerecord (>= 7.2)
665665
railties (>= 7.2)
666-
sprockets (4.2.1)
666+
sprockets (4.2.2)
667667
concurrent-ruby (~> 1.0)
668+
logger
668669
rack (>= 2.2.4, < 4)
669670
sprockets-rails (3.4.2)
670671
actionpack (>= 5.2)
@@ -689,7 +690,7 @@ GEM
689690
stimulus-rails (1.3.4)
690691
railties (>= 6.0.0)
691692
stringio (3.1.6)
692-
strong_migrations (2.2.1)
693+
strong_migrations (2.3.0)
693694
activerecord (>= 7)
694695
terser (1.2.5)
695696
execjs (>= 0.3.0, < 3)
@@ -820,7 +821,7 @@ DEPENDENCIES
820821
simple_form
821822
simplecov
822823
solid_cache (~> 1.0)
823-
sprockets (~> 4.2.1)
824+
sprockets (~> 4.2.2)
824825
stackprof
825826
standard (~> 1.40)
826827
standard-performance

app/controllers/application_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class ApplicationController < ActionController::Base
1515

1616
rescue_from ActiveRecord::RecordNotFound, with: :not_found!
1717

18-
rescue_from ActionController::InvalidAuthenticityToken do
18+
rescue_from ActionController::InvalidAuthenticityToken, with: :session_expired
19+
20+
def session_expired
1921
flash[:error] = "Your session expired. This could be due to leaving a page open for a long time, or having multiple tabs open. Try resubmitting."
2022
redirect_back fallback_location: root_path
2123
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Validatable
2+
extend ActiveSupport::Concern
3+
4+
included do
5+
rescue_from ActionController::InvalidAuthenticityToken do
6+
if action_name == "validate"
7+
render json: {valid: false}
8+
else
9+
session_expired
10+
end
11+
end
12+
end
13+
end

app/controllers/distributions_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class DistributionsController < ApplicationController
77
include DateRangeHelper
88
include DistributionHelper
9+
include Validatable
910

1011
before_action :enable_turbo!, only: %i[new show]
1112
skip_before_action :authenticate_user!, only: %i(calendar)

app/controllers/partners/family_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Partners
22
class FamilyRequestsController < BaseController
3+
include Validatable
34
before_action :verify_partner_is_active
45
before_action :authorize_verified_partners
56

app/controllers/partners/individuals_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Partners
22
class IndividualsRequestsController < BaseController
3+
include Validatable
34
before_action :verify_partner_is_active
45
before_action :authorize_verified_partners
56

app/controllers/partners/requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Partners
22
class RequestsController < BaseController
3+
include Validatable
34
skip_before_action :require_partner, only: [:new, :create, :validate]
45
before_action :require_partner_or_org_admin, only: [:new, :create, :validate]
56
layout :layout

app/controllers/partners_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def index
1515

1616
respond_to do |format|
1717
format.html
18-
format.csv { send_data Exports::ExportPartnersCSVService.new(@partners.unscope(:includes)).generate_csv, filename: "Partners-#{Time.zone.today}.csv" }
18+
format.csv { send_data Exports::ExportPartnersCSVService.new(@partners.unscope(:includes), current_organization).generate_csv, filename: "Partners-#{Time.zone.today}.csv" }
1919
end
2020
end
2121

app/helpers/donations_helper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ def total_received_from_product_drives(range = selected_range)
1616
number_with_delimiter total_received_from_product_drives_unformatted(range)
1717
end
1818

19+
def total_number_of_drives(range = selected_range)
20+
formatted_range = format_date_range_to_iso(range)
21+
current_organization.product_drives.within_date_range(formatted_range).count
22+
end
23+
1924
private
2025

2126
def total_received_donations_unformatted(range = selected_range)
@@ -25,4 +30,8 @@ def total_received_donations_unformatted(range = selected_range)
2530
def total_received_from_product_drives_unformatted(range = selected_range)
2631
LineItem.active.where(itemizable: current_organization.donations.by_source(:product_drive).during(range)).sum(:quantity)
2732
end
33+
34+
def format_date_range_to_iso(range)
35+
"#{range.begin.to_date.iso8601} - #{range.end.to_date.iso8601}"
36+
end
2837
end

0 commit comments

Comments
 (0)