[refractor]Use ? methods instead of boolean variables; rename happening_next? to happening_later?
This commit is contained in:
parent
59c5d432ed
commit
ab15a3fb10
6 changed files with 18 additions and 18 deletions
|
|
@ -40,7 +40,7 @@ class ConferencesController < ApplicationController
|
||||||
|
|
||||||
@image_url = "#{request.protocol}#{request.host}#{@conference.picture}"
|
@image_url = "#{request.protocol}#{request.host}#{@conference.picture}"
|
||||||
|
|
||||||
if splashpage.include_cfp
|
if splashpage.include_cfp?
|
||||||
cfps = @conference.program.cfps
|
cfps = @conference.program.cfps
|
||||||
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
|
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
|
||||||
if @call_for_events.try(:open?)
|
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_tracks = cfps.find { |call| call.cfp_type == 'tracks' }
|
||||||
@call_for_booths = cfps.find { |call| call.cfp_type == 'booths' }
|
@call_for_booths = cfps.find { |call| call.cfp_type == 'booths' }
|
||||||
end
|
end
|
||||||
if splashpage.include_program
|
if splashpage.include_program?
|
||||||
@highlights = @conference.highlighted_events.eager_load(:speakers)
|
@highlights = @conference.highlighted_events.eager_load(:speakers)
|
||||||
if splashpage.include_tracks
|
if splashpage.include_tracks?
|
||||||
@tracks = @conference.confirmed_tracks.eager_load(
|
@tracks = @conference.confirmed_tracks.eager_load(
|
||||||
:room
|
:room
|
||||||
).order('tracks.name')
|
).order('tracks.name')
|
||||||
end
|
end
|
||||||
if splashpage.include_booths
|
if splashpage.include_booths?
|
||||||
@booths = @conference.confirmed_booths.order('title')
|
@booths = @conference.confirmed_booths.order('title')
|
||||||
end
|
end
|
||||||
if splashpage.include_happening_now
|
if splashpage.include_happening_now?
|
||||||
load_happening_now
|
load_happening_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if splashpage.include_registrations || splashpage.include_tickets
|
if splashpage.include_registrations? || splashpage.include_tickets?
|
||||||
@tickets = @conference.tickets.visible.order('price_cents')
|
@tickets = @conference.tickets.visible.order('price_cents')
|
||||||
end
|
end
|
||||||
if splashpage.include_lodgings
|
if splashpage.include_lodgings?
|
||||||
@lodgings = @conference.lodgings.order('id')
|
@lodgings = @conference.lodgings.order('id')
|
||||||
end
|
end
|
||||||
if splashpage.include_sponsors
|
if splashpage.include_sponsors?
|
||||||
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
|
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
|
||||||
:sponsors
|
:sponsors
|
||||||
).order('sponsorship_levels.position ASC', 'sponsors.name')
|
).order('sponsorship_levels.position ASC', 'sponsors.name')
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ module ConferenceHelper
|
||||||
def get_happening_next_events_schedules(conference)
|
def get_happening_next_events_schedules(conference)
|
||||||
events_schedules = conference.program.selected_event_schedules(
|
events_schedules = conference.program.selected_event_schedules(
|
||||||
includes: [:room, { event: %i[track event_type speakers submitter] }]
|
includes: [:room, { event: %i[track event_type speakers submitter] }]
|
||||||
).select(&:happening_next?)
|
).select(&:happening_later?)
|
||||||
|
|
||||||
if events_schedules.empty?
|
if events_schedules.empty?
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class EventSchedule < ApplicationRecord
|
||||||
event_time_range.overlaps?(now_range)
|
event_time_range.overlaps?(now_range)
|
||||||
end
|
end
|
||||||
|
|
||||||
def happening_next?
|
def happening_later?
|
||||||
# TODO: Save start_time with local timezone info when making an event schedule
|
# TODO: Save start_time with local timezone info when making an event schedule
|
||||||
in_tz_start = start_time.in_time_zone(timezone)
|
in_tz_start = start_time.in_time_zone(timezone)
|
||||||
in_tz_start -= in_tz_start.utc_offset
|
in_tz_start -= in_tz_start.utc_offset
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
- if @conference.program.schedule_public
|
- if @conference.program.schedule_public
|
||||||
%td {schedule_link}
|
%td {schedule_link}
|
||||||
%td The link to complete schedule of the conference
|
%td The link to complete schedule of the conference
|
||||||
- if @conference.splashpage && @conference.splashpage.public
|
- if @conference.splashpage && @conference.splashpage.public?
|
||||||
%tr
|
%tr
|
||||||
%td {conference_splash_link}
|
%td {conference_splash_link}
|
||||||
%td The link to conference splash page
|
%td The link to conference splash page
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
%i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" }
|
%i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" }
|
||||||
Display social media links
|
Display social media links
|
||||||
%li
|
%li
|
||||||
- if @conference.splashpage && @conference.splashpage.public
|
- if @conference.splashpage && @conference.splashpage.public?
|
||||||
%i{ class: "fa-li #{icon_for_todo @splashpage.public?}" }
|
%i{ class: "fa-li #{icon_for_todo @splashpage.public?}" }
|
||||||
%text-muted.publicorprivate Public
|
%text-muted.publicorprivate Public
|
||||||
- else
|
- else
|
||||||
|
|
|
||||||
|
|
@ -53,18 +53,18 @@
|
||||||
is_happening_next: @is_happening_next
|
is_happening_next: @is_happening_next
|
||||||
|
|
||||||
-# 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,
|
call_for_events: @call_for_events, call_for_tracks: @call_for_tracks,
|
||||||
call_for_booths: @call_for_booths,
|
call_for_booths: @call_for_booths,
|
||||||
event_types: @event_types, tracks: @track_names
|
event_types: @event_types, tracks: @track_names
|
||||||
|
|
||||||
- if @conference.splashpage.include_program
|
- if @conference.splashpage.include_program?
|
||||||
= render 'program', conference: @conference, tracks: @tracks,
|
= render 'program', conference: @conference, tracks: @tracks,
|
||||||
highlights: @highlights, booths: @booths
|
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,
|
registration_period: @conference.registration_period,
|
||||||
|
|
@ -73,20 +73,20 @@
|
||||||
= render 'tickets', conference: @conference, tickets: @tickets
|
= 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, venue: @conference.venue,
|
= render 'venue', conference: @conference, venue: @conference.venue,
|
||||||
commercial: @conference.venue.commercial
|
commercial: @conference.venue.commercial
|
||||||
- if @conference.splashpage.include_lodgings && @conference.lodgings.any?
|
- if @conference.splashpage.include_lodgings && @conference.lodgings.any?
|
||||||
= render 'lodging', venue: @conference.venue, lodgings: @lodgings
|
= 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,
|
sponsorship_levels: @sponsorship_levels,
|
||||||
sponsors: @sponsors
|
sponsors: @sponsors
|
||||||
|
|
||||||
-# 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', contact: @conference.contact
|
= render 'social_media', contact: @conference.contact
|
||||||
= render 'footer'
|
= render 'footer'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue