forcing aspect on picture and profile

This commit is contained in:
Torsten
2023-01-26 00:47:27 +02:00
parent 4a79350836
commit d22d67b38a
6 changed files with 19 additions and 16 deletions

View File

@ -1,11 +1,11 @@
%div
Pictures may have a small text, that will be diplayed on top of the
picure.
picure. The Picture box is landscape with ratio 3/4.
= simple_form_for @picture do |f|
= f.error_notification
.flex.h-16.mt-2
= image_tag(@picture.picture_url , class: "align-middle mr-2") if @picture.picture?
= f.input :picture , as: :file , input_html: {wrapper_class: "w-full"},
.w-full= f.input :picture , as: :file ,
label: (@picture.picture.blank? ? "Add picture" : "Change picture")
= f.hidden_field :picture_cache
= f.input :text , as: :text , input_html: { rows: 2 }

View File

@ -4,7 +4,8 @@
.mr-2
= distance_of_time_in_words_to_now picture.happened
ago
= image_for( picture , "inset-0 h-full w-full object-fit hover:scale-105 ease-in duration-500")
.h-0.overflow-hidden.relative{class: "pt-[75%]"}
= image_for( picture , "absolute top-0 left-0 w-full h-full inset-0 object-cover hover:scale-105 ease-in duration-500")
-unless picture.text.blank?
.absolute.bottom-0.left-0.right-0.px-4.pb-1.bg-gray-800.opacity-70.transition-colors.group-hover:bg-black.group-hover:opacity-100
.text-center.mt-2.text-white= picture.text

View File

@ -5,7 +5,7 @@
.border-r-4.mx-4
= sort_link(@q, :created_at , class: 'flex flex-nowrap text-md')
.mx-20.grid.grid-cols-1.md:grid-cols-2.lg:grid-cols-3.xl:grid-cols-4.gap-8.md:gap-12.lg:gap-16
.mx-20.grid.grid-cols-1.md:grid-cols-2.lg:grid-cols-3.2xl:grid-cols-4.gap-8.md:gap-12.lg:gap-16
- @pictures.each do |picture|
= render picture , picture: picture