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.
This commit is contained in:
James Mason 2017-12-21 19:06:36 -08:00
parent 754d201b01
commit fa55224163
26 changed files with 181 additions and 165 deletions

View file

@ -9,34 +9,48 @@ class ConferencesController < ApplicationController
end end
def show def show
# load conference with header content
@conference = Conference.unscoped.eager_load( @conference = Conference.unscoped.eager_load(
:organization,
:splashpage, :splashpage,
:registration_period,
:tickets,
:confirmed_tracks,
:call_for_events,
:event_types,
:program, :program,
:call_for_tracks, :registration_period,
:lodgings,
:call_for_booths,
:confirmed_booths,
:sponsors,
:call_for_sponsors,
:contact, :contact,
venue: [:commercial], venue: :commercial
highlighted_events: [:speakers],
sponsorship_levels: [:sponsors]
).order(
'sponsorship_levels.position ASC',
'sponsors.name',
'tracks.name',
'booths.title',
'lodgings.name',
'tickets.price_cents'
).find_by(conference_finder_conditions) ).find_by(conference_finder_conditions)
authorize! :show, @conference authorize! :show, @conference # TODO: reduce the 10 queries performed here
splashpage = @conference.splashpage
if splashpage.include_cfp
cfps = @conference.program.cfps
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
if @call_for_events.try(:open?)
@event_types = @conference.event_types.pluck(:title)
@track_names = @conference.confirmed_tracks.pluck(:name).sort
end
@call_for_tracks = cfps.find { |call| call.cfp_type == 'tracks' }
end
if splashpage.include_program
@highlights = @conference.highlighted_events.eager_load(:speakers)
if splashpage.include_tracks
@tracks = @conference.confirmed_tracks.eager_load(
:room
).order('tracks.name')
end
if splashpage.include_booths
@booths = @conference.confirmed_booths.order('title')
end
end
if splashpage.include_registrations || splashpage.include_tickets
@tickets = @conference.tickets.order('price_cents')
end
if splashpage.include_lodgings
@lodgings = @conference.lodgings.order('name')
end
if splashpage.include_sponsors
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
:sponsors
).order('sponsorship_levels.position ASC', 'sponsors.name')
end
end end
private private

View file

@ -141,7 +141,7 @@ module ApplicationHelper
hint: 'The people responsible for the booth. You can only select existing users.' hint: 'The people responsible for the booth. You can only select existing users.'
end end
def event_types(conference) def event_types_sentence(conference)
conference.event_types.map { |et| et.title.pluralize }.to_sentence conference.event_types.map { |et| et.title.pluralize }.to_sentence
end end

View file

@ -1,8 +1,7 @@
module ConferenceHelper module ConferenceHelper
# Return true if only call_for_papers or call_for_tracks is open # Return true if only call_for_papers or call_for_tracks is open
def one_call_open(conference) def one_call_open(*calls)
conference.call_for_events.try(:open?) ^ calls.one? { |call| call.try(:open?) }
conference.call_for_tracks.try(:open?)
end end
# URL for sponsorship emails # URL for sponsorship emails

View file

@ -46,7 +46,6 @@ class Conference < ApplicationRecord
has_many :campaigns, dependent: :destroy has_many :campaigns, dependent: :destroy
has_many :commercials, as: :commercialable, dependent: :destroy has_many :commercials, as: :commercialable, dependent: :destroy
has_many :subscriptions, dependent: :destroy has_many :subscriptions, dependent: :destroy
has_one :call_for_sponsors, -> { where(cfp_type: 'sponsors') }, through: :program, source: :cfps
has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps
has_one :call_for_booths, -> { where(cfp_type: 'booths') }, through: :program, source: :cfps has_one :call_for_booths, -> { where(cfp_type: 'booths') }, through: :program, source: :cfps
has_one :call_for_tracks, -> { where(cfp_type: 'tracks') }, through: :program, source: :cfps has_one :call_for_tracks, -> { where(cfp_type: 'tracks') }, through: :program, source: :cfps

View file

@ -21,7 +21,7 @@
%dt %dt
Event types: Event types:
%dd %dd
= event_types(@conference) = event_types_sentence(@conference)
%dt %dt
Tracks: Tracks:
%dd %dd

View file

@ -22,7 +22,7 @@
%dt %dt
Event types: Event types:
%dd %dd
= event_types(@conference) = event_types_sentence(@conference)
%dt %dt
Tracks: Tracks:
%dd %dd

View file

@ -2,7 +2,7 @@
.col-md-12 .col-md-12
%h3.text-center Booths %h3.text-center Booths
.row.row-centered .row.row-centered
- conference.confirmed_booths.to_a.sort_by!(&:title).each do |booth| - booths.each do |booth|
.col-md-2.col-sm-2.col-centered.col-top.booth .col-md-2.col-sm-2.col-centered.col-top.booth
%a.thumbnail{ href: '#', %a.thumbnail{ href: '#',
data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } } data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } }

View file

@ -5,10 +5,12 @@
%section#call %section#call
.container .container
.row .row
- if one_call_open(conference) - if one_call_open(call_for_events, call_for_tracks)
.col-md-3.col-sm-3.hidden-xs &nbsp; .col-md-3.col-sm-3.hidden-xs &nbsp;
- if conference.call_for_events.try(:open?) - if call_for_events.try(:open?)
= render 'call_for_papers', conference: conference = render 'call_for_papers', conference_id: conference.short_title,
call: call_for_events, event_types: event_types, tracks: tracks
.col-md-2.col-sm-2 &nbsp; .col-md-2.col-sm-2 &nbsp;
- if conference.call_for_tracks.try(:open?) - if call_for_tracks.try(:open?)
= render 'call_for_tracks', conference: conference = render 'call_for_tracks', conference_id: conference.short_title,
call: call_for_tracks

View file

@ -1,30 +1,27 @@
- cache [conference, conference.call_for_events, conference.confirmed_tracks, - cache [conference_id, call, event_types, tracks, '#splash#callforpapers'] do
'#splash#callforpapers'] do
.col-md-5.col-sm-5.text-center .col-md-5.col-sm-5.text-center
%h2 %h2
Call for Papers Call for Papers
%p.lead %p.lead
We are now accepting proposals for sessions! We are now accepting proposals for sessions!
%p %p
- if conference.event_types.any? - if event_types.any?
You can submit proposals for You can submit proposals for
%span.notranslate %span.notranslate
= event_types(conference) + '.' = event_types.map(&:pluralize).to_sentence + '.'
- if conference.confirmed_tracks.any? - if tracks.any?
Proposals should fit in one of the Proposals should fit in one of the
%span.notranslate %span.notranslate
= pluralize(conference.confirmed_tracks.length, 'track') + ':' = pluralize(tracks.length, 'track') + ':'
= tracks(conference) + '.' = tracks.to_sentence + '.'
- if conference.call_for_events.try(:open?)
The submission period is open The submission period is open
%em.notranslate %em.notranslate
= date_string(conference.call_for_events.start_date, = date_string(call.start_date, call.end_date) + '.'
conference.call_for_events.end_date) + '.'
%b %b
You have You have
= pluralize(conference.call_for_events.remaining_days, 'day') = pluralize(call.remaining_days, 'day')
left! left!
%p.cta-button %p.cta-button
= link_to "Submit your proposal now", = link_to "Submit your proposal now",
conference_program_proposals_path(conference.short_title), conference_program_proposals_path(conference_id),
class: 'btn btn-success btn-lg text-center' class: 'btn btn-success btn-lg text-center'

View file

@ -1,4 +1,4 @@
- cache [conference, conference.call_for_tracks, '#splash#callfortracks'] do - cache [conference_id, call, '#splash#callfortracks'] do
.col-md-5.col-sm-5.text-center .col-md-5.col-sm-5.text-center
%h2 %h2
Call for Tracks Call for Tracks
@ -8,13 +8,12 @@
Would you like to host a mini-summit, sub-conference, or hack space? Would you like to host a mini-summit, sub-conference, or hack space?
The submission period for track requests is open The submission period for track requests is open
%em %em
= date_string(conference.call_for_tracks.start_date, = date_string(call.start_date, call.end_date) + '.'
conference.call_for_tracks.end_date) + '.'
%b %b
You have You have
= pluralize(conference.call_for_tracks.remaining_days, 'day') = pluralize(call.remaining_days, 'day')
left! left!
%p.cta-button %p.cta-button
= link_to("Submit your request for track", = link_to("Submit your request for track",
conference_program_tracks_path(conference.short_title), conference_program_tracks_path(conference_id),
class: 'btn btn-success btn-lg text-center') class: 'btn btn-success btn-lg text-center')

View file

@ -1,4 +1,4 @@
- cache [conference, conference.venue, '#splash#header'] do - cache [conference, venue, '#splash#header'] do
#banner #banner
.container .container
.row .row
@ -18,14 +18,13 @@
= date_string(conference.start_date, conference.end_date) = date_string(conference.start_date, conference.end_date)
- if conference.venue - if conference.venue
%span.venue.text-nowrap %span.venue.text-nowrap
- if conference.venue.website - if venue.website
= sanitize link_to(conference.venue.name, = sanitize link_to(venue.name, venue.website)
conference.venue.website)
- else - else
= conference.venue.city = venue.city
- if conference.venue.country_name != 'US' - if venue.country_name != 'US'
&bull; &bull;
= conference.venue.country_name = venue.country_name
- unless conference.description.blank? - unless conference.description.blank?
%section#about %section#about

View file

@ -5,10 +5,10 @@
.row .row
.col-md-12 .col-md-12
.row.row-centered .row.row-centered
- conference.highlighted_events.each do |event| - highlights.each do |event|
- speaker = event.speakers_ordered.first - speaker = event.speakers_ordered.first
.col-md-3.col-sm-3.col-centered.col-top.highlights .col-md-3.col-sm-3.col-centered.col-top.highlights
= link_to(conference_program_proposal_path(conference.short_title, = link_to(conference_program_proposal_path(conference_id,
event), event),
class: 'thumbnail') do class: 'thumbnail') do
= image_tag speaker.gravatar_url(size: 300), = image_tag speaker.gravatar_url(size: 300),

View file

@ -2,21 +2,21 @@
%li %li
%a.smoothscroll{ href: '#lodging' } Lodging %a.smoothscroll{ href: '#lodging' } Lodging
- cache [conference.venue, conference.lodgings, '#splash#lodging'] do - cache [venue, lodgings, '#splash#lodging'] do
%section#lodging %section#lodging
.container .container
.row .row
.col-md-12.text-center .col-md-12.text-center
%h2 %h2
Where to stay Where to stay
- if conference.venue - if venue
in in
= conference.venue.city = venue.city
%p.lead %p.lead
We recommend the following accommodations for your visit. We recommend the following accommodations for your visit.
.row.row-centered .row.row-centered
- conference.lodgings.each do |lodging| - lodgings.each do |lodging|
.col-md-4.col-sm-4.col-centered.col-top .col-md-4.col-sm-4.col-centered.col-top
.thumbnail .thumbnail
- if lodging.picture? - if lodging.picture?

View file

@ -2,8 +2,7 @@
%li %li
%a.smoothscroll{ href: '#program' } Program %a.smoothscroll{ href: '#program' } Program
- cache [@confererence, @conference.confirmed_tracks, - cache [conference, highlights, tracks, booths, '#splash#program'] do
@conference.confirmed_booths,'#splash#program'] do
%section#program %section#program
.container .container
.row .row
@ -13,16 +12,17 @@
= conference.title = conference.title
has the most awesome program ever! has the most awesome program ever!
- if conference.highlighted_events.any? - unless highlights.blank?
= render 'highlights', conference: conference = render 'highlights', conference_id: conference.short_title,
highlights: highlights
- if conference.splashpage.include_tracks - if conference.splashpage.include_tracks
- if conference.confirmed_tracks.any? - unless tracks.blank?
= render 'tracks', conference: conference = render 'tracks', tracks: tracks
- if conference.splashpage.include_booths - if conference.splashpage.include_booths
- if conference.confirmed_booths.any? - unless booths.blank?
= render 'booths', conference: conference = render 'booths', booths: booths
- if conference.program.try(:schedule_public?) - if conference.program.try(:schedule_public?)
.row .row
@ -32,6 +32,7 @@
class: 'btn btn-success btn-lg') do class: 'btn btn-success btn-lg') do
Full Schedule Full Schedule
- conference.confirmed_booths.each do |booth| - unless booths.blank?
- booths.each do |booth|
- content_for :modals do - content_for :modals do
= render 'modal_description', object: booth = render 'modal_description', object: booth

