From 4aab0539b5eb94013fba7de8b0ac96befb579713 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 1 Apr 2021 13:08:09 +0800 Subject: [PATCH 01/26] [feat] Add include_happening_now field to splashpages table --- app/models/splashpage.rb | 1 + ...0210401050437_add_include_happening_now_to_splashpages.rb | 5 +++++ db/schema.rb | 3 ++- spec/factories/splashpages.rb | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20210401050437_add_include_happening_now_to_splashpages.rb diff --git a/app/models/splashpage.rb b/app/models/splashpage.rb index cf4576db..f9a6cbc2 100644 --- a/app/models/splashpage.rb +++ b/app/models/splashpage.rb @@ -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 diff --git a/db/migrate/20210401050437_add_include_happening_now_to_splashpages.rb b/db/migrate/20210401050437_add_include_happening_now_to_splashpages.rb new file mode 100644 index 00000000..50d2354b --- /dev/null +++ b/db/migrate/20210401050437_add_include_happening_now_to_splashpages.rb @@ -0,0 +1,5 @@ +class AddIncludeHappeningNowToSplashpages < ActiveRecord::Migration[5.2] + def change + add_column :splashpages, :include_happening_now, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 633160d4..5a6741e0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_03_06_185903) do +ActiveRecord::Schema.define(version: 2021_04_01_050437) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -442,6 +442,7 @@ ActiveRecord::Schema.define(version: 2021_03_06_185903) do t.boolean "include_cfp", default: false t.boolean "include_booths" t.boolean "shuffle_highlights", default: false, null: false + t.boolean "include_happening_now" end create_table "sponsors", force: :cascade do |t| diff --git a/spec/factories/splashpages.rb b/spec/factories/splashpages.rb index aa093f75..340155c6 100644 --- a/spec/factories/splashpages.rb +++ b/spec/factories/splashpages.rb @@ -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 From 65119149eae5d0643e36f3b33fa13cc8c27d2046 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 1 Apr 2021 13:14:31 +0800 Subject: [PATCH 02/26] [feat]Add include_happening_now checkbox to the admin splashpage --- app/controllers/admin/splashpages_controller.rb | 2 +- app/views/admin/splashpages/_form.html.haml | 3 +++ app/views/admin/splashpages/show.html.haml | 3 +++ spec/factories/splashpages.rb | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/splashpages_controller.rb b/app/controllers/admin/splashpages_controller.rb index fd432cde..fc7e3299 100644 --- a/app/controllers/admin/splashpages_controller.rb +++ b/app/controllers/admin/splashpages_controller.rb @@ -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 diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index 3db1e9ea..bf689200 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -44,6 +44,9 @@ %li = f.input :include_social_media, label: 'Display social media links', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_social_media) } + %li + = f.input :include_happening_now, label: 'Display events happening now', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_happening_now) } + = f.inputs name: 'Access' do %ul.fa-ul %li diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index a9046fdc..14c64e82 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -45,6 +45,9 @@ %li %i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" } Display social media links + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_happening_now?}" } + Display events happening now %li - if @conference.splashpage && @conference.splashpage.public %i{ class: "fa-li #{icon_for_todo @splashpage.public?}" } diff --git a/spec/factories/splashpages.rb b/spec/factories/splashpages.rb index 340155c6..ffc38dfa 100644 --- a/spec/factories/splashpages.rb +++ b/spec/factories/splashpages.rb @@ -45,6 +45,7 @@ FactoryBot.define do include_sponsors { true } include_lodgings { true } include_cfp { true } + include_happening_now { true } end end end From 093241fd0a044db715c130447d3670e17732b9eb Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 1 Apr 2021 13:30:44 +0800 Subject: [PATCH 03/26] [temp] Add happening_now placeholder in splashpage --- app/views/conferences/show.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index c34aa3c1..0cb00f30 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -44,6 +44,10 @@ -# header/description = render 'header', conference: @conference, venue: @conference.venue + -# happening now events + - if @conference.splashpage.include_happening_now + = 'Hello Word' + -# calls for content, or program - if @conference.splashpage.include_cfp = render 'call_for_content', conference: @conference, From 9bfe64c28fc58f452942fcde32e3426547d52964 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 5 Apr 2021 15:07:18 +0800 Subject: [PATCH 04/26] [temp]Ajax request of happening now JSON in progress --- app/controllers/conferences_controller.rb | 3 +++ app/views/conferences/show.html.haml | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 02d869f4..cf5fd04a 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -69,6 +69,9 @@ class ConferencesController < ApplicationController ).order('sponsorship_levels.position ASC', 'sponsors.name') @sponsors = @conference.sponsors end + if splashpage.include_happening_now + @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) + end end def calendar diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 0cb00f30..8d24a439 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -46,8 +46,7 @@ -# happening now events - if @conference.splashpage.include_happening_now - = 'Hello Word' - + = 'test' -# calls for content, or program - if @conference.splashpage.include_cfp = render 'call_for_content', conference: @conference, @@ -86,3 +85,22 @@ - if @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact = render 'footer' + +:javascript + var loadData = function() { + $.ajax({ + type: 'GET', + contentType: 'application/json; charset=utf-8', + url: '#{@happening_now_url}', + dataType: 'json', + success: renderTemplate, + failure: function(){ + console.log('error'); + } + }); + }; + + var renderTemplate = function(data) { + console.log(data); + console.log("template rendered"); + } \ No newline at end of file From e2d775e398506d506f980c26a7a977edca09fabb Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 5 Apr 2021 20:45:40 +0800 Subject: [PATCH 05/26] [temp] Add no events happening now in splashpage --- app/controllers/schedules_controller.rb | 2 +- app/views/conferences/show.html.haml | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index 450dcf32..c037e3ab 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -75,7 +75,7 @@ class SchedulesController < ApplicationController 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 diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 8d24a439..c5529cf0 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -46,7 +46,11 @@ -# happening now events - if @conference.splashpage.include_happening_now - = 'test' + .row + .col-md-12 + #happening_now_panel + %h3.text-center There are no events happening now. + -# calls for content, or program - if @conference.splashpage.include_cfp = render 'call_for_content', conference: @conference, @@ -103,4 +107,9 @@ var renderTemplate = function(data) { console.log(data); console.log("template rendered"); + + for (key in data) { + event_schedule = data[key]; + console.log(event_schedule['event']); + } } \ No newline at end of file From d6cfecc960a0bdcca551827213bc10f5d14e6896 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 6 Apr 2021 13:16:59 +0800 Subject: [PATCH 06/26] [feat]Move happening_now to ConferenceHelper --- app/controllers/schedules_controller.rb | 7 +++---- app/helpers/conference_helper.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index c037e3ab..27e1754f 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -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,10 +69,7 @@ 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_schedules(@conference) @current_time = Time.now.in_time_zone(@conference.timezone) respond_to do |format| diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 417a8d55..fa5e66c3 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -77,4 +77,12 @@ module ConferenceHelper end calendar end + + def get_happening_now_events_schedules_schedules(conference) + events_schedules = conference.program.selected_event_schedules( + includes: [:room, { event: %i[track event_type speakers submitter] }] + ).select(&:happening_now?) + events_schedules = [] unless events_schedules + events_schedules + end end From 85cfb0cbefe174355f5160088a506ddf769999a6 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 6 Apr 2021 13:27:05 +0800 Subject: [PATCH 07/26] [style] Fix name of method --- app/controllers/schedules_controller.rb | 2 +- app/helpers/conference_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index 27e1754f..bdefb939 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -69,7 +69,7 @@ class SchedulesController < ApplicationController end def happening_now - @events_schedules = get_happening_now_events_schedules_schedules(@conference) + @events_schedules = get_happening_now_events_schedules(@conference) @current_time = Time.now.in_time_zone(@conference.timezone) respond_to do |format| diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index fa5e66c3..2ded3789 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -78,7 +78,7 @@ module ConferenceHelper calendar end - def get_happening_now_events_schedules_schedules(conference) + 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?) From eda0c1a175d38ed1a70103c06539c5362d01ab22 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 10:34:49 +0800 Subject: [PATCH 08/26] [feat] Display happening now events in splashpage --- app/controllers/conferences_controller.rb | 3 +++ app/views/conferences/show.html.haml | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index cf5fd04a..1827ad95 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true 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 @@ -70,6 +72,7 @@ class ConferencesController < ApplicationController @sponsors = @conference.sponsors end if splashpage.include_happening_now + @events_schedules = get_happening_now_events_schedules(@conference) @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index c5529cf0..96d10838 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -46,10 +46,15 @@ -# happening now events - if @conference.splashpage.include_happening_now - .row - .col-md-12 - #happening_now_panel - %h3.text-center There are no events happening now. + - if @events_schedules.any? + - for event_schedule in @events_schedules + .container + = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event + - else + .row + .col-md-12 + #happening_now_panel + %h3.text-center There are no events happening now. -# calls for content, or program - if @conference.splashpage.include_cfp From 8d71fa85cde3c402d171547f5a4453366008b060 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 11:00:03 +0800 Subject: [PATCH 09/26] [feat]Center happening now events on the splashpage --- app/helpers/conference_helper.rb | 2 +- app/views/conferences/show.html.haml | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 2ded3789..c392a814 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -82,7 +82,7 @@ module ConferenceHelper events_schedules = conference.program.selected_event_schedules( includes: [:room, { event: %i[track event_type speakers submitter] }] ).select(&:happening_now?) - events_schedules = [] unless events_schedules + events_schedules ||= [] events_schedules end end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 96d10838..53f61abd 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -47,14 +47,13 @@ -# happening now events - if @conference.splashpage.include_happening_now - if @events_schedules.any? - - for event_schedule in @events_schedules - .container + .container{style: "padding: 20;"} + - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - else .row .col-md-12 - #happening_now_panel - %h3.text-center There are no events happening now. + %h3.text-center There are no events happening now. -# calls for content, or program - if @conference.splashpage.include_cfp From 4abcc57d7b737de170b003d4f621c6632efddd66 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 11:06:48 +0800 Subject: [PATCH 10/26] [feat]Add a title for happening now section in splashpage --- app/views/conferences/show.html.haml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 53f61abd..dece40ad 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -45,15 +45,19 @@ = render 'header', conference: @conference, venue: @conference.venue -# happening now events - - if @conference.splashpage.include_happening_now - - if @events_schedules.any? - .container{style: "padding: 20;"} - - for event_schedule in @events_schedules - = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - - else - .row - .col-md-12 - %h3.text-center There are no events happening now. + %section#happening_now + - if @conference.splashpage.include_happening_now + - if @events_schedules.any? + .row + .col-md-12 + %h2.text-center Happening Now + .container{style: "padding: 20;"} + - for event_schedule in @events_schedules + = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event + - else + .row + .col-md-12 + %h3.text-center There are no events happening now. -# calls for content, or program - if @conference.splashpage.include_cfp From 9e2c78e2362b91cbb49742be3a8ac57c12edc827 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 11:13:41 +0800 Subject: [PATCH 11/26] [style]Fix style --- app/views/conferences/show.html.haml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index dece40ad..52e8bc12 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -45,13 +45,13 @@ = render 'header', conference: @conference, venue: @conference.venue -# happening now events - %section#happening_now + %section#happening-now - if @conference.splashpage.include_happening_now - if @events_schedules.any? .row .col-md-12 %h2.text-center Happening Now - .container{style: "padding: 20;"} + .container{ style: "padding: 20;" } - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - else @@ -111,7 +111,7 @@ } }); }; - + var renderTemplate = function(data) { console.log(data); console.log("template rendered"); @@ -120,4 +120,4 @@ event_schedule = data[key]; console.log(event_schedule['event']); } - } \ No newline at end of file + } From 7d51ff9eb4e383af64a9379e2e6829ee7f5d68c7 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 17:55:20 +0800 Subject: [PATCH 12/26] [feat]Display description and happening now in two columns; display happening now first in sm view --- app/views/conferences/_header.haml | 8 ------ app/views/conferences/show.html.haml | 38 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index f40fe600..9a1316f6 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -26,11 +26,3 @@ - if venue.country != 'US' • = 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 diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 52e8bc12..0ecad083 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -41,23 +41,31 @@ - if @conference.code_of_conduct.present? = render 'code_of_conduct', organization: @conference.organization - -# header/description + -# header = render 'header', conference: @conference, venue: @conference.venue - -# happening now events - %section#happening-now - - if @conference.splashpage.include_happening_now - - if @events_schedules.any? - .row - .col-md-12 - %h2.text-center Happening Now - .container{ style: "padding: 20;" } - - for event_schedule in @events_schedules - = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - - else - .row - .col-md-12 - %h3.text-center There are no events happening now. + -# description / happening now + %section#about-and-happening-now + .container + .row + -# happening now events are displayed second in md or lg view + .col-md-4.col-md-push-8 + #happening-now + - if @conference.splashpage.include_happening_now + - if @events_schedules.any? + .row + %h2.text-center Happening Now + - for event_schedule in @events_schedules + = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event + - else + .row + %h3.text-center There are no events happening now. + - if @conference.description.present? + .col-md-8.col-md-pull-4 + #about + .row + = markdown(@conference.description, escape_html=false) + .trapezoid -# calls for content, or program - if @conference.splashpage.include_cfp From 04455bbbdfe94a2674f6281b1a2c05d1bb9824cc Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 18:55:34 +0800 Subject: [PATCH 13/26] [feat]Add md lg view for happening_now column --- app/views/conferences/show.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 0ecad083..140a4e57 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -49,7 +49,7 @@ .container .row -# happening now events are displayed second in md or lg view - .col-md-4.col-md-push-8 + .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 #happening-now - if @conference.splashpage.include_happening_now - if @events_schedules.any? @@ -61,7 +61,7 @@ .row %h3.text-center There are no events happening now. - if @conference.description.present? - .col-md-8.col-md-pull-4 + .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 #about .row = markdown(@conference.description, escape_html=false) From 8b6d70b73cb127294f2634ca86d3fdb45dbdec5a Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 7 Apr 2021 22:50:27 +0800 Subject: [PATCH 14/26] [fix]Fix trapezoid on splashpage --- app/views/schedules/_event.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/schedules/_event.html.haml b/app/views/schedules/_event.html.haml index dbd16b10..9373d0c3 100644 --- a/app/views/schedules/_event.html.haml +++ b/app/views/schedules/_event.html.haml @@ -14,7 +14,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 From 77b6dac6a2d3edbc0e89fbc5427a97c927600f2a Mon Sep 17 00:00:00 2001 From: madhekare Date: Wed, 7 Apr 2021 20:56:03 -0700 Subject: [PATCH 15/26] pagination happening now --- Gemfile | 3 + Gemfile.lock | 2 + app/controllers/application_controller.rb | 1 + app/controllers/conferences_controller.rb | 3 +- app/helpers/application_helper.rb | 1 + app/helpers/conference_helper.rb | 1 + app/views/conferences/show.html.haml | 3 + config/initializers/pagy.rb | 175 ++++++++++++++++++++++ 8 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 config/initializers/pagy.rb diff --git a/Gemfile b/Gemfile index 05c7a4bd..ad32662d 100644 --- a/Gemfile +++ b/Gemfile @@ -221,6 +221,9 @@ gem 'dalli' gem 'icalendar' +#pagination +gem 'pagy', '<4.0' + # Use guard and spring for testing in development group :development do # to launch specs when files are modified diff --git a/Gemfile.lock b/Gemfile.lock index 5b7365da..9515baf8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -364,6 +364,7 @@ GEM rack-openid (~> 1.3.1) open4 (1.3.4) orm_adapter (0.5.0) + pagy (3.12.0) paper_trail (10.3.1) activerecord (>= 4.2) request_store (~> 1.1) @@ -734,6 +735,7 @@ DEPENDENCIES omniauth-github omniauth-google-oauth2 omniauth-openid + pagy (< 4.0) paper_trail pdf-inspector pg diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c9f93a30..b2e925e7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 1827ad95..987d0cab 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -72,7 +72,8 @@ class ConferencesController < ApplicationController @sponsors = @conference.sponsors end if splashpage.include_happening_now - @events_schedules = get_happening_now_events_schedules(@conference) + @event_list = get_happening_now_events_schedules(@conference) + @pagy, @events_schedules = pagy_array(@event_list, items: 2) @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1c7f5da6..7578e99c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index c392a814..ad9971a3 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -3,6 +3,7 @@ DEFAULT_LOGO = 'snapcon_logo.png' DEFAULT_COLOR = '#0B3559' + module ConferenceHelper # Return true if only call_for_papers or call_for_tracks or call_for_booths is open def one_call_open(*calls) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 140a4e57..0112f121 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -57,6 +57,8 @@ %h2.text-center Happening Now - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event + .container{:style => "margin:auto; width:50%"} + != pagy_nav(@pagy) - else .row %h3.text-center There are no events happening now. @@ -67,6 +69,7 @@ = markdown(@conference.description, escape_html=false) .trapezoid + -# calls for content, or program - if @conference.splashpage.include_cfp = render 'call_for_content', conference: @conference, diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb new file mode 100644 index 00000000..6f5e8550 --- /dev/null +++ b/config/initializers/pagy.rb @@ -0,0 +1,175 @@ +# encoding: utf-8 +# frozen_string_literal: true + +# Pagy initializer file (4.1.0) +# Customize only what you really need and notice that Pagy works also without any of the following lines. +# Should you just cherry pick part of this file, please maintain the require-order of the extras + + +# Extras +# See https://ddnexus.github.io/pagy/extras + + +# Backend Extras + +# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding +# See https://ddnexus.github.io/pagy/extras/array +require 'pagy/extras/array' + +# Countless extra: Paginate without any count, saving one query per rendering +# See https://ddnexus.github.io/pagy/extras/countless +# require 'pagy/extras/countless' +# Pagy::VARS[:cycle] = false # default + +# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects +# See https://ddnexus.github.io/pagy/extras/elasticsearch_rails +# default :pagy_search method: change only if you use +# also the searchkick extra that defines the same +# VARS[:elasticsearch_rails_search_method] = :pagy_search +# require 'pagy/extras/elasticsearch_rails' + +# Searchkick extra: Paginate `Searchkick::Results` objects +# See https://ddnexus.github.io/pagy/extras/searchkick +# default :pagy_search method: change only if you use +# also the elasticsearch_rails extra that defines the same +# VARS[:searchkick_search_method] = :pagy_search +# require 'pagy/extras/searchkick' + +# Frontend Extras + +# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination +# See https://ddnexus.github.io/pagy/extras/bootstrap +# require 'pagy/extras/bootstrap' + +# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination +# See https://ddnexus.github.io/pagy/extras/bulma +# require 'pagy/extras/bulma' + +# Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination +# See https://ddnexus.github.io/pagy/extras/foundation +# require 'pagy/extras/foundation' + +# Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination +# See https://ddnexus.github.io/pagy/extras/materialize +# require 'pagy/extras/materialize' + +# Navs extra: Add nav_js and combo_nav_js javascript helpers +# Notice: the other frontend extras add their own framework-styled versions, +# so require this extra only if you need the unstyled version +# See https://ddnexus.github.io/pagy/extras/navs +# require 'pagy/extras/navs' + +# Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination +# See https://ddnexus.github.io/pagy/extras/semantic +# require 'pagy/extras/semantic' + +# UIkit extra: Add nav helper and templates for UIkit pagination +# See https://ddnexus.github.io/pagy/extras/uikit +# require 'pagy/extras/uikit' + +# Multi size var used by the *_nav_js helpers +# See https://ddnexus.github.io/pagy/extras/navs#steps +# Pagy::VARS[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example + + +# Feature Extras + +# Headers extra: http response headers (and other helpers) useful for API pagination +# See http://ddnexus.github.io/pagy/extras/headers +# require 'pagy/extras/headers' +# Pagy::VARS[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default + +# Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination +# See https://ddnexus.github.io/pagy/extras/support +# require 'pagy/extras/support' + +# Items extra: Allow the client to request a custom number of items per page with an optional selector UI +# See https://ddnexus.github.io/pagy/extras/items +# require 'pagy/extras/items' +# Pagy::VARS[:items_param] = :items # default +# Pagy::VARS[:max_items] = 100 # default + +# Overflow extra: Allow for easy handling of overflowing pages +# See https://ddnexus.github.io/pagy/extras/overflow +# require 'pagy/extras/overflow' +# Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception) + +# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc. +# See https://ddnexus.github.io/pagy/extras/metadata +# you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels +# require 'pagy/extras/shared' +# require 'pagy/extras/metadata' +# For performance reason, you should explicitly set ONLY the metadata you use in the frontend +# Pagy::VARS[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example + +# Trim extra: Remove the page=1 param from links +# See https://ddnexus.github.io/pagy/extras/trim +# require 'pagy/extras/trim' + + + +# Pagy Variables +# See https://ddnexus.github.io/pagy/api/pagy#variables +# All the Pagy::VARS are set for all the Pagy instances but can be overridden +# per instance by just passing them to Pagy.new or the #pagy controller method + + +# Instance variables +# See https://ddnexus.github.io/pagy/api/pagy#instance-variables +# Pagy::VARS[:items] = 20 # default + + +# Other Variables +# See https://ddnexus.github.io/pagy/api/pagy#other-variables +# Pagy::VARS[:size] = [1,4,4,1] # default +# Pagy::VARS[:page_param] = :page # default +# Pagy::VARS[:params] = {} # default +# Pagy::VARS[:anchor] = '#anchor' # example +# Pagy::VARS[:link_extra] = 'data-remote="true"' # example + + +# Rails + +# Rails: extras assets path required by the helpers that use javascript +# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js) +# See https://ddnexus.github.io/pagy/extras#javascript +# Rails.application.config.assets.paths << Pagy.root.join('javascripts') + + +# I18n + +# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem +# See https://ddnexus.github.io/pagy/api/frontend#i18n +# Notice: No need to configure anything in this section if your app uses only "en" +# or if you use the i18n extra below +# +# Examples: +# load the "de" built-in locale: +# Pagy::I18n.load(locale: 'de') +# +# load the "de" locale defined in the custom file at :filepath: +# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml') +# +# load the "de", "en" and "es" built-in locales: +# (the first passed :locale will be used also as the default_locale) +# Pagy::I18n.load({locale: 'de'}, +# {locale: 'en'}, +# {locale: 'es'}) +# +# load the "en" built-in locale, a custom "es" locale, +# and a totally custom locale complete with a custom :pluralize proc: +# (the first passed :locale will be used also as the default_locale) +# Pagy::I18n.load({locale: 'en'}, +# {locale: 'es', filepath: 'path/to/pagy-es.yml'}, +# {locale: 'xyz', # not built-in +# filepath: 'path/to/pagy-xyz.yml', +# pluralize: lambda{|count| ... } ) + + +# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory +# than the default pagy internal i18n (see above) +# See https://ddnexus.github.io/pagy/extras/i18n +# require 'pagy/extras/i18n' + +# Default i18n key +# Pagy::VARS[:i18n_key] = 'pagy.item_name' # default \ No newline at end of file From c9c31d6db52cfc52916495e816072b6150b3a8c3 Mon Sep 17 00:00:00 2001 From: madhekare Date: Wed, 7 Apr 2021 21:07:24 -0700 Subject: [PATCH 16/26] pagination --- app/controllers/conferences_controller.rb | 2 +- app/views/conferences/show.html.haml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 987d0cab..123a269b 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -73,7 +73,7 @@ class ConferencesController < ApplicationController end if splashpage.include_happening_now @event_list = get_happening_now_events_schedules(@conference) - @pagy, @events_schedules = pagy_array(@event_list, items: 2) + @pagy, @events_schedules = pagy_array(@event_list, items: 3) @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 0112f121..7c6dbab3 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -54,11 +54,12 @@ - if @conference.splashpage.include_happening_now - if @events_schedules.any? .row - %h2.text-center Happening Now + %h2.text-center{:style => "margin-bottom:30px"} Happening Now - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - .container{:style => "margin:auto; width:50%"} - != pagy_nav(@pagy) + - if @events_schedules.length > 3 + .container{:style => "margin:auto; width:50%"} + != pagy_nav(@pagy) - else .row %h3.text-center There are no events happening now. @@ -66,6 +67,7 @@ .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 #about .row + %h2.text-left{:style => "margin-bottom:30px"} About the Conference = markdown(@conference.description, escape_html=false) .trapezoid From 228ec4a65074b24154ba0dae4e5c799783e31b82 Mon Sep 17 00:00:00 2001 From: madhekare Date: Wed, 7 Apr 2021 21:26:31 -0700 Subject: [PATCH 17/26] items per page --- app/controllers/conferences_controller.rb | 3 ++- app/helpers/conference_helper.rb | 2 +- app/views/conferences/show.html.haml | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 123a269b..f4d08ac6 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -73,7 +73,8 @@ class ConferencesController < ApplicationController end if splashpage.include_happening_now @event_list = get_happening_now_events_schedules(@conference) - @pagy, @events_schedules = pagy_array(@event_list, items: 3) + @event_limit = 3 + @pagy, @events_schedules = pagy_array(@event_list, items: @event_limit) @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index ad9971a3..255cf2fa 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -82,7 +82,7 @@ module ConferenceHelper 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?) + )#.select(&:happening_now?) events_schedules ||= [] events_schedules end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 7c6dbab3..cf4ae80d 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -57,9 +57,8 @@ %h2.text-center{:style => "margin-bottom:30px"} Happening Now - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - - if @events_schedules.length > 3 - .container{:style => "margin:auto; width:50%"} - != pagy_nav(@pagy) + .container{:style => "margin:auto; width:50%"} + != pagy_nav(@pagy) - else .row %h3.text-center There are no events happening now. From bb44f10120c0f62350f3940a77d7cb49b7a1a2e3 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 8 Apr 2021 12:52:13 +0800 Subject: [PATCH 18/26] [fix]Fix style; Re-enable checking happening now --- Gemfile | 2 +- app/helpers/conference_helper.rb | 3 +-- app/views/conferences/show.html.haml | 8 ++++---- config/initializers/pagy.rb | 13 +------------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index ad32662d..6085dc1c 100644 --- a/Gemfile +++ b/Gemfile @@ -221,7 +221,7 @@ gem 'dalli' gem 'icalendar' -#pagination +# pagination gem 'pagy', '<4.0' # Use guard and spring for testing in development diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 255cf2fa..c392a814 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -3,7 +3,6 @@ DEFAULT_LOGO = 'snapcon_logo.png' DEFAULT_COLOR = '#0B3559' - module ConferenceHelper # Return true if only call_for_papers or call_for_tracks or call_for_booths is open def one_call_open(*calls) @@ -82,7 +81,7 @@ module ConferenceHelper 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?) + ).select(&:happening_now?) events_schedules ||= [] events_schedules end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index cf4ae80d..0d7e1d20 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -54,11 +54,11 @@ - if @conference.splashpage.include_happening_now - if @events_schedules.any? .row - %h2.text-center{:style => "margin-bottom:30px"} Happening Now + %h2.text-center{ style: "margin-bottom:30px" } Happening Now - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - .container{:style => "margin:auto; width:50%"} - != pagy_nav(@pagy) + .container{ style: "margin:auto; width:50%" } + != pagy_nav(@pagy) - else .row %h3.text-center There are no events happening now. @@ -66,7 +66,7 @@ .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 #about .row - %h2.text-left{:style => "margin-bottom:30px"} About the Conference + %h2.text-left{ style: "margin-bottom:30px" } About the Conference = markdown(@conference.description, escape_html=false) .trapezoid diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index 6f5e8550..c1dcb0be 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -1,15 +1,12 @@ -# encoding: utf-8 # frozen_string_literal: true # Pagy initializer file (4.1.0) # Customize only what you really need and notice that Pagy works also without any of the following lines. # Should you just cherry pick part of this file, please maintain the require-order of the extras - # Extras # See https://ddnexus.github.io/pagy/extras - # Backend Extras # Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding @@ -71,7 +68,6 @@ require 'pagy/extras/array' # See https://ddnexus.github.io/pagy/extras/navs#steps # Pagy::VARS[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example - # Feature Extras # Headers extra: http response headers (and other helpers) useful for API pagination @@ -106,19 +102,15 @@ require 'pagy/extras/array' # See https://ddnexus.github.io/pagy/extras/trim # require 'pagy/extras/trim' - - # Pagy Variables # See https://ddnexus.github.io/pagy/api/pagy#variables # All the Pagy::VARS are set for all the Pagy instances but can be overridden # per instance by just passing them to Pagy.new or the #pagy controller method - # Instance variables # See https://ddnexus.github.io/pagy/api/pagy#instance-variables # Pagy::VARS[:items] = 20 # default - # Other Variables # See https://ddnexus.github.io/pagy/api/pagy#other-variables # Pagy::VARS[:size] = [1,4,4,1] # default @@ -127,7 +119,6 @@ require 'pagy/extras/array' # Pagy::VARS[:anchor] = '#anchor' # example # Pagy::VARS[:link_extra] = 'data-remote="true"' # example - # Rails # Rails: extras assets path required by the helpers that use javascript @@ -135,7 +126,6 @@ require 'pagy/extras/array' # See https://ddnexus.github.io/pagy/extras#javascript # Rails.application.config.assets.paths << Pagy.root.join('javascripts') - # I18n # Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem @@ -165,11 +155,10 @@ require 'pagy/extras/array' # filepath: 'path/to/pagy-xyz.yml', # pluralize: lambda{|count| ... } ) - # I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory # than the default pagy internal i18n (see above) # See https://ddnexus.github.io/pagy/extras/i18n # require 'pagy/extras/i18n' # Default i18n key -# Pagy::VARS[:i18n_key] = 'pagy.item_name' # default \ No newline at end of file +# Pagy::VARS[:i18n_key] = 'pagy.item_name' # default From 185b2773d7e79ca16a5ad0d6b09e0145c6990042 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 16:33:39 +0800 Subject: [PATCH 19/26] [feat]Add bootstrap style to pagination navbar --- app/controllers/conferences_controller.rb | 9 ++++++--- app/views/conferences/show.html.haml | 5 +++-- config/initializers/pagy.rb | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index f4d08ac6..8e1a364b 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +EVENTS_PER_PAGE = 3 + class ConferencesController < ApplicationController include ConferenceHelper @@ -72,9 +74,10 @@ class ConferencesController < ApplicationController @sponsors = @conference.sponsors end if splashpage.include_happening_now - @event_list = get_happening_now_events_schedules(@conference) - @event_limit = 3 - @pagy, @events_schedules = pagy_array(@event_list, items: @event_limit) + 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) @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 0d7e1d20..dc79cc53 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -57,8 +57,9 @@ %h2.text-center{ style: "margin-bottom:30px" } Happening Now - for event_schedule in @events_schedules = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - .container{ style: "margin:auto; width:50%" } - != pagy_nav(@pagy) + - if @events_schedules_length > @events_schedules_limit + .container{ style: "width:100%; text-align:center" } + != pagy_bootstrap_nav(@pagy) - else .row %h3.text-center There are no events happening now. diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index c1dcb0be..282b3e73 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -36,7 +36,7 @@ require 'pagy/extras/array' # Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination # See https://ddnexus.github.io/pagy/extras/bootstrap -# require 'pagy/extras/bootstrap' +require 'pagy/extras/bootstrap' # Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination # See https://ddnexus.github.io/pagy/extras/bulma From 5f776f9275015394e1d72afa61bc98c7675e0dce Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 16:41:16 +0800 Subject: [PATCH 20/26] [refactor]Delete unused javascript; Move about-and-happening-now to partial --- .../conferences/_about_and_happening_now.haml | 25 +++++++++ app/views/conferences/show.html.haml | 51 +------------------ 2 files changed, 26 insertions(+), 50 deletions(-) create mode 100644 app/views/conferences/_about_and_happening_now.haml diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml new file mode 100644 index 00000000..14c61e71 --- /dev/null +++ b/app/views/conferences/_about_and_happening_now.haml @@ -0,0 +1,25 @@ +%section#about-and-happening-now + .container + .row + -# happening now events are displayed second in md or lg view + .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 + #happening-now + - if @conference.splashpage.include_happening_now + - if @events_schedules.any? + .row + %h2.text-center{ style: "margin-bottom:30px" } Happening Now + - for event_schedule in @events_schedules + = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event + - if @events_schedules_length > @events_schedules_limit + .container{ style: "width:100%; text-align:center" } + != pagy_bootstrap_nav(@pagy) + - else + .row + %h3.text-center There are no events happening now. + - if @conference.description.present? + .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 + #about + .row + %h2.text-left{ style: "margin-bottom:30px" } About the Conference + = markdown(@conference.description, escape_html=false) + .trapezoid \ No newline at end of file diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index dc79cc53..6e42734c 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -45,32 +45,7 @@ = render 'header', conference: @conference, venue: @conference.venue -# description / happening now - %section#about-and-happening-now - .container - .row - -# happening now events are displayed second in md or lg view - .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 - #happening-now - - if @conference.splashpage.include_happening_now - - if @events_schedules.any? - .row - %h2.text-center{ style: "margin-bottom:30px" } Happening Now - - for event_schedule in @events_schedules - = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - - if @events_schedules_length > @events_schedules_limit - .container{ style: "width:100%; text-align:center" } - != pagy_bootstrap_nav(@pagy) - - else - .row - %h3.text-center There are no events happening now. - - if @conference.description.present? - .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 - #about - .row - %h2.text-left{ style: "margin-bottom:30px" } About the Conference - = markdown(@conference.description, escape_html=false) - .trapezoid - + = render 'about_and_happening_now' -# calls for content, or program - if @conference.splashpage.include_cfp @@ -110,27 +85,3 @@ - if @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact = render 'footer' - -:javascript - var loadData = function() { - $.ajax({ - type: 'GET', - contentType: 'application/json; charset=utf-8', - url: '#{@happening_now_url}', - dataType: 'json', - success: renderTemplate, - failure: function(){ - console.log('error'); - } - }); - }; - - var renderTemplate = function(data) { - console.log(data); - console.log("template rendered"); - - for (key in data) { - event_schedule = data[key]; - console.log(event_schedule['event']); - } - } From 9601328df8fabb44eda515d701d3c307194dbe26 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 16:51:04 +0800 Subject: [PATCH 21/26] [style]Fix style --- .../conferences/_about_and_happening_now.haml | 22 +++++++++---------- app/views/conferences/show.html.haml | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index 14c61e71..d0925a52 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -4,22 +4,22 @@ -# happening now events are displayed second in md or lg view .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 #happening-now - - if @conference.splashpage.include_happening_now + - if conference.splashpage.include_happening_now - if @events_schedules.any? .row - %h2.text-center{ style: "margin-bottom:30px" } Happening Now - - for event_schedule in @events_schedules - = render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event - - if @events_schedules_length > @events_schedules_limit - .container{ style: "width:100%; text-align:center" } - != pagy_bootstrap_nav(@pagy) + %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 + - if events_schedules_length > events_schedules_limit + .container{ style: 'width:100%; text-align:center' } + != pagy_bootstrap_nav(pagy) - else .row %h3.text-center There are no events happening now. - - if @conference.description.present? + - if conference.description.present? .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 #about .row - %h2.text-left{ style: "margin-bottom:30px" } About the Conference - = markdown(@conference.description, escape_html=false) - .trapezoid \ No newline at end of file + %h2.text-left{ style: 'margin-bottom:30px' } About the Conference + = markdown(conference.description, false) + .trapezoid diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 6e42734c..98aea92b 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -45,7 +45,10 @@ = render 'header', conference: @conference, venue: @conference.venue -# description / happening now - = render 'about_and_happening_now' + = 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 From 3c7cc6cfdbbfdb88a5de09642bc2426376049191 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 17:16:16 +0800 Subject: [PATCH 22/26] [feat]Use Ajax for paginating happening_now --- app/assets/javascripts/application.js | 3 +++ app/controllers/conferences_controller.rb | 2 +- .../conferences/_about_and_happening_now.haml | 16 ++++------------ app/views/conferences/_happening_now.haml | 12 ++++++++++++ app/views/conferences/show.js.erb | 5 +++++ config/initializers/pagy.rb | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 app/views/conferences/_happening_now.haml create mode 100644 app/views/conferences/show.js.erb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ca8cf3da..6548a3fe 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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); }); diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 8e1a364b..643f97e5 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -77,7 +77,7 @@ class ConferencesController < ApplicationController 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) + @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 diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index d0925a52..93bf8b2b 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -4,18 +4,10 @@ -# happening now events are displayed second in md or lg view .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 #happening-now - - if 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 - - if events_schedules_length > events_schedules_limit - .container{ style: 'width:100%; text-align:center' } - != pagy_bootstrap_nav(pagy) - - else - .row - %h3.text-center There are no events 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 - if conference.description.present? .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 #about diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml new file mode 100644 index 00000000..20e3cbd4 --- /dev/null +++ b/app/views/conferences/_happening_now.haml @@ -0,0 +1,12 @@ +- if 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 + - 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. diff --git a/app/views/conferences/show.js.erb b/app/views/conferences/show.js.erb new file mode 100644 index 00000000..27a6ba37 --- /dev/null +++ b/app/views/conferences/show.js.erb @@ -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')); \ No newline at end of file diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index 282b3e73..a446edc0 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -124,7 +124,7 @@ require 'pagy/extras/bootstrap' # Rails: extras assets path required by the helpers that use javascript # (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js) # See https://ddnexus.github.io/pagy/extras#javascript -# Rails.application.config.assets.paths << Pagy.root.join('javascripts') +Rails.application.config.assets.paths << Pagy.root.join('javascripts') # I18n From 02300ee8f20ee9a0614c699e2344bb9cdc9dffc1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 22:01:57 +0800 Subject: [PATCH 23/26] [feat]Description / happening now takes the entire row if the other is empty --- .../conferences/_about_and_happening_now.haml | 38 +++++++++++++------ app/views/conferences/show.html.haml | 9 +++-- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index 93bf8b2b..59824008 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -2,16 +2,32 @@ .container .row -# happening now events are displayed second in md or lg view - .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 - #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 + - if conference.splashpage.include_happening_now? + - if conference.description.present? + .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 + #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 + - else + .col-md-12 + #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 - if conference.description.present? - .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 - #about - .row - %h2.text-left{ style: 'margin-bottom:30px' } About the Conference - = markdown(conference.description, false) + - if conference.splashpage.include_happening_now? + .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 + #about + .row + %h2.text-left{ style: 'margin-bottom:30px' } About the Conference + = markdown(conference.description, false) + - else + .col-md-12 + #about + .row + %h2.text-left{ style: 'margin-bottom:30px' } About the Conference + = markdown(conference.description, false) .trapezoid diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 98aea92b..3a73c0b0 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -45,10 +45,11 @@ = render 'header', conference: @conference, venue: @conference.venue -# description / happening now - = 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 + - 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 From 6c96328f461c3c377a47bb3053e5f6359380ca01 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 9 Apr 2021 22:17:33 +0800 Subject: [PATCH 24/26] [feat]Add brief version of event partial; fix style --- .../conferences/_about_and_happening_now.haml | 35 +++++++++--------- app/views/conferences/_happening_now.haml | 2 +- app/views/schedules/_event.html.haml | 36 ++++++++++--------- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index 59824008..3cd63c20 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -1,3 +1,16 @@ += 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 @@ -5,29 +18,15 @@ - if conference.splashpage.include_happening_now? - if conference.description.present? .col-md-6.col-md-push-6.col-lg-4.col-lg-push-8 - #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 + = yield :happening_now - else .col-md-12 - #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 + = yield :happening_now - if conference.description.present? - if conference.splashpage.include_happening_now? .col-md-6.col-md-pull-6.col-lg-8.col-lg-pull-4 - #about - .row - %h2.text-left{ style: 'margin-bottom:30px' } About the Conference - = markdown(conference.description, false) + = yield :about - else .col-md-12 - #about - .row - %h2.text-left{ style: 'margin-bottom:30px' } About the Conference - = markdown(conference.description, false) + = yield :about .trapezoid diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index 20e3cbd4..54947fa7 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -3,7 +3,7 @@ .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 + = 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) diff --git a/app/views/schedules/_event.html.haml b/app/views/schedules/_event.html.haml index 9373d0c3..2e6fd429 100644 --- a/app/views/schedules/_event.html.haml +++ b/app/views/schedules/_event.html.haml @@ -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) @@ -27,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 From 346f324beffdd2409b18a9a5504a190be701f8fc Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sat, 10 Apr 2021 00:44:42 +0800 Subject: [PATCH 25/26] [feat]Display happening now only if program is also displayed --- app/controllers/conferences_controller.rb | 14 +++++++------- app/views/admin/splashpages/_form.html.haml | 5 ++--- app/views/admin/splashpages/show.html.haml | 6 +++--- .../conferences/_about_and_happening_now.haml | 4 ++-- app/views/conferences/_happening_now.haml | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 643f97e5..ddb2e506 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -60,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') @@ -73,13 +80,6 @@ class ConferencesController < ApplicationController ).order('sponsorship_levels.position ASC', 'sponsors.name') @sponsors = @conference.sponsors 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 def calendar diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index bf689200..c40e9294 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -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) } @@ -44,9 +46,6 @@ %li = f.input :include_social_media, label: 'Display social media links', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_social_media) } - %li - = f.input :include_happening_now, label: 'Display events happening now', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_happening_now) } - = f.inputs name: 'Access' do %ul.fa-ul %li diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index 14c64e82..08edb140 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -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 @@ -45,9 +48,6 @@ %li %i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" } Display social media links - %li - %i{ class: "fa-li #{icon_for_todo @splashpage.include_happening_now?}" } - Display events happening now %li - if @conference.splashpage && @conference.splashpage.public %i{ class: "fa-li #{icon_for_todo @splashpage.public?}" } diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index 3cd63c20..c048b28d 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -15,7 +15,7 @@ .container .row -# happening now events are displayed second in md or lg view - - if conference.splashpage.include_happening_now? + - 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 @@ -23,7 +23,7 @@ .col-md-12 = yield :happening_now - if conference.description.present? - - if conference.splashpage.include_happening_now? + - 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 diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index 54947fa7..66355a82 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -1,4 +1,4 @@ -- if conference.splashpage.include_happening_now +- if conference.splashpage.include_program && conference.splashpage.include_happening_now - if events_schedules.any? .row %h2.text-center{ style: 'margin-bottom:30px' } Happening Now From 272b5d20cec021b9554fdb852adac455ecade58a Mon Sep 17 00:00:00 2001 From: CactusPuppy Date: Sun, 11 Apr 2021 13:46:56 -0700 Subject: [PATCH 26/26] Add newline at end of show.js.erb file --- app/views/conferences/show.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conferences/show.js.erb b/app/views/conferences/show.js.erb index 27a6ba37..fb35b420 100644 --- a/app/views/conferences/show.js.erb +++ b/app/views/conferences/show.js.erb @@ -2,4 +2,4 @@ $('#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')); \ No newline at end of file +Pagy.init(document.getElementById('happening-now'));