[refractor]Use ? methods instead of boolean variables; rename happening_next? to happening_later?

This commit is contained in:
Jimmy 2021-04-17 08:30:07 +08:00 committed by CactusPuppy
parent 5aea1efab1
commit 47e580904d
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
6 changed files with 18 additions and 18 deletions

View file

@ -40,7 +40,7 @@ class ConferencesController < ApplicationController
@image_url = "#{request.protocol}#{request.host}#{@conference.picture}"
if splashpage.include_cfp
if splashpage.include_cfp?
cfps = @conference.program.cfps
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
if @call_for_events.try(:open?)
@ -50,27 +50,27 @@ class ConferencesController < ApplicationController
@call_for_tracks = cfps.find { |call| call.cfp_type == 'tracks' }
@call_for_booths = cfps.find { |call| call.cfp_type == 'booths' }
end
if splashpage.include_program
if splashpage.include_program?
@highlights = @conference.highlighted_events.eager_load(:speakers)
if splashpage.include_tracks
if splashpage.include_tracks?
@tracks = @conference.confirmed_tracks.eager_load(
:room
).order('tracks.name')
end
if splashpage.include_booths
if splashpage.include_booths?
@booths = @conference.confirmed_booths.order('title')
end
if splashpage.include_happening_now
if splashpage.include_happening_now?
load_happening_now
end
end
if splashpage.include_registrations || splashpage.include_tickets
if splashpage.include_registrations? || splashpage.include_tickets?
@tickets = @conference.tickets.visible.order('price_cents')
end
if splashpage.include_lodgings
if splashpage.include_lodgings?
@lodgings = @conference.lodgings.order('id')
end
if splashpage.include_sponsors
if splashpage.include_sponsors?
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
:sponsors
).order('sponsorship_levels.position ASC', 'sponsors.name')