image delete

This commit is contained in:
Torsten 2022-12-19 21:15:46 +02:00
parent a1ca7f6b29
commit f61ce40e71
3 changed files with 17 additions and 8 deletions

View File

@ -16,6 +16,12 @@ module Merged
}
end
def destroy
@image = Image.find(params[:id])
@image.destroy
redirect_to :images , nootice: "Image #{@image.name} deleted"
end
def show
@image = Image.find(params[:id])
@sections = Section.where(image_id: params[:id].to_i)

View File

@ -32,21 +32,24 @@
%div
-@sections.each do |section|
%p
= section.header
= link_to section.header , section_url(section)
on Page
= section.page.name
= link_to section.page.name , page_sections_url(section.page)
%div
-@cards.each do |card|
%p
= card.header
= link_to card.header , section_cards_url(card.section)
on Page
= card.section.page.name
= link_to card.section.page.name , page_sections_url(card.section.page)
-else
.grid.grid-cols-2.m-20
%p Not used, you may delete
%p
Delete button
%div
%p Not used, you may delete
%div
%p
= form_tag( image_url(@image.id) , {method: :delete } ) do
=submit_button( "Delete" , true)
.m-20
= image_tag(@image.asset_name)

View File

@ -1,7 +1,7 @@
- content_for( :merged_menu ) do
.text-xl.font-bold.text-gray-900
Page
= @page.name
= link_to @page.name , page_url(@page)
.text-xl.text-gray-900
=link_to "View live" , "/#{@page.name}" , target: @page.name