make base to image connectio and use image instances instead of names

This commit is contained in:
2022-12-17 13:11:20 +02:00
parent 4d4de51c8b
commit 27bf4f4269
11 changed files with 35 additions and 24 deletions

View File

@ -31,7 +31,7 @@
-if( card.image.blank? )
%p No image
-else
= image_tag( "cms/" + card.image , class: "p-3")
= image_tag( card.image.assert_name , class: "p-3")
.basis-72.grow
%h3.mt-4.text-lg.font-bold Fields
= form_tag( card_url(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do

View File

@ -6,12 +6,12 @@
= form_tag(merged.images_path, multipart: true) do
= render "merged/images/new_image"
-@images.each do |name , image|
-@images.each do |image|
.flex.flex-col.justify-start.border.rounded.border-gray-100.drop-shadow-lg
.flex.justify-between
.text-xl.m-2= image.name
%strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium
= aspect_ratio(image)
.p-2.object-contain
= link_to( card_set_image_path( image: name)) do
=image_tag("#{image_root}/#{name}" )
= link_to( card_set_image_path( image: image.name)) do
=image_tag( image.asset_name )

View File

@ -7,15 +7,15 @@
.grid.grid-cols-6.gap-4.m-8
= form_tag({action: :create}, multipart: true) do
= render "new_image"
-@images.each do |name , image|
.flex.flex-col.border.border-gray-100.rounded
-@images.each do |image|
.flex.flex-col.border.border-gray-100.rounded.image_box
.flex.align-center.justify-between.mb-4
.text-lg.font-bold.mt-2.mx-2
= image.name
%strong.inline-block.rounded.bg-yellow-200.px-3.py-1.text-md.font-medium
= aspect_ratio(image)
.w-full.object-contain.h-72
=image_tag("cms/#{name}")
=image_tag(image.assert_name)
.flex.justify-between.mb-8
%strong.inline-block.rounded.bg-orange-50.px-3.py-1.text-md.font-medium
= "#{image.size}k"

View File

@ -44,7 +44,7 @@
= link_to(section_select_image_url(section.id)) do
%h3.mt-4.text-lg.font-bold Image
-if section.image
= image_tag( "cms/" + section.image , class: "h-40")
= image_tag( section.image.assert_name , class: "h-40")
-else
%p No image
.basis-52.grow

View File

@ -6,12 +6,12 @@
= form_tag(merged.images_path, multipart: true) do
= render "merged/images/new_image"
-@images.each do |name , image|
-@images.each do |image|
.flex.flex-col.justify-start.border.rounded.border-gray-100.drop-shadow-lg
.flex.justify-between
.text-xl.m-2= image.name
%strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium
= aspect_ratio(image)
.p-2.object-contain
= link_to( section_set_image_path( image: name)) do
=image_tag("#{image_root}/#{name}" )
= link_to( section_set_image_path( image: image.name)) do
=image_tag(image.asset_name )

View File

@ -18,7 +18,7 @@
-if( @section.image.blank? )
%p No image
-else
= image_tag( "cms/" + @section.image , class: "my-3")
= image_tag( @section.image.assert_name , class: "my-3")
= yellow_button("Change Image", section_select_image_url(@section.id))
= red_button( "Remove image", section_set_image_path( @section.id , image: ""))