osem-fcy/app/views/conferences/_lodging.haml
James Mason fa55224163 Break up the one-query-of-doom
The single query was producing a tremendously large ActiveRecord allocation.

While this isn't nearly as cool as one query, it's still a significant
reduction in SQL trips, and now has the bonus of only loading what is
actually going to be displayed.
2017-12-22 10:48:55 -08:00

41 lines
1.4 KiB
Text

= content_for :splash_nav do
%li
%a.smoothscroll{ href: '#lodging' } Lodging
- cache [venue, lodgings, '#splash#lodging'] do
%section#lodging
.container
.row
.col-md-12.text-center
%h2
Where to stay
- if venue
in
= venue.city
%p.lead
We recommend the following accommodations for your visit.
.row.row-centered
- lodgings.each do |lodging|
.col-md-4.col-sm-4.col-centered.col-top
.thumbnail
- if lodging.picture?
- if lodging.website_link.present?
= link_to(lodging.website_link, class: 'thumbnail') do
= image_tag lodging.picture.large.url,
class: 'img-responsive img-lodging'
- else
= image_tag lodging.picture.large.url,
class: 'img-responsive img-lodging'
- else
%p.text-center
- if lodging.website_link.present?
= link_to(lodging.website_link, class: 'thumbnail') do
%i.fa.fa-home.fa-5x
- else
%i.fa.fa-home.fa-5x
.caption
%h3.text-center
= lodging.name
- if lodging.description.present?
= markdown(lodging.description)