polish teachers

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

View File

@ -16,6 +16,7 @@ gem 'html2haml'
gem 'devise'
gem 'carrierwave', '>= 3.0.0.beta', '< 4.0'
gem 'kaminari'
gem "ruby2js" , git: "https://github.com/ruby2js/ruby2js/" , branch: "haml_fix"
gem 'thredded', '~> 1.0'
gem "rest-client"

View File

@ -438,6 +438,7 @@ DEPENDENCIES
haml-rails
html2haml
importmap-rails
kaminari
merged!
mina
passenger

View File

@ -3,7 +3,7 @@ class TeachersController < ApplicationController
# GET /teachers
def index
@teachers = Teacher.all
@teachers = Teacher.page params[:page]
end
# GET /teachers/1

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

View File

@ -6,10 +6,8 @@
.fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10
=link_to teacher do
= image_for( teacher , class: "h-60 w-full object-cover")
%h3.pt-5.text-2xl.bg-gray-100.text-black.font-bold.text-center
%h3.py-5.text-2xl.bg-gray-100.text-black.font-bold.text-center
= teacher.name
.p-2.text-xs.bg-gray-50.text-black.font-bold.text-center
= stayed teacher
%div.h-full
.p-5.text-center
.m-2.text-sm.leading-relaxed.line-clamp-3{ prose_classes }