make base to image connectio and use image instances instead of names

This commit is contained in:
2022-12-17 13:11:20 +02:00
parent 4d4de51c8b
commit 27bf4f4269
11 changed files with 35 additions and 24 deletions

View File

@ -19,10 +19,6 @@ module Merged
"#{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?

View File

@ -7,8 +7,7 @@ module Merged
def bg(section , clazz = "")
attributes = {class: clazz}
return attributes if section.image.blank?
#puts "--#{Image.image_root}/#{section.image}--"
img = asset_url( "#{Image.image_root}/#{section.image}" )
img = asset_url( section.image.assert_name )
attributes["style"] = "background-image: url('#{img}');"
if(section.option("fixed") == "on")
attributes[:class] = attributes[:class] + " bg-fixed"
@ -19,7 +18,7 @@ module Merged
# works for with sections and cards that respond to .image
def image_for(element , classes = "")
return "" if element.image.blank?
image_tag("#{Image.image_root}/#{element.image}" , class: classes)
image_tag(element.image.assert_name , class: classes)
end
end