View file

@ -2,8 +2,7 @@
%li %li
%a.smoothscroll{ href: '#registration' } Registration %a.smoothscroll{ href: '#registration' } Registration
- cache [conference.registration_period, conference.tickets, - cache [conference, registration_period, tickets, '#splash#registration'] do
'#splash#registration'] do
%section#registration %section#registration
.container .container
.row .row
@ -12,23 +11,23 @@
- if conference.registration_limit_exceeded? - if conference.registration_limit_exceeded?
%p %p
Sorry, the conference registration limit has exceeded Sorry, the conference registration limit has exceeded
- elsif conference.tickets.empty? - elsif tickets.empty?
%p.lead %p.lead
Going to Going to
= conference.short_title = conference.short_title
is free of charge. is free of charge.
%p %p
We only ask you to register yourself before We only ask you to register yourself before
= date_string(conference.registration_period.end_date) = date_string(registration_period.end_date)
so we can plan for the right amount of people. so we can plan for the right amount of people.
%p.cta-button %p.cta-button
- else - else
%p %p
The registration period is open The registration period is open
= date_string(conference.registration_period.start_date, = date_string(registration_period.start_date,
conference.registration_period.end_date) registration_period.end_date)
- if conference.registration_open? - if conference.registration_open?
%p.cta-button %p.cta-button
= link_to('Register Now', = link_to('Register Now',
new_conference_conference_registration_path(conference.short_title), new_conference_conference_registration_path(conference_id),
class: 'btn btn-lg btn-success') class: 'btn btn-lg btn-success')

View file

@ -1,20 +1,20 @@
- cache [conference.contact, '#splash#social'] do - cache [contact, '#splash#social'] do
%section#social-media %section#social-media
.container .container
.row .row
.col-md-12.text-center .col-md-12.text-center
- unless conference.contact.facebook.blank? - unless contact.facebook.blank?
= link_to "#{ conference.contact.facebook }" do = link_to "#{ contact.facebook }" do
%i.fa.fa-facebook-square.fa-4x %i.fa.fa-facebook-square.fa-4x
- unless conference.contact.twitter.blank? - unless contact.twitter.blank?
= link_to "#{ conference.contact.twitter }" do = link_to "#{ contact.twitter }" do
%i.fa.fa-twitter.fa-4x %i.fa.fa-twitter.fa-4x
- unless conference.contact.instagram.blank? - unless contact.instagram.blank?
= link_to "#{ conference.contact.instagram }" do = link_to "#{ contact.instagram }" do
%i.fa.fa-instagram.fa-4x %i.fa.fa-instagram.fa-4x
- unless conference.contact.googleplus.blank? - unless contact.googleplus.blank?
= link_to "#{ conference.contact.googleplus }" do = link_to "#{ contact.googleplus }" do
%i.fa.fa-google-plus-square.fa-4x %i.fa.fa-google-plus-square.fa-4x
- unless conference.contact.email.blank? - unless contact.email.blank?
= mail_to "#{ conference.contact.email }" do = mail_to "#{ contact.email }" do
%i.fa.fa-envelope-o.fa-4x %i.fa.fa-envelope-o.fa-4x

View file

