-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: 341607-update-show-pages
Are you sure you want to change the base?
341609 Add delivery block to Site #14
Conversation
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" |
There was a problem hiding this comment.
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
app/views/sites/show.html.erb
Outdated
<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" %> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
app/views/sites/_form.html.erb
Outdated
<%= 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" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= 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)
388a822
to
2fe812d
Compare
No description provided.