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

341609 Add delivery block to Site #14

Open
wants to merge 8 commits into
base: 341607-update-show-pages
Choose a base branch
from

Conversation

B-Rass
Copy link

@B-Rass B-Rass commented Oct 17, 2024

No description provided.

@B-Rass B-Rass added the enhancement New feature or request label Oct 17, 2024
@B-Rass B-Rass self-assigned this Oct 17, 2024
db/schema.rb Outdated
@@ -485,6 +485,9 @@
t.decimal "latitude"
t.decimal "longitude"
t.integer "rooms_count", default: 0, null: false
t.text "description"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't match with migration

<dd class="mb-0 pb-2 ps-3">
<% if @site.delivery_map.attached? %>
<%= link_to @site.delivery_map, rel: :noopener, target: :_blank do %>
<%= image_tag @site.delivery_map, class: "w-100" %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a representation with resize. Here if use upload a pdf, it will do an image of first page at least.

@@ -7,6 +7,8 @@ class Site < ApplicationRecord
has_many :rooms, dependent: :restrict_with_error
has_many :frames, through: :rooms, dependent: :restrict_with_error

has_one_attached :delivery_map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add some format and size validation?

<%= f.label :delivery_map, class: "form-label" %>
<%= f.file_field :delivery_map, class: "form-control" %>
<% if @site.delivery_map.attached? %>
<%= image_tag @site.delivery_map.variant(resize_to_limit: [200, 200]), class: "ms-0 mt-2" %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<%= image_tag @site.delivery_map.variant(resize_to_limit: [200, 200]), class: "ms-0 mt-2" %>
<%= image_tag @site.delivery_map.representation(resize_to_limit: [200, 200]), class: "ms-0 mt-2" %>

Prefer representation to manage other files than images (ex: pdf)

@B-Rass B-Rass marked this pull request as ready for review October 18, 2024 10:50
@B-Rass B-Rass marked this pull request as draft October 18, 2024 10:50
@B-Rass B-Rass marked this pull request as ready for review October 22, 2024 15:40
@B-Rass B-Rass force-pushed the 341609-add-delivery-block-to-site branch from 388a822 to 2fe812d Compare October 22, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants