Merge branch 'master' into 176895077-Google-Calendar-Link-Should-Be-Visible-only-with-registration
This commit is contained in:
commit
42882d852b
11 changed files with 166 additions and 35 deletions
|
|
@ -147,16 +147,4 @@ class ConferencesController < ApplicationController
|
||||||
def current_user_has_unpaid_tickets?
|
def current_user_has_unpaid_tickets?
|
||||||
current_user && current_user_tickets.unpaid.any?
|
current_user && current_user_tickets.unpaid.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_happening_now
|
|
||||||
events_schedules_list = get_happening_now_events_schedules(@conference)
|
|
||||||
@is_happening_next = false
|
|
||||||
if events_schedules_list.empty?
|
|
||||||
events_schedules_list = get_happening_next_events_schedules(@conference)
|
|
||||||
@is_happening_next = true
|
|
||||||
end
|
|
||||||
@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"')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
EVENTS_PER_PAGE = Rails.configuration.conference[:events_per_page]
|
||||||
|
|
||||||
class ProposalsController < ApplicationController
|
class ProposalsController < ApplicationController
|
||||||
|
include ConferenceHelper
|
||||||
before_action :authenticate_user!, except: [:show, :new, :create]
|
before_action :authenticate_user!, except: [:show, :new, :create]
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
load_resource :program, through: :conference, singleton: true
|
load_resource :program, through: :conference, singleton: true
|
||||||
|
|
@ -19,6 +22,7 @@ class ProposalsController < ApplicationController
|
||||||
@event_schedule = @event.event_schedules.find_by(schedule_id: @program.selected_schedule_id)
|
@event_schedule = @event.event_schedules.find_by(schedule_id: @program.selected_schedule_id)
|
||||||
@speakers_ordered = @event.speakers_ordered
|
@speakers_ordered = @event.speakers_ordered
|
||||||
@surveys_after_event = @event.surveys.after_event.select(&:active?)
|
@surveys_after_event = @event.surveys.after_event.select(&:active?)
|
||||||
|
load_happening_now
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,18 @@ module ConferenceHelper
|
||||||
events_schedules
|
events_schedules
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_happening_now
|
||||||
|
events_schedules_list = get_happening_now_events_schedules(@conference)
|
||||||
|
@is_happening_next = false
|
||||||
|
if events_schedules_list.empty?
|
||||||
|
events_schedules_list = get_happening_next_events_schedules(@conference)
|
||||||
|
@is_happening_next = true
|
||||||
|
end
|
||||||
|
@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"')
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def filter_events_schedules(conference, filter)
|
def filter_events_schedules(conference, filter)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
%h1 Session Materials
|
%h1 #{@conference.title} Materials
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
Conference materials will be displayed on the events in the
|
Conference materials will be displayed on the events in the
|
||||||
= link_to 'schedule,', conference_schedule_path(@conference.short_title)
|
= link_to 'schedule,', conference_schedule_path(@conference.short_title)
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
-# happening now events are displayed second in md or lg view
|
-# happening now events are displayed second in md or lg view
|
||||||
- if conference.splashpage.include_happening_now && conference.splashpage.include_program
|
- if conference.splashpage.include_happening_now? && conference.splashpage.include_program?
|
||||||
- if conference.description.present?
|
- if conference.description.present?
|
||||||
.col-md-6.col-md-push-6.col-lg-4.col-lg-push-8
|
.col-md-6.col-md-push-6.col-lg-4.col-lg-push-8{ style: 'margin-top: 60px' }
|
||||||
= yield :happening_now
|
= yield :happening_now
|
||||||
- else
|
- else
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
- if conference.splashpage.include_program && conference.splashpage.include_happening_now
|
- if events_schedules.present? && events_schedules.any?
|
||||||
- if events_schedules.any?
|
|
||||||
.row
|
.row
|
||||||
%h2.text-center{ style: 'margin-bottom:30px' }
|
%h3.text-left{ style: 'margin-bottom:30px; padding-left:20px' }
|
||||||
- if is_happening_next
|
- if is_happening_next
|
||||||
Happening Next
|
Events Happening Next
|
||||||
- else
|
- else
|
||||||
Happening Now
|
Events Happening Now
|
||||||
- events_schedules.each do |event_schedule|
|
- events_schedules.each do |event_schedule|
|
||||||
= render 'schedules/event', conference: conference, event_schedule: event_schedule, event: event_schedule.event, is_brief: true
|
= render 'schedules/event', conference: conference, event_schedule: event_schedule, event: event_schedule.event, is_brief: true
|
||||||
- if events_schedules_length > events_schedules_limit
|
- if events_schedules_length > events_schedules_limit
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
$('#happening-now').html("<%= j(render 'happening_now', conference: @conference,
|
$('#happening-now').html("<%= j(render 'happening_now', conference: @conference,
|
||||||
events_schedules: @events_schedules, pagy: @pagy,
|
events_schedules: @events_schedules, pagy: @pagy,
|
||||||
events_schedules_length: @events_schedules_length,
|
events_schedules_length: @events_schedules_length,
|
||||||
events_schedules_limit: @events_schedules_limit)%>");
|
events_schedules_limit: @events_schedules_limit,
|
||||||
|
is_happening_next: @is_happening_next) %>");
|
||||||
Pagy.init(document.getElementById('happening-now'));
|
Pagy.init(document.getElementById('happening-now'));
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
- @event.volunteers.each do |volunteer|
|
- @event.volunteers.each do |volunteer|
|
||||||
= render 'volunteer_info', speaker: volunteer, show_bio: false
|
= render 'volunteer_info', speaker: volunteer, show_bio: false
|
||||||
|
|
||||||
.col-md-9
|
.col-md-6
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.lead
|
.lead
|
||||||
|
|
@ -139,3 +139,11 @@
|
||||||
- if @surveys_after_event.any? && @event.ended?
|
- if @surveys_after_event.any? && @event.ended?
|
||||||
.page-header
|
.page-header
|
||||||
= render partial: 'surveys/list', locals: { surveys: @surveys_after_event, conference: @conference }
|
= render partial: 'surveys/list', locals: { surveys: @surveys_after_event, conference: @conference }
|
||||||
|
.col-md-3
|
||||||
|
#happening-now
|
||||||
|
= render 'conferences/happening_now', conference: @conference,
|
||||||
|
events_schedules: @events_schedules, pagy: @pagy,
|
||||||
|
events_schedules_length: @events_schedules_length,
|
||||||
|
events_schedules_limit: @events_schedules_limit,
|
||||||
|
is_happening_next: @is_happening_next
|
||||||
|
|
||||||
|
|
|
||||||
6
app/views/proposals/show.js.erb
Normal file
6
app/views/proposals/show.js.erb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
$('#happening-now').html("<%= j(render 'conferences/happening_now', conference: @conference,
|
||||||
|
events_schedules: @events_schedules, pagy: @pagy,
|
||||||
|
events_schedules_length: @events_schedules_length,
|
||||||
|
events_schedules_limit: @events_schedules_limit,
|
||||||
|
is_happening_next: @is_happening_next) %>");
|
||||||
|
Pagy.init(document.getElementById('happening-now'));
|
||||||
|
|
@ -10,11 +10,18 @@ feature Commercial do
|
||||||
let!(:participant) { create(:user) }
|
let!(:participant) { create(:user) }
|
||||||
|
|
||||||
context 'in admin area' do
|
context 'in admin area' do
|
||||||
scenario 'adds, updates, deletes of a conference', feature: true, js: true do
|
|
||||||
|
before do
|
||||||
sign_in organizer
|
sign_in organizer
|
||||||
|
|
||||||
visit admin_conference_commercials_path(conference.short_title)
|
visit admin_conference_commercials_path(conference.short_title)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'contains the conference name in the title', feature: true, js: true do
|
||||||
|
header = conference.title + ' Materials'
|
||||||
|
expect(page).to have_content(header)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'adds, updates, deletes of a conference', feature: true, js: true do
|
||||||
# Create valid commercial
|
# Create valid commercial
|
||||||
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
|
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
|
||||||
click_button 'Save Materials'
|
click_button 'Save Materials'
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ feature Event do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context 'as a user, looking at a conference with scheduled events' do
|
context 'as a user, looking at a conference with scheduled events' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@user = create(:user)
|
@user = create(:user)
|
||||||
|
|
@ -234,4 +235,109 @@ feature Event do
|
||||||
expect(page).not_to have_content('Add to Google Calendar (beta)')
|
expect(page).not_to have_content('Add to Google Calendar (beta)')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'happening now or next section', feature: true, js: true do
|
||||||
|
let!(:conference1) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) }
|
||||||
|
let!(:program) { conference1.program }
|
||||||
|
let!(:selected_schedule) { create(:schedule, program: program) }
|
||||||
|
let!(:splashpage) { create(:full_splashpage, conference: conference1, public: true) }
|
||||||
|
|
||||||
|
let!(:scheduled_event1) do
|
||||||
|
program.update_attributes!(selected_schedule: selected_schedule)
|
||||||
|
create(:event, program: program, state: 'confirmed')
|
||||||
|
end
|
||||||
|
let!(:scheduled_event2) do
|
||||||
|
program.update_attributes!(selected_schedule: selected_schedule)
|
||||||
|
create(:event, program: program, state: 'confirmed')
|
||||||
|
end
|
||||||
|
let!(:scheduled_event3) do
|
||||||
|
program.update_attributes!(selected_schedule: selected_schedule)
|
||||||
|
create(:event, program: program, state: 'confirmed')
|
||||||
|
end
|
||||||
|
let!(:scheduled_event4) do
|
||||||
|
program.update_attributes!(selected_schedule: selected_schedule)
|
||||||
|
create(:event, program: program, state: 'confirmed')
|
||||||
|
end
|
||||||
|
let!(:current_time) { Time.now.in_time_zone(conference1.timezone) }
|
||||||
|
|
||||||
|
let!(:events_list) { [scheduled_event1, scheduled_event2, scheduled_event3, scheduled_event4] }
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
sign_in participant
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'No events happening now or next' do
|
||||||
|
events_list.each do |event|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).to have_content('There are no events scheduled yet.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'shows all events happening next if nothing is happening now' do
|
||||||
|
event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
|
||||||
|
events_list.each do |event|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).to have_content(event_schedule1.event.title)
|
||||||
|
expect(happening_now).to have_content(event_schedule2.event.title)
|
||||||
|
expect(happening_now).not_to have_content(scheduled_event3.title)
|
||||||
|
expect(happening_now).not_to have_content(scheduled_event4.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'only shows all events happening now if something is happening now and next' do
|
||||||
|
event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
events_list.each do |event|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).not_to have_content(event_schedule1.event.title)
|
||||||
|
expect(happening_now).not_to have_content(event_schedule2.event.title)
|
||||||
|
expect(happening_now).to have_content(event_schedule3.event.title)
|
||||||
|
expect(happening_now).not_to have_content(scheduled_event4.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'only shows events happening at the earliest time, not at a later time in the future' do
|
||||||
|
event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (current_time + 2.hours).strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
events_list.each do |event|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).to have_content(event_schedule1.event.title)
|
||||||
|
expect(happening_now).to have_content(event_schedule2.event.title)
|
||||||
|
expect(happening_now).not_to have_content(event_schedule3.event.title)
|
||||||
|
expect(happening_now).not_to have_content(scheduled_event4.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'only shows 3 events happening now because of pagination' do
|
||||||
|
event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
event_schedule4 = create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S'))
|
||||||
|
|
||||||
|
events_list.each do |event|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).to have_content(event_schedule1.event.title)
|
||||||
|
expect(happening_now).to have_content(event_schedule2.event.title)
|
||||||
|
expect(happening_now).to have_content(event_schedule3.event.title)
|
||||||
|
|
||||||
|
visit conference_program_proposal_path(conference1.short_title, event.id, page: 2)
|
||||||
|
happening_now = page.find('#happening-now')
|
||||||
|
expect(happening_now).not_to have_content(event_schedule3.event.title)
|
||||||
|
expect(happening_now).not_to have_content(event_schedule1.event.title)
|
||||||
|
expect(happening_now).not_to have_content(event_schedule2.event.title)
|
||||||
|
|
||||||
|
expect(happening_now).to have_content(event_schedule4.event.title)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue