polish teachers
This commit is contained in:
1
Gemfile
1
Gemfile
@ -16,6 +16,7 @@ gem 'html2haml'
|
|||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'carrierwave', '>= 3.0.0.beta', '< 4.0'
|
gem 'carrierwave', '>= 3.0.0.beta', '< 4.0'
|
||||||
|
|
||||||
|
gem 'kaminari'
|
||||||
gem "ruby2js" , git: "https://github.com/ruby2js/ruby2js/" , branch: "haml_fix"
|
gem "ruby2js" , git: "https://github.com/ruby2js/ruby2js/" , branch: "haml_fix"
|
||||||
gem 'thredded', '~> 1.0'
|
gem 'thredded', '~> 1.0'
|
||||||
gem "rest-client"
|
gem "rest-client"
|
||||||
|
@ -438,6 +438,7 @@ DEPENDENCIES
|
|||||||
haml-rails
|
haml-rails
|
||||||
html2haml
|
html2haml
|
||||||
importmap-rails
|
importmap-rails
|
||||||
|
kaminari
|
||||||
merged!
|
merged!
|
||||||
mina
|
mina
|
||||||
passenger
|
passenger
|
||||||
|
@ -3,7 +3,7 @@ class TeachersController < ApplicationController
|
|||||||
|
|
||||||
# GET /teachers
|
# GET /teachers
|
||||||
def index
|
def index
|
||||||
@teachers = Teacher.all
|
@teachers = Teacher.page params[:page]
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /teachers/1
|
# GET /teachers/1
|
||||||
|
@ -10,6 +10,17 @@ module ApplicationHelper
|
|||||||
Redcarpet::Markdown.new(html, options)
|
Redcarpet::Markdown.new(html, options)
|
||||||
end
|
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)
|
def markdown(text)
|
||||||
return "" if text.blank?
|
return "" if text.blank?
|
||||||
text = text.text unless text.is_a?(String)
|
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"
|
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
|
||||||
end
|
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
|
end
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
.fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10
|
.fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10
|
||||||
=link_to teacher do
|
=link_to teacher do
|
||||||
= image_for( teacher , class: "h-60 w-full object-cover")
|
= 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
|
= teacher.name
|
||||||
.p-2.text-xs.bg-gray-50.text-black.font-bold.text-center
|
|
||||||
= stayed teacher
|
|
||||||
%div.h-full
|
%div.h-full
|
||||||
.p-5.text-center
|
.p-5.text-center
|
||||||
.m-2.text-sm.leading-relaxed.line-clamp-3{ prose_classes }
|
.m-2.text-sm.leading-relaxed.line-clamp-3{ prose_classes }
|
||||||
|
Reference in New Issue
Block a user