Skip to content

Commit

Permalink
Fixes (#1274)
Browse files Browse the repository at this point in the history
* set SASS container to build from dev dockerfile not production one; fix adoption applications error - missing permitted param

* Update card component to enable customizing the images being passed to it
  • Loading branch information
kasugaijin authored Dec 18, 2024
1 parent 557f806 commit a3073cf
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/components/application_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Types
ImageTagSource =
Types::String |
Types::Symbol |
Types::Integer |
Types::Nil |
Types::Instance(ActiveStorage::Attachment) |
Types::Instance(ActiveStorage::Attached::One) |
Expand Down
2 changes: 1 addition & 1 deletion app/components/card_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="<%= card_options[:class] %>">
<% if image_options[:url] %>
<%= link_to image_options[:url] do %>
<%= image_tag image_src, class: image_options[:class] %>
<%= image_tag image_src, class: image_options[:class], height: image_options[:height], style: image_options[:style] %>
<% if badge? %>
<div class="position-absolute top-0 end-0 m-2">
<%= badge %>
Expand Down
2 changes: 2 additions & 0 deletions app/components/card_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class CardComponent < ApplicationComponent
src?: Types::ImageTagSource,
class?: Types::String.default("card-img-top"),
url?: Types::String,
style: Types::String.default("object-fit: cover;"),
height?: Types::Integer.default(150),
default?: Types::ImageTagSource.default("coming_soon.jpg")
),
default: -> { {} }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def application_params
:pet_id,
:form_submission_id,
:status,
:profile_show
:profile_show,
:person_id
)
end
end
2 changes: 1 addition & 1 deletion app/views/organizations/adoptable_pets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<div class="col-lg-4 col-md-6 p-0">
<%= render CardComponent.new(
card_options: {class: "card card-hover m-4"},
image_options: {src: pet.images.first, url: adoptable_pet_path(pet)}
image_options: {src: pet.images.first, url: adoptable_pet_path(pet), height: 275}
) do |c| %>
<%= c.with_badge do %>
<%= render BadgeComponent.new("Adoption Pending", class: "badge bg-info", when: pet.has_adoption_pending?) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="col-lg-4 col-md-6 p-0">
<%= render CardComponent.new(
card_options: {class: "card card-hover m-4"},
image_options: {src: pet.images.first, url: adoptable_pet_path(pet)}
image_options: {src: pet.images.first, url: adoptable_pet_path(pet), height: 200},
) do |c| %>
<%= c.with_badge do %>
<%= render BadgeComponent.new(t("general.adoption_pending"), class: "badge bg-info", when: pet.has_adoption_pending?) %>
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
command: bash -c "rm -f tmp/pids/server.pid && bundle install && bundle exec rails s -b '0.0.0.0'"
volumes:
- .:/petrescue

ports:
- "3000:3000"
depends_on:
Expand All @@ -33,7 +32,9 @@ services:
tty: true

sass:
build: .
build:
context: .
dockerfile: dockerfile.dev
command: bash -c "bundle install && bundle exec rails dartsass:watch"
volumes:
- .:/petrescue
Expand Down

0 comments on commit a3073cf

Please sign in to comment.