improving image show, definately wip

This commit is contained in:
Torsten 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

View File

@ -70,7 +70,7 @@
@search_tag = ""
@sort_by = "created"
@sort_dir = -1 # 1 up
@show_new = true
@show_new = false
end
def filter_and_sort
dat = @image_data

View File

@ -1,7 +1,52 @@
- content_for( :merged_menu ) do
.text-xl.font-bold.text-gray-900
Image #{@image.name}
Image: #{@image.name}
= render "layouts/merged_header"
= image_tag(@image.asset_name)
.flex.justify-center.gap-2
%p
.font-bold.mr-2 Name
= @image.name
%p
.mr-2.font-bold Type
= @image.type
%p
.font-bold Size
= @image.size
%p
.font-bold Tags
= @image.tags
%p
.font-bold Ratio
= @image.ratio.round(2)
= @image.aspect_ratio
-if @used
.grid.grid-cols-2.m-20
%p
Sections
=@sections.length
%p
Cards
=@cards.length
%div
-@sections.each do |section|
%p
= section.header
on Page
= section.page.name
%div
-@cards.each do |card|
%p
= card.header
on Page
= card.section.page.name
-else
.grid.grid-cols-2.m-20
%p Not used, you may delete
%p
Delete button
.m-20
= image_tag(@image.asset_name)