@ -2,11 +2,10 @@
%li %li
%a.smoothscroll{ href: '#sponsors' } Sponsors %a.smoothscroll{ href: '#sponsors' } Sponsors
- cache [conference, conference.sponsors, conference.sponsorship_levels, - cache [conference, sponsorship_levels, '#splash#sponsors'] do
conference.try(:call_for_sponsors), '#splash#sponsors'] do
%section#sponsors %section#sponsors
.container .container
- conference.sponsorship_levels.each do |sponsorship_level| - sponsorship_levels.each do |sponsorship_level|
- if sponsorship_level.sponsors.any? - if sponsorship_level.sponsors.any?
.row.text-center .row.text-center
%h3 %h3
@ -17,12 +16,14 @@
.col-md-4.col-sm-4.col-centered.col-top .col-md-4.col-sm-4.col-centered.col-top
%a{ href: '#', data: { toggle: 'modal', %a{ href: '#', data: { toggle: 'modal',
target: "#modal-sponsor-#{sponsor.id}" } } target: "#modal-sponsor-#{sponsor.id}" } }
- if sponsor.logo_file_name
= image_tag get_logo(sponsor), = image_tag get_logo(sponsor),
class: ['img-responsive', 'img-sponsor', class: ['img-responsive', 'img-sponsor',
"img-sponsor-#{sponsorship_level.position}"], "img-sponsor-#{sponsorship_level.position}"],
title: sponsor.name title: sponsor.name
- else
%h4.text-center= sponsor.name
- if conference.call_for_sponsors.try(:open?)
.row .row
.col-md-12 .col-md-12
%h3.text-center %h3.text-center
@ -30,6 +31,6 @@
= link_to(sponsorship_mailto(conference)) do = link_to(sponsorship_mailto(conference)) do
Contact us! Contact us!
- conference.sponsors.each do |sponsor| - sponsorship_levels.collect(&:sponsors).flatten.each do |sponsor|
- content_for :modals do - content_for :modals do
= render 'modal_description', object: sponsor = render 'modal_description', object: sponsor

View file

@ -2,7 +2,7 @@
%li %li
%a.smoothscroll{ href: '#tickets' } Tickets %a.smoothscroll{ href: '#tickets' } Tickets
- cache [conference, conference.tickets, '#splash#tickets'] do - cache [conference, tickets, '#splash#tickets'] do
%section#tickets %section#tickets
.container .container
.row .row
@ -11,7 +11,7 @@
Support Support
= conference.title = conference.title
.row.row-centered .row.row-centered
- conference.tickets.each do |ticket| - tickets.each do |ticket|
.col-md-3.col-sm-3.col-centered.col-top .col-md-3.col-sm-3.col-centered.col-top
= link_to(conference_tickets_path(conference.short_title), = link_to(conference_tickets_path(conference.short_title),
class: 'thumbnail') do class: 'thumbnail') do

View file

@ -2,7 +2,7 @@
.col-md-12 .col-md-12
%h3.text-center Tracks %h3.text-center Tracks
.row.row-centered .row.row-centered
- conference.confirmed_tracks.to_a.sort_by!(&:name).each do |track| - tracks.each do |track|
.col-md-3.col-sm-3.col-centered.col-top.track .col-md-3.col-sm-3.col-centered.col-top.track
.thumbnail .thumbnail
.caption .caption

View file

@ -3,42 +3,41 @@
%a.smoothscroll{ href: '#venue' } Venue %a.smoothscroll{ href: '#venue' } Venue
%section#venue %section#venue
- if conference.venue.location? - if venue.location?
= render '/conferences/venue_map', conference: conference = render '/conferences/venue_map', venue: venue
- else - else
- cache [conference.venue, conference.venue.commercial, '#splash#venue'] do - cache [venue, commercial, '#splash#venue'] do
.container .container
.row .row
.col-md-6 .col-md-6
.thumbnail#venue-pic .thumbnail#venue-pic
- if commercial = conference.venue.commercial - if commercial
.flexvideo{ id: "resource-content-#{commercial.id}" } .flexvideo{ id: "resource-content-#{commercial.id}" }
= render 'shared/media_item', = render 'shared/media_item',
commercial: commercial commercial: commercial
- elsif conference.venue.picture? - elsif venue.picture?
= image_tag conference.venue.picture.url, = image_tag venue.picture.url,
title: conference.venue.name, class: "img-responsive" title: venue.name, class: "img-responsive"
- else - else
%p.text-center %p.text-center
%span.fa.fa-university.fa-5x %span.fa.fa-university.fa-5x
.caption .caption
%h3.text-center %h3.text-center
= conference.venue.name = venue.name
- unless conference.venue.description.blank? - unless venue.description.blank?
= markdown(conference.venue.description) = markdown(venue.description)
.col-md-6 .col-md-6
%h2 %h2
= conference.venue.city = venue.city
\/ \/
= conference.venue.country_name = venue.country_name
%address %address
= conference.venue.street = venue.street
%br %br
= conference.venue.postalcode + ',' = venue.postalcode + ','
= conference.venue.city = venue.city
%br %br
= conference.venue.country_name = venue.country_name
- if conference.venue.website - if venue.website
%br %br
= sanitize link_to(h(conference.venue.website), = sanitize link_to(h(venue.website), h(venue.website))
h(conference.venue.website))

View file

@ -1,13 +1,13 @@
#map{ style: "height: 500px;" } #map{ style: "height: 500px;" }
- content_for(:script_body) do - content_for(:script_body) do
- marker = escape_javascript(render '/conferences/venue_map_marker', - marker = escape_javascript(render '/conferences/venue_map_marker',
venue: conference.venue) venue: venue)
:javascript :javascript
// create a map in the "map" div, set the view to a given place and zoom // create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map', { scrollWheelZoom: false }).setView( var map = L.map('map', { scrollWheelZoom: false }).setView(
[ [
#{conference.venue.latitude.to_f + 0.05}, #{venue.latitude.to_f + 0.05},
#{h(conference.venue.longitude)} #{h(venue.longitude)}
], 11); ], 11);
// add an OpenStreetMap tile layer // add an OpenStreetMap tile layer
L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
@ -20,8 +20,8 @@
// add a marker in the given location, attach some popup content to it // add a marker in the given location, attach some popup content to it
// and open the popup // and open the popup
L.marker([ L.marker([
#{h conference.venue.latitude}, #{h venue.latitude},
#{h conference.venue.longitude} #{h venue.longitude}
]).addTo(map) ]).addTo(map)
.bindPopup("#{marker}") .bindPopup("#{marker}")
.openPopup(); .openPopup();

View file

@ -12,35 +12,43 @@
#splash #splash
-# header/description -# header/description
= render 'header', conference: @conference = render 'header', conference: @conference, venue: @conference.venue
-# calls for content, or program -# calls for content, or program
- if @conference.splashpage.include_cfp - if @conference.splashpage.include_cfp
= render 'call_for_content', conference: @conference = render 'call_for_content', conference: @conference,
call_for_events: @call_for_events, call_for_tracks: @call_for_tracks,
event_types: @event_types, tracks: @track_names
- if @conference.splashpage.include_program - if @conference.splashpage.include_program
= render 'program', conference: @conference = render 'program', conference: @conference, tracks: @tracks,
highlights: @highlights, booths: @booths
-# attendance/registration -# attendance/registration
- if @conference.splashpage.include_registrations - if @conference.splashpage.include_registrations
- if @conference.registration_open? - if @conference.registration_open?
= render 'registration', conference: @conference = render 'registration', conference: @conference,
registration_period: @conference.registration_period,
tickets: @tickets, conference_id: @conference_id.short_title
- if @conference.splashpage.include_tickets && @conference.tickets.any? - if @conference.splashpage.include_tickets && @conference.tickets.any?
= render 'tickets', conference: @conference = render 'tickets', conference: @conference, tickets: @tickets
-# geo -# geo
- if @conference.splashpage.include_venue && @conference.venue - if @conference.splashpage.include_venue && @conference.venue
= render 'venue', conference: @conference = render 'venue', conference: @conference, venue: @conference.venue,
commercial: @conference.venue.commercial
- if @conference.splashpage.include_lodgings && @conference.lodgings.any? - if @conference.splashpage.include_lodgings && @conference.lodgings.any?
= render 'lodging', conference: @conference = render 'lodging', venue: @conference.venue, lodgings: @lodgings
-# sponsorship -# sponsorship
- if @conference.splashpage.include_sponsors - if @conference.splashpage.include_sponsors
= render 'sponsors', conference: @conference = render 'sponsors', conference: @conference,
sponsorship_levels: @sponsorship_levels
-# footer -# footer
- if @conference.splashpage.include_social_media - if @conference.splashpage.include_social_media
- if @conference.contact.has_social_media? - if @conference.contact.has_social_media?
= render 'social_media', conference: @conference = render 'social_media', contact: @conference.contact
= render 'footer' = render 'footer'
= yield :modals = yield :modals

