Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4672 header alignment #4716

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ Make sure to install **Ubuntu** as your Linux distribution. (This should be defa
Waiting Approval Partner
Email: [email protected]
Password: password!

Another approved partner (with all groups):
Email: [email protected]
Pasword: password!
```
</details>

Expand Down
13 changes: 0 additions & 13 deletions app/javascript/controllers/password_visibility_controller.js

This file was deleted.

3 changes: 3 additions & 0 deletions app/models/concerns/provideable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module Provideable
included do
belongs_to :organization # Automatically validates presence as of Rails 5

validates :contact_name, presence: { message: "Must provide a name or a business name" }, if: proc { |ddp| ddp.business_name.blank? }
validates :business_name, presence: { message: "Must provide a name or a business name" }, if: proc { |ddp| ddp.contact_name.blank? }

scope :for_csv_export, ->(organization, *) {
where(organization: organization).order(:business_name)
}
Expand Down
2 changes: 0 additions & 2 deletions app/models/product_drive_participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class ProductDriveParticipant < ApplicationRecord

validates :phone, presence: { message: "Must provide a phone or an e-mail" }, if: proc { |pdp| pdp.email.blank? }
validates :email, presence: { message: "Must provide a phone or an e-mail" }, if: proc { |pdp| pdp.phone.blank? }
validates :contact_name, presence: { message: "Must provide a name or a business name" }, if: proc { |pdp| pdp.business_name.blank? }
validates :business_name, presence: { message: "Must provide a name or a business name" }, if: proc { |pdp| pdp.contact_name.blank? }
validates :comment, length: { maximum: 500 }

scope :alphabetized, -> { order(:contact_name) }
Expand Down
2 changes: 0 additions & 2 deletions app/models/vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class Vendor < ApplicationRecord

has_many :purchases, inverse_of: :vendor, dependent: :destroy

validates :business_name, presence: true

scope :alphabetized, -> { order(:business_name) }

def volume
Expand Down
4 changes: 2 additions & 2 deletions app/views/adjustments/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<table class="table">
<thead>
<tr>
<th>Created</th>
<th>Organization</th>
<th class = "text-center">Created</th>
<th >Organization</th>
<th>Storage location</th>
<th>Comment</th>
<th>Summary</th>
Expand Down
14 changes: 0 additions & 14 deletions app/views/dashboard/_getting_started_prompt.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
</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 @@ -136,18 +135,5 @@
</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 %>
6 changes: 3 additions & 3 deletions app/views/items/_item_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<tr>
<th>Category</th>
<th>Name</th>
<th>Quantity Per Individual</th>
<th>Fair Market Value (per item)</th>
<th class = "text-right">Quantity Per Individual</th>
<th class = "text-right">Fair Market Value (per item)</th>
<% if Flipper.enabled?(:enable_packs) %>
<% unless current_organization.request_units.empty? %>
<th>Custom Request Units</th>
<% end %>
<% end %>
<th class="text-center">Actions</th>
<th class = "text-right">Actions</th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion app/views/items/_item_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tr data-item-id="<%= item_row.id %>">
<td><%= item_row.item_category && link_to(item_row.item_category&.name, item_category_path(item_row.item_category), class: 'text-blue-500') %></td>
<td><%= item_row.name %></td>
<td><%= item_row.distribution_quantity %></td>
<td class="text-right"> <%= item_row.distribution_quantity %></td>
<td class="numeric"><%= dollar_value(item_row.value_in_cents) %></td>
<% if Flipper.enabled?(:enable_packs) %>
<% unless current_organization.request_units.empty? %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/purchases/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
<th>Purchases from</th>
<th>Storage Location</th>
<th>Comments</th>
<th>Quantity of Items</th>
<th>Variety of Items</th>
<th>Amount spent</th>
<th>FMV</th>
<th>Purchased Date</th>
<th class= "text-right">Quantity of Items</th>
<th class = "text-right">Variety of Items</th>
<th class = "text-right">Amount spent</th>
<th class = "text-right">FMV</th>
<th class = "text-right">Purchased Date</th>
<th class="text-right">Actions</th>
</tr>
</thead>
Expand Down
9 changes: 5 additions & 4 deletions app/views/users/_organization_user.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
<ul class="dropdown-menu">
<li>
<%=
edit_button_to(
edit_admin_user_path(user),
{text: 'Edit User'}
)
edit_button_to(
promote_to_org_admin_organization_path(user_id: user.id),
{text: 'Promote to Admin'},
{method: :post, rel: "nofollow", data: {confirm: 'This will promote the user to admin status. Are you sure that you want to submit this?', size: 'xs'}}
)
%>
</li>
<li>
Expand Down
23 changes: 2 additions & 21 deletions app/views/users/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
<style>
.password-input-wrapper {
position: relative;
}

.toggle-password {
position: absolute;
right: 10px;
top: 70%;
transform: translateY(-50%);
cursor: pointer;
color: #999;
}
</style>
<%= render partial: "shared/flash" %>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="login-box">
Expand All @@ -25,13 +11,8 @@
<div class="form-inputs">
<%= f.input :email, autofocus: true %>
</div>
<div class="form-inputs" data-controller="password-visibility">
<div class="password-input-wrapper">
<%= f.input :password, autofocus: true, input_html: { data: { password_visibility_target: 'password' } } %>
<span class="toggle-password">
<i class="fas fa-eye-slash" data-action="click->password-visibility#toggle" data-password-visibility-target="icon"></i>
</span>
</div>
<div class="form-inputs">
<%= f.input :password, autofocus: true %>
</div>
<div class="col-12 text-center">
<%= f.button :submit, "Log in", class: "btn btn-primary btn-block" %>
Expand Down
4 changes: 0 additions & 4 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker

# Adds comments to rendered views so you know which partials are being rendered
# more easily.
config.action_view.annotate_rendered_view_with_filenames = true

require "socket"
require "ipaddr"
config.web_console.allowed_ips = Socket.ip_address_list.reduce([]) do |res, addrinfo|
Expand Down

This file was deleted.

24 changes: 3 additions & 21 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,11 @@ def random_record_for_org(org, klass)
# ----------------------------------------------------------------------------
Organization.all.each do |org|
# Setup the Partner Group & their item categories
partner_group_one = FactoryBot.create(:partner_group, organization: org)
partner_group = FactoryBot.create(:partner_group, organization: org)

total_item_categories_to_add = Faker::Number.between(from: 1, to: 2)
org.item_categories.sample(total_item_categories_to_add).each do |item_category|
partner_group_one.item_categories << item_category
end

next unless org.name == pdx_org.name

partner_group_two = FactoryBot.create(:partner_group, organization: org)
org.item_categories.each do |item_category|
partner_group_two.item_categories << item_category
partner_group.item_categories << item_category
end
end

Expand Down Expand Up @@ -227,22 +220,11 @@ def random_record_for_org(org, klass)
email: "[email protected]",
status: :awaiting_review,
notes: note.sample
},
{
name: "Second Street Community Outreach",
status: :approved,
email: "[email protected]",
notes: note.sample
}
].each do |partner_option|
p = Partner.find_or_create_by!(partner_option) do |partner|
partner.organization = pdx_org

if partner_option[:name] == "Second Street Community Outreach"
partner.partner_group = pdx_org.partner_groups.find_by(name: 'Group 2')
else
partner.partner_group = pdx_org.partner_groups.first
end
partner.partner_group = pdx_org.partner_groups.first
end

profile = Partners::Profile.create!({
Expand Down
7 changes: 0 additions & 7 deletions spec/models/product_drive_participant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
expect(build(:product_drive_participant, phone: nil)).to be_valid
expect(build(:product_drive_participant, email: nil)).to be_valid
end

it "is invalid unless it has either a contact name or a business name" do
expect(build(:product_drive_participant, contact_name: nil, business_name: nil)).not_to be_valid
expect(build(:product_drive_participant, contact_name: nil, business_name: "George Company").valid?).to eq(true)
expect(build(:product_drive_participant, contact_name: "George Henry", business_name: nil).valid?).to eq(true)
end

it "is invalid if the comment field has more than 500 characters" do
long_comment = "a" * 501
expect(build(:product_drive_participant, comment: long_comment)).not_to be_valid
Expand Down
7 changes: 0 additions & 7 deletions spec/models/vendor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
RSpec.describe Vendor, type: :model do
it_behaves_like "provideable"

context "Validations" do
it "validates that a business name is present" do
expect(build(:vendor, business_name: "Diaper Enterprises")).to be_valid
expect(build(:vendor, business_name: nil)).to_not be_valid
end
end

context "Methods" do
describe "volume" do
it "retrieves the amount of product that has been bought from this vendor" do
Expand Down
11 changes: 0 additions & 11 deletions spec/requests/admin/organizations_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,6 @@
get admin_organization_path({ id: organization.id })
expect(response).to be_successful
end

context "with an organization user" do
let!(:user) { create(:user, organization: organization) }

it "provides links to edit the user" do
get admin_organization_path({ id: organization.id })

expect(response.body).to include("Edit User")
expect(response.body).to include(edit_admin_user_path(user.id))
end
end
end

describe "PUT #update" do
Expand Down
20 changes: 1 addition & 19 deletions spec/support/pages/organization_dashboard_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ def has_add_inventory_call_to_action?
end

def has_add_partner_call_to_action?
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?
has_selector? "#org-stats-call-to-action-partners"
end

def has_add_storage_location_call_to_action?
Expand Down Expand Up @@ -157,18 +153,4 @@ 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
6 changes: 6 additions & 0 deletions spec/support/provideable_shared_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
let(:model_f) { described_class.to_s.underscore.to_sym }

context "Validations" do
it "is invalid unless it has either a contact name or a business name" do
expect(build(model_f, contact_name: nil, business_name: nil)).not_to be_valid
expect(build(model_f, contact_name: nil, business_name: "George Company").valid?).to eq(true)
expect(build(model_f, contact_name: "George Henry").valid?).to eq(true)
end

it "is invalid without an organization" do
expect(build(model_f, organization: nil)).not_to be_valid
end
Expand Down
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_with_two_links
expect(org_dashboard_page).to have_add_partner_call_to_action
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