Merge branch 'master' into 176895554/mailbluster

This commit is contained in:
CactusPuppy 2021-04-12 15:27:20 -07:00 committed by GitHub
commit d6fe38bb2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 291 additions and 34 deletions

View file

@ -54,6 +54,7 @@
//= require selectize
//= require bootstrap-select
//= require osem-survey
//= require pagy
$(document).ready(function() {
$('a[disabled=disabled]').click(function(event){
@ -63,4 +64,6 @@ $(document).ready(function() {
$('body').smoothScroll({
delegateSelector: 'a.smoothscroll'
});
window.addEventListener("load", Pagy.init);
});

View file

@ -50,7 +50,7 @@ module Admin
:include_venue, :include_registrations,
:include_tickets, :include_lodgings,
:include_sponsors, :include_social_media,
:include_booths)
:include_booths, :include_happening_now)
end
end
end

View file

@ -3,6 +3,7 @@
class ApplicationController < ActionController::Base
before_action :set_paper_trail_whodunnit
include ApplicationHelper
include Pagy::Backend
add_flash_types :error
protect_from_forgery with: :exception, prepend: true
before_action :store_location

View file

@ -1,6 +1,10 @@
# frozen_string_literal: true
EVENTS_PER_PAGE = 3
class ConferencesController < ApplicationController
include ConferenceHelper
protect_from_forgery with: :null_session
before_action :respond_to_options
load_and_authorize_resource find_by: :short_title, except: :show
@ -56,6 +60,13 @@ class ConferencesController < ApplicationController
if splashpage.include_booths
@booths = @conference.confirmed_booths.order('title')
end
if splashpage.include_happening_now
events_schedules_list = get_happening_now_events_schedules(@conference)
@events_schedules_limit = EVENTS_PER_PAGE
@events_schedules_length = events_schedules_list.length
@pagy, @events_schedules = pagy_array(events_schedules_list, items: @events_schedules_limit, link_extra: 'data-remote="true"')
@happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json)
end
end
if splashpage.include_registrations || splashpage.include_tickets
@tickets = @conference.tickets.visible.order('price_cents')

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class SchedulesController < ApplicationController
include ConferenceHelper
load_and_authorize_resource
before_action :respond_to_options
load_resource :conference, find_by: :short_title
@ -67,15 +69,12 @@ class SchedulesController < ApplicationController
end
def happening_now
@events_schedules = @program.selected_event_schedules(
includes: [:room, { event: %i[track event_type speakers submitter] }]
).select(&:happening_now?)
@events_schedules = [] unless @events_schedules
@events_schedules = get_happening_now_events_schedules(@conference)
@current_time = Time.now.in_time_zone(@conference.timezone)
respond_to do |format|
format.html
format.json { render json: @events_schedules.as_json(root: false, include: :event) }
format.json { render json: @events_schedules.to_json(root: false, include: :event) }
end
end

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
module ApplicationHelper
include Pagy::Frontend
# Returns a string build from the start and end date of the given conference.
#
# If the conference is only one day long

View file

@ -77,4 +77,12 @@ module ConferenceHelper
end
calendar
end
def get_happening_now_events_schedules(conference)
events_schedules = conference.program.selected_event_schedules(
includes: [:room, { event: %i[track event_type speakers submitter] }]
).select(&:happening_now?)
events_schedules ||= []
events_schedules
end
end

View file

@ -11,6 +11,7 @@
# banner_photo_updated_at :datetime
# include_booths :boolean
# include_cfp :boolean default(FALSE)
# include_happening_now :boolean
# include_lodgings :boolean
# include_program :boolean
# include_registrations :boolean

View file

@ -25,6 +25,8 @@
= f.input :include_tracks, label: 'Include confirmed tracks', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tracks) }
%li
= f.input :include_booths, label: "Include confirmed #{(t'booth').pluralize}", input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_booths) }
%li
= f.input :include_happening_now, label: 'Include events happening now', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_happening_now) }
%li
= f.input :include_registrations, label: 'Display the registration period', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_registrations) }

View file

@ -27,6 +27,9 @@
%li
%i{ class: "fa-li #{icon_for_todo @splashpage.include_booths?}" }
Include confirmed #{(t'booth').pluralize}
%li
%i{ class: "fa-li #{icon_for_todo @splashpage.include_happening_now?}" }
Include events happening now
%li
%i{ class: "fa-li #{icon_for_todo @splashpage.include_registrations?}" }
Display the registration period

View file

@ -0,0 +1,32 @@
= content_for :happening_now do
#happening-now
= render 'happening_now', conference: conference,
events_schedules: events_schedules, pagy: pagy,
events_schedules_length: events_schedules_length,
events_schedules_limit: events_schedules_limit
= content_for :about do
#about
.row
%h2.text-left{ style: 'margin-bottom:30px' } About the Conference
= markdown(conference.description, false)
%section#about-and-happening-now
.container
.row
-# happening now events are displayed second in md or lg view
- if conference.splashpage.include_happening_now && conference.splashpage.include_program
- if conference.description.present?
.col-md-6.col-md-push-6.col-lg-4.col-lg-push-8
= yield :happening_now
- else
.col-md-12
= yield :happening_now
- if conference.description.present?
- if conference.splashpage.include_happening_now && conference.splashpage.include_program
.col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4
= yield :about
- else
.col-md-12
= yield :about
.trapezoid

View file

@ -0,0 +1,12 @@
- if conference.splashpage.include_program && conference.splashpage.include_happening_now
- if events_schedules.any?
.row
%h2.text-center{ style: 'margin-bottom:30px' } Happening Now
- events_schedules.each do |event_schedule|
= render 'schedules/event', conference: conference, event_schedule: event_schedule, event: event_schedule.event, is_brief: true
- if events_schedules_length > events_schedules_limit
.container{ style: 'width:100%; text-align:center' }
!= pagy_bootstrap_nav_js(pagy)
- else
.row
%h3.text-center There are no events happening now.

View file

@ -26,11 +26,3 @@
- if venue.country != 'US'
&bull;
= venue.country_name
- unless conference.description.blank?
%section#about
.container
.row
.col-md-8.col-md-offset-2
= markdown(conference.description, escape_html=false)
.trapezoid

View file

@ -41,9 +41,16 @@
- if @conference.code_of_conduct.present?
= render 'code_of_conduct', organization: @conference.organization
-# header/description
-# header
= render 'header', conference: @conference, venue: @conference.venue
-# description / happening now
- if @conference.splashpage.include_happening_now? || @conference.description.present?
= render 'about_and_happening_now', conference: @conference,
events_schedules: @events_schedules, pagy: @pagy,
events_schedules_length: @events_schedules_length,
events_schedules_limit: @events_schedules_limit
-# calls for content, or program
- if @conference.splashpage.include_cfp
= render 'call_for_content', conference: @conference,

View file

@ -0,0 +1,5 @@
$('#happening-now').html("<%= j(render 'happening_now', conference: @conference,
events_schedules: @events_schedules, pagy: @pagy,
events_schedules_length: @events_schedules_length,
events_schedules_limit: @events_schedules_limit)%>");
Pagy.init(document.getElementById('happening-now'));

View file

@ -2,8 +2,9 @@
- header_color = event.event_type&.color || '#f5f5f5'
.trapezoid{ style: 'color: white; top: 12px; z-index: 100;' }
.panel-heading{ style: "background-color: #{header_color}; color: #{ contrast_color(header_color) }; border-radius: 4px" }
- event.speakers_ordered.each do |speaker|
= image_tag speaker.profile_picture, class: 'img-circle pull-right', alt: speaker.name, style: 'padding: 2px;'
- if !defined?(is_brief) || is_brief == false
- event.speakers_ordered.each do |speaker|
= image_tag speaker.profile_picture, class: 'img-circle pull-right', alt: speaker.name, style: 'padding: 2px;'
%p
= canceled_replacement_event_label(event, event_schedule)
@ -14,7 +15,8 @@
%br
%small{ style: "color: #{contrast_color(header_color)}" }
= event.subtitle
.trapezoid{ style: "color: #{header_color}; top: 12px;" }
.trapezoid{ style: "color: #{header_color}; border-top-color: #{header_color}; top: 12px;" }
.panel-body
%h4
@ -26,20 +28,21 @@
= markdown(truncate(event.abstract, length: 400))
-# TODO: More informative text or aria-label.
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400
- if event_schedule.present?
= inyourtz(event_schedule.start_time) do
- if !defined?(is_brief) || is_brief == false
- if event_schedule.present?
= inyourtz(event_schedule.start_time) do
%span.track
%span.fa.fa-clock-o
%span.label{ style: 'background-color: grey' }
= event_schedule.start_time.strftime('%l:%M %P')
\-
= event_schedule.end_time.strftime('%l:%M %P')
%span.track
%span.fa.fa-clock-o
%span.fa.fa-map-marker
%span.label{ style: 'background-color: grey' }
= event_schedule.start_time.strftime('%l:%M %P')
\-
= event_schedule.end_time.strftime('%l:%M %P')
%span.track
%span.fa.fa-map-marker
%span.label{ style: 'background-color: grey' }
= event_schedule.room.name
- if event.track
%span.track
%span.fa.fa-road
%span.label{ style: "background-color: #{event.track.color}; color: #{ contrast_color(event.track.color) }" }
= event.track.name
= event_schedule.room.name
- if event.track
%span.track
%span.fa.fa-road
%span.label{ style: "background-color: #{event.track.color}; color: #{ contrast_color(event.track.color) }" }
= event.track.name