Skip to content

Commit 761195b

Browse files
Merge branch 'main' into 4241-change-agency-type-to-enum
2 parents 723d43d + 7db69a4 commit 761195b

File tree

63 files changed

+571
-167
lines changed

Some content is hidden

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

63 files changed

+571
-167
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ group :development, :test do
155155
# Rails add-on for static analysis.
156156
gem 'rubocop-performance'
157157
gem "rubocop-rails", "~> 2.25.1"
158+
# More concise test ("should") matchers
159+
gem "shoulda-matchers", "~> 6.2"
158160
# Default rules for Rubocop.
159161
gem "standard", "~> 1.40"
160162
gem "standard-rails"
@@ -197,8 +199,6 @@ group :test do
197199
gem "rails-controller-testing"
198200
# Show code coverage.
199201
gem 'simplecov'
200-
# More concise test ("should") matchers
201-
gem 'shoulda-matchers', '~> 6.2'
202202
# Mock HTTP requests and ensure they are not called during tests.
203203
gem "webmock", "~> 3.24"
204204
# Interface capybara to chrome headless

app/assets/stylesheets/AdminLTE.css

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/stylesheets/AdminLTE.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/stylesheets/application.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
@import 'resources/*';
2121

2222
// import other stylesheets after variables
23-
@import 'AdminLTE';
2423
@import 'bootstrap';
24+
@import 'AdminLTE';
2525
@import 'simple_form-bootstrap/simple_form-bootstrap';
2626
@import 'progress_stepper';
2727
@import 'audits';
@@ -188,6 +188,12 @@ select.selectpicker + .dropdown-toggle::after {
188188
background-color: #8282df
189189
}
190190

