start on lightbox
This commit is contained in:
parent
050f7a9371
commit
79b58eb937
@ -1,11 +1,7 @@
|
|||||||
module MembersHelper
|
module MembersHelper
|
||||||
|
|
||||||
def picture_for(someone , classes = "")
|
def picture_for(someone , classes = "")
|
||||||
if someone.picture.blank?
|
image = someones_path(someone)
|
||||||
image = asset_url("no_image.png")
|
|
||||||
else
|
|
||||||
image = someone.picture.url
|
|
||||||
end
|
|
||||||
if someone.respond_to? :name
|
if someone.respond_to? :name
|
||||||
alt = someone.name
|
alt = someone.name
|
||||||
else
|
else
|
||||||
@ -14,6 +10,13 @@ module MembersHelper
|
|||||||
image_tag(image , alt: alt , class: classes )
|
image_tag(image , alt: alt , class: classes )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def someones_path( someone )
|
||||||
|
if someone.picture.blank?
|
||||||
|
asset_url("no_image.png")
|
||||||
|
else
|
||||||
|
someone.picture.url
|
||||||
|
end
|
||||||
|
end
|
||||||
def stayed(member)
|
def stayed(member)
|
||||||
return "Not arrived" if member.arrived.blank?
|
return "Not arrived" if member.arrived.blank?
|
||||||
text = member.arrived.to_s
|
text = member.arrived.to_s
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
= distance_of_time_in_words_to_now picture.happened
|
= distance_of_time_in_words_to_now picture.happened
|
||||||
ago
|
ago
|
||||||
.h-0.overflow-hidden.relative{class: "pt-[75%]"}
|
.h-0.overflow-hidden.relative{class: "pt-[75%]"}
|
||||||
= picture_for( picture , "absolute top-0 left-0 w-full h-full inset-0 object-cover hover:scale-105 ease-in duration-500")
|
=link_to someones_path( picture ) , {class: :glightbox ,
|
||||||
|
"data-glightbox" => "title: #{picture.text}" } do
|
||||||
|
= picture_for( picture , "absolute top-0 left-0 w-full h-full inset-0 object-cover hover:scale-105 ease-in duration-500")
|
||||||
-unless picture.text.blank?
|
-unless picture.text.blank?
|
||||||
.absolute.bottom-0.left-0.right-0.px-4.pb-1.bg-gray-800.opacity-70.transition-colors.group-hover:bg-black.group-hover:opacity-100
|
.absolute.bottom-0.left-0.right-0.px-4.pb-1.bg-gray-800.opacity-70.transition-colors.group-hover:bg-black.group-hover:opacity-100
|
||||||
.text-center.mt-2.text-white= picture.text
|
.text-center.mt-2.text-white= picture.text
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
%link{:href => "https://cdn.jsdelivr.net/npm/glightbox/dist/css/glightbox.min.css", :rel => "stylesheet"}/
|
||||||
|
%script{:src => "https://cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"}
|
||||||
|
|
||||||
= paginate @pictures
|
= paginate @pictures
|
||||||
|
|
||||||
.flex.justify-end.mr-10
|
.flex.justify-end.mr-10
|
||||||
@ -9,9 +12,10 @@
|
|||||||
- @pictures.each do |picture|
|
- @pictures.each do |picture|
|
||||||
= render picture , picture: picture
|
= render picture , picture: picture
|
||||||
|
|
||||||
%br
|
|
||||||
|
|
||||||
.flex.ml-20
|
.flex.ml-20
|
||||||
= link_to new_picture_path do
|
= link_to new_picture_path do
|
||||||
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||||
New Picture
|
New Picture
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
const lightbox = GLightbox({ });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user