polish teachers

This commit is contained in:
2023-01-15 14:59:06 +02:00
parent 750bd76a7e
commit d017502f18
5 changed files with 24 additions and 4 deletions

View File

@ -10,6 +10,17 @@ module ApplicationHelper
Redcarpet::Markdown.new(html, options)
end
def shorten(text , to = 100)
return "" if text.blank?
"#{text[0..to]} . . . ".html_safe
end
def prose_classes
classes = "prose lg:prose-lg "
classes += "prose-headings:text-inherit "
{ class: classes }
end
def markdown(text)
return "" if text.blank?
text = text.text unless text.is_a?(String)
@ -25,4 +36,13 @@ module ApplicationHelper
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
end
def image_for(someone , classes = "")
if someone.picture.blank?
image = asset_url("no_image.png")
else
image = someone.picture.url
end
image_tag(image , alt: someone.name , class: classes )
end
end