Skip to content

Commit

Permalink
Merge branch '1367_copyright_year_duplication' of https://github.com/…
Browse files Browse the repository at this point in the history
…Gabe-Torres/homeward-tails into 1367_copyright_year_duplication
  • Loading branch information
Gabe-Torres committed Mar 4, 2025
2 parents 0483043 + f58dd20 commit 84abc59
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ GEM
json (2.10.1)
jwt (2.10.1)
base64
kamal (2.5.2)
kamal (2.5.3)
activesupport (>= 7.0)
base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0)
Expand All @@ -317,7 +317,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.5)
logger (1.6.6)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -583,7 +583,7 @@ GEM
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
uri (1.0.3)
useragent (0.16.11)
version_gem (1.1.4)
view_component (3.21.0)
Expand All @@ -604,7 +604,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.1)
zeitwerk (2.7.2)

PLATFORMS
arm64-darwin-21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class FosteredPetsController < Organizations::BaseController
layout "adopter_foster_dashboard"

def index
@fostered_pets = authorized_scope(Match.fosters.current, with: Organizations::AdopterFosterer::MatchPolicy)
@fostered_pets = authorized_scope(Match.fosters.current.or(Match.fosters.upcoming), with: Organizations::AdopterFosterer::MatchPolicy)
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,34 @@
<div class="col">
<%= link_to adopter_fosterer_fostered_pet_files_path(fostered_pet.pet, pet_id: fostered_pet.pet.id), data: { turbo_frame: "pet_files", action: "click->card#selectCard" } do %>
<div class="card h-100 bg-white border-0 shadow-sm" data-card-target="card">
<div class="card-body d-flex align-items-center justify-content-around">
<div class="me-3 flex-shrink-0" style="width: 50px; height: 50px;">
<%= image_tag(fostered_pet.pet.images.attached? ? fostered_pet.pet.images.first : 'coming_soon.jpg',
class: 'rounded-circle',
style: "width: 100%; height: 100%; object-fit: cover;") %>
<div class="card-body d-flex flex-wrap flex-column flex-lg-row align-items-center justify-content-between gap-2">
<div class="d-flex flex-column align-items-center flex-shrink-0">
<div style="width: 50px; height: 50px;">
<%= image_tag(
fostered_pet.pet.images.attached? ? fostered_pet.pet.images.first : 'coming_soon.jpg',
class: 'rounded-circle',
style: "width: 100%; height: 100%; object-fit: cover;"
) %>
</div>
</div>
<h5 class="card-title mb-0 flex-grow-1 text-center"><%= fostered_pet.pet.name %></h5>
<div class="fostered-dates">
<div class="d-flex flex-column text-end">
<h5 class="mb-1">Start Date: <%= fostered_pet.start_date.strftime("%m/%d/%y") %></h5>
<h5 class="mb-0">End Date: <%= fostered_pet.end_date.strftime("%m/%d/%y") %></h5>
<div class="d-flex flex-column align-items-center flex-shrink-0">
<h2 class="card-title mb-0 flex-grow-1 text-center">
<%= fostered_pet.pet.name %>
</h2>
<div class="badge mt-2 <%= status_classes(fostered_pet.status) %>">
<%= fostered_pet.status.to_s.titleize %>
</div>
</div>
<div class="fostered-dates d-flex flex-column text-start">
<h5 class="mb-1">Start: <%= fostered_pet.start_date.strftime("%m/%d/%y") %></h5>
<h5 class="mt-1">End: <%= fostered_pet.end_date.strftime("%m/%d/%y") %></h5>
</div>
</div>
</div>
<% end %>
</div>
<% end %>

<% end %>
</div>
<% else %>
<%= render partial: "shared/empty_state", locals: {text: t(".empty_state")} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!--//? bootstrap cards -->
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-4 mt-4 w-100 justify-content-center">
<% @pets.each do |pet| %>
<%= link_to adoptable_pet_path(pet) do %>
<%= link_to adoptable_pet_path(pet), data: { turbo: "false" } do %>
<div class="col">
<div class="card featured-pets h-100 mt-4 mt-lg-0">
<%= image_tag(pet.images.first, alt: pet.name, height: 275, style: "object-fit: cover;") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ class FosteredPetsControllerTest < ActionDispatch::IntegrationTest
end
end

should "return only current foster matches for the person" do
should "return current and upcoming foster matches for the person" do
ActsAsTenant.with_tenant(@organization) do
completed_foster = create(:pet, :completed_foster)
current_foster = create(:pet, :current_foster, foster_person: @fosterer.person)
future_foster = create(:pet, :future_foster)
future_foster = create(:pet, :future_foster, foster_person: @fosterer.person)

get adopter_fosterer_fostered_pets_url

assert_includes assigns(:fostered_pets), current_foster.matches.first
assert_includes assigns(:fostered_pets), future_foster.matches.first
assert_not_includes assigns(:fostered_pets), completed_foster.matches.first
assert_not_includes assigns(:fostered_pets), future_foster.matches.first
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions test/factories/pets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@
end

trait :future_foster do
transient do
foster_person { create(:person) }
end

matches {
start = Time.current + rand(1..3).months
[association(:match,
pet: instance,
match_type: :foster,
person: foster_person,
start_date: start,
end_date: start + rand(3..6).months)]
}
Expand Down

0 comments on commit 84abc59

Please sign in to comment.