fix remove image for card and section

This commit is contained in:
2023-01-02 22:52:01 +02:00
parent 42ff77b70c
commit 693d121c0f
6 changed files with 56 additions and 13 deletions

View File

@ -21,7 +21,7 @@
= form_tag( merged.card_path(card.id) , {method: :delete } ) do
=submit_button( "Delete" , true)
.p-4
%h3.mt-4.text-lg.font-bold Image
%h3.mt-4.text-lg.font-bold.image_button Image
= yellow_button("Change Image" , merged.images_path(card_id: card.id) )
= red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
.basis-full.mt-3
@ -42,7 +42,7 @@
= card.image.aspect_ratio
= image_for( card )
-else
%h3.mt-4.text-lg.font-bold No Image
%h3.mt-4.text-lg.font-bold No image
.basis-72.grow
%h3.mt-4.text-lg.font-bold Fields
= form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do

View File

@ -19,14 +19,21 @@
Updated by:
= @section.updated_by
.basis-96
%h3.mt-4.text-lg.font-bold Image
-if( @section.image.blank? )
%p No image
-else
= image_for( @section , "my-3")
= yellow_button("Change Image", merged.images_path(section_id: @section.id))
= red_button( "Remove image", merged.section_set_image_path( @section.id , image: ""))
.basis-96.image
= link_to(merged.images_path(section_id: @section.id)) do
-if @section.image
%h3.mt-4.text-lg.font-bold Image #{@section.image.name}
.flex.align-center.justify-between.mb-4
.text-lg.font-bold.mt-2.mx-2
= @section.image.size.to_s + "k"
%strong.inline-block.rounded.bg-yellow-200.px-3.py-1.text-md.font-medium
= @section.image.aspect_ratio
= image_for( @section )
-else
%h3.mt-4.text-lg.font-bold No Image
.flex
.mt-3= yellow_button("Change Image", merged.images_path(section_id: @section.id))
.mt-3= red_button( "Remove image", merged.section_set_image_path( @section.id , image: "")) if( @section.image )
.basis-80.grow.content_update
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do