191+
// Fix select2 tagging search box to be inline with tags.
192+
// This is the default for select2 but adminLTE overwrites it.
193+
.select2-search.select2-search--inline {
194+
display: inline-block;
195+
}
196+
191197
div.low_priority_warning {
192198
margin: 5px;
193199
text-align: center;

app/assets/stylesheets/custom.scss

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@import 'base/_variables';
2-
@import 'AdminLTE';
32

43
@mixin for-desktop {
54
@media (min-width: 992px) and (min-height: 769px) {
@@ -53,15 +52,6 @@
5352
}
5453
}
5554

56-
.wrapper-form-feedback {
57-
@extend .dropdown-item;
58-
59-
&:active {
60-
color: inherit;
61-
background-color: #f8f9fa;
62-
}
63-
}
64-
6555
.login-page--user {
6656
background: linear-gradient(135deg, #3023AE, #C86DD7);
6757
background-attachment: fixed;
@@ -108,3 +98,17 @@
10898
width: 3rem;
10999
cursor: not-allowed;
110100
}
101+
102+
// The account request form is placed inside the default devise container which
103+
// is too narrow for the desired form width, so we have to apply a negative
104+
// margin to center it (except on mobile where text would get cut off).
105+
.account-request {
106+
$inner-width: 35rem;
107+
$outer-width: 360px;
108+
width: $inner-width;
109+
margin-left: calc((#{$outer-width} - #{$inner-width}) / 2);
110+
@media (max-width: 620px) {
111+
margin-left: 0;
112+
max-width: 100%;
113+
}
114+
}

app/controllers/adjustments_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def show
3333
def new
3434
@adjustment = current_organization.adjustments.new
3535
@adjustment.line_items.build
36-
@storage_locations = current_organization.storage_locations.active_locations
36+
@storage_locations = current_organization.storage_locations.active
3737
@items = current_organization.items.loose.active.alphabetized
3838
end
3939

@@ -54,7 +54,7 @@ def create
5454
private
5555

5656
def load_form_collections
57-
@storage_locations = current_organization.storage_locations.active_locations
57+
@storage_locations = current_organization.storage_locations.active
5858
@items = current_organization.items.loose.alphabetized
5959
end
6060

app/controllers/audits_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def set_audit
8989
end
9090

9191
def set_storage_locations
92-
@storage_locations = current_organization.storage_locations.active_locations
92+
@storage_locations = current_organization.storage_locations.active
9393
end
9494

9595
def set_items

app/controllers/dashboard_controller.rb

Lines changed: 8 additions & 2 deletions
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)
6+
@org_stats = OrganizationStats.new(current_organization, inventory)
77
@partners_awaiting_review = current_organization.partners.awaiting_review
88
@outstanding_requests = current_organization
99
.ordered_requests
@@ -12,9 +12,15 @@ def index
1212
.order(:created_at)
1313
.limit(25)
1414

15-
@low_inventory_report = LowInventoryQuery.call(current_organization)
15+
@low_inventory_report = LowInventoryQuery.call(current_organization, inventory)
1616

1717
# passing nil here filters the announcements that didn't come from an organization
1818
@broadcast_announcements = BroadcastAnnouncement.filter_announcements(nil)
1919
end
20+
21+
private
22+
23+
def inventory
24+
@inventory ||= View::Inventory.new(current_organization.id)
25+
end
2026
end

app/controllers/distributions_controller.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def index
4949
@paginated_distributions = @distributions.page(params[:page])
5050
@items = current_organization.items.alphabetized.select(:id, :name)
5151
@item_categories = current_organization.item_categories.select(:id, :name)
52-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select(:id, :name)
52+
@storage_locations = current_organization.storage_locations.active.alphabetized.select(:id, :name)
5353
@partners = current_organization.partners.active.alphabetized.select(:id, :name)
5454
@selected_item = filter_params[:by_item_id].presence
5555
@distribution_totals = DistributionTotalsService.new(current_organization.distributions, scope_filters)
@@ -69,7 +69,7 @@ def index
6969
respond_to do |format|
7070
format.html
7171
format.csv do
72-
send_data Exports::ExportDistributionsCSVService.new(distributions: @distributions, organization: current_organization, filters: scope_filters).generate_csv, filename: "Distributions-#{Time.zone.today}.csv"
72+
send_data Exports::ExportDistributionsCSVService.new(distributions: @distributions.includes(line_items: :item), organization: current_organization, filters: scope_filters).generate_csv, filename: "Distributions-#{Time.zone.today}.csv"
7373
end
7474
end
7575
end
@@ -122,7 +122,7 @@ def create
122122
@partner_list = current_organization.partners.where.not(status: 'deactivated').alphabetized
123123

124124
inventory = View::Inventory.new(@distribution.organization_id)
125-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
125+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
126126
inventory.quantity_for(storage_location: storage_loc.id).positive?
127127
end
128128
if @distribution.storage_location.present?
@@ -157,7 +157,7 @@ def new
157157
@partner_list = current_organization.partners.where.not(status: 'deactivated').alphabetized
158158

159159
inventory = View::Inventory.new(current_organization.id)
160-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
160+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
161161
inventory.quantity_for(storage_location: storage_loc.id).positive?
162162
end
163163
end
@@ -185,7 +185,7 @@ def edit
185185
.where(storage_location_id: @distribution.storage_location_id)
186186
.where("updated_at > ?", @distribution.created_at).any?
187187
inventory = View::Inventory.new(@distribution.organization_id)
188-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
188+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
189189
!inventory.quantity_for(storage_location: storage_loc.id).negative?
190190
end
191191
else
@@ -212,7 +212,7 @@ def update
212212
@distribution.initialize_request_items
213213
@items = current_organization.items.active.alphabetized
214214
@partner_list = current_organization.partners.alphabetized
215-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
215+
@storage_locations = current_organization.storage_locations.active.alphabetized
216216
render :edit
217217
end
218218
end

app/controllers/donations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def destroy
123123
private
124124

125125
def load_form_collections
126-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
126+
@storage_locations = current_organization.storage_locations.active.alphabetized
127127
@donation_sites = current_organization.donation_sites.active.alphabetized
128128
@product_drives = current_organization.product_drives.alphabetized
129129
@product_drive_participants = current_organization.product_drive_participants.alphabetized

0 commit comments

Comments
 (0)