View file

@ -1,7 +1,7 @@
%p.lead %p.lead
- if @program.event_types.any? - if @program.event_types.any?
You can submit proposals for You can submit proposals for
= "#{event_types(@conference)}." = "#{event_types_sentence(@conference)}."
- if @program.tracks.confirmed.cfp_active.any? - if @program.tracks.confirmed.cfp_active.any?
Proposals should fit in one of the Proposals should fit in one of the
= "#{pluralize(@program.tracks.confirmed.cfp_active.count, 'track')}:" = "#{pluralize(@program.tracks.confirmed.cfp_active.count, 'track')}:"

View file

@ -13,7 +13,7 @@ feature Splashpage do
visit admin_conference_splashpage_path(conference.short_title) visit admin_conference_splashpage_path(conference.short_title)
click_link 'Create Splashpage' click_link 'Create Splashpage'
click_button 'Save Splashpage' click_button 'Save Changes'
expect(flash).to eq('Splashpage successfully created.') expect(flash).to eq('Splashpage successfully created.')
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
@ -28,7 +28,7 @@ feature Splashpage do
click_link 'Edit' click_link 'Edit'
check('Make splash page public') check('Make splash page public')
click_button 'Save Splashpage' click_button 'Save Changes'
expect(flash).to eq('Splashpage successfully updated.') expect(flash).to eq('Splashpage successfully updated.')
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))

View file

@ -233,18 +233,18 @@ feature 'Version' do
scenario 'display changes in splashpages', feature: true, versioning: true, js: true do scenario 'display changes in splashpages', feature: true, versioning: true, js: true do
visit admin_conference_splashpage_path(conference.short_title) visit admin_conference_splashpage_path(conference.short_title)
click_link 'Create Splashpage' click_link 'Create Splashpage'
click_button 'Save Splashpage' click_button 'Save Changes'
click_link 'Edit' click_link 'Edit'
uncheck('Display program') uncheck('Display the program')
uncheck('Display call for papers and call for tracks information on splashpage, while open') uncheck('Display call for papers and call for tracks, while open')
uncheck('Display venue') uncheck('Display the venue')
uncheck('Display tickets') uncheck('Display tickets')
uncheck('Display the lodgings') uncheck('Display the lodgings')
uncheck('Display sponsors') uncheck('Display sponsors')
uncheck('Display social media') uncheck('Display social media links')
check('Make splash page public?') check('Make splash page public?')
click_button 'Save Splashpage' click_button 'Save Changes'
splashpage_id = conference.splashpage.id splashpage_id = conference.splashpage.id
click_link 'Delete' click_link 'Delete'

View file

@ -6,7 +6,7 @@ describe ConferenceHelper, type: :helper do
describe '#one_call_open' do describe '#one_call_open' do
it 'is falsey if neither call is open' do it 'is falsey if neither call is open' do
expect(one_call_open(conference)).to be_falsey expect(one_call_open(*conference.program.cfps)).to be_falsey
end end
it 'is truthy if call_for_papers is open' do it 'is truthy if call_for_papers is open' do
@ -17,8 +17,7 @@ describe ConferenceHelper, type: :helper do
start_date: conference.start_date, start_date: conference.start_date,
end_date: conference.end_date end_date: conference.end_date
) )
expect(one_call_open(*conference.program.cfps)).to be_truthy
expect(one_call_open(conference)).to be_truthy
end end
it 'is truthy if call_for_tracks is open' do it 'is truthy if call_for_tracks is open' do
@ -30,7 +29,7 @@ describe ConferenceHelper, type: :helper do
end_date: conference.end_date end_date: conference.end_date
) )
expect(one_call_open(conference)).to be_truthy expect(one_call_open(*conference.program.cfps)).to be_truthy
end end
it 'is falsey if both calls are open' do it 'is falsey if both calls are open' do
@ -49,7 +48,7 @@ describe ConferenceHelper, type: :helper do
end_date: conference.end_date end_date: conference.end_date
) )
expect(one_call_open(conference)).to be_falsey expect(one_call_open(*conference.program.cfps)).to be_falsey
end end
end end