improving image show, definately wip

This commit is contained in:
2022-12-19 18:55:11 +02:00
parent c7c1ab369f
commit a1ca7f6b29
5 changed files with 53 additions and 5 deletions

View File

@ -7,7 +7,7 @@ module Merged
end
def set_image
@card.image_id = params[:image_id]
@card.image_id = params[:image_id].to_i
@card.save
redirect_to section_cards_url(@card.section.id) , notice: "Image selected: #{@card.image.name}"
end

View File

@ -18,6 +18,9 @@ module Merged
def show
@image = Image.find(params[:id])
@sections = Section.where(image_id: params[:id].to_i)
@cards = Card.where(image_id: params[:id].to_i)
@used = ((@cards.length > 0) || (@sections.length > 0))
end
def create

View File

@ -33,7 +33,7 @@ module Merged
end
def set_image
@section.image_id = params[:image_id]
@section.image_id = params[:image_id].to_i
@section.save
redirect_to section_url(@section.id) , notice: "Image selected: #{@section.image.name}"
end