images get ratios

This commit is contained in:
2022-12-14 13:11:36 +02:00
parent 2685963fd0
commit d7045946da
11 changed files with 88 additions and 58 deletions

View File

@ -1,6 +1,7 @@
module Merged
module ImageHelper
end
end

View File

@ -14,6 +14,15 @@ module Merged
@@renderer = Redcarpet::Markdown.new(html, options)
end
def aspect_ratio image
x , y = image.aspect_ratio
"#{x} / #{y}"
end
def image_root
Image.image_root
end
def markdown(text)
text = text.text unless text.is_a?(String)
return "" if text.blank?
@ -40,7 +49,7 @@ module Merged
clazz = "bg-blue-500 " #full names, no tricks for tailwind
clazz = "bg-red-500 " if danger
clazz += button_classes
content_tag(:button , class: clazz , type: :submit) do
content_tag(:button , class: clazz , type: :submit) do
text
end
end

View File

@ -1,7 +1,7 @@
module Merged
module SectionsHelper
include ViewHelper #for previews
def section_form(options)
url = section_url( @section.id)
form_tag( url , {method: :patch}) do
@ -9,10 +9,6 @@ module Merged
end
end
def image_root
Image.image_root
end
#image tag for the preview, passing options through
def section_preview(section , options)
image_tag("merged/section_preview/#{section.template}" , options)