From 28e75c6f37a756241f75930713c5fd918aaffb32 Mon Sep 17 00:00:00 2001 From: Warren Huang Date: Sun, 14 Apr 2024 16:56:59 -0700 Subject: [PATCH 1/3] Migrate include_committee to splash pages --- app/controllers/admin/splashpages_controller.rb | 3 ++- app/controllers/conferences_controller.rb | 5 +++++ app/models/splashpage.rb | 1 + app/views/admin/splashpages/_form.html.haml | 4 ++++ app/views/conferences/show.html.haml | 5 +++++ .../20240414231910_add_include_committee_to_splashpage.rb | 5 +++++ db/schema.rb | 3 ++- spec/factories/splashpages.rb | 1 + 8 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20240414231910_add_include_committee_to_splashpage.rb diff --git a/app/controllers/admin/splashpages_controller.rb b/app/controllers/admin/splashpages_controller.rb index 7e50bb22b..56ead72df 100644 --- a/app/controllers/admin/splashpages_controller.rb +++ b/app/controllers/admin/splashpages_controller.rb @@ -51,7 +51,8 @@ def splashpage_params :include_venue, :include_registrations, :include_tickets, :include_lodgings, :include_sponsors, :include_social_media, - :include_booths, :include_happening_now) + :include_booths, :include_happening_now, + :include_committee) end end end diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index ef90c670c..435cca136 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -65,6 +65,11 @@ def show ).order('sponsorship_levels.position ASC', 'sponsors.name') @sponsors = @conference.sponsors end + if @splashpage.include_committee? + @organizers = @conference.organizers + # @volunteers = @conference.volunteers + # @reviewers = @conference.reviewers + end end # rubocop:enable Metrics/CyclomaticComplexity diff --git a/app/models/splashpage.rb b/app/models/splashpage.rb index 650e06575..9043f20c2 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_committee :boolean # include_happening_now :boolean # include_lodgings :boolean # include_program :boolean diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index 338ad4a2e..f494e9a05 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -55,6 +55,10 @@ %label = f.check_box :include_social_media Display the social media links? + .checkbox + %label + = f.check_box :include_committee + Display the committee? %h4 Access %hr diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 29c5014e2..056144503 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -86,6 +86,11 @@ sponsorship_levels: @sponsorship_levels, sponsors: @sponsors + -# comittee + - if @conference.splashpage.include_committee? + = render 'organizers', conference: @conference, organizers: @organizers + + -# footer - if @conference.splashpage.include_social_media? && @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact, cached: true diff --git a/db/migrate/20240414231910_add_include_committee_to_splashpage.rb b/db/migrate/20240414231910_add_include_committee_to_splashpage.rb new file mode 100644 index 000000000..87b637c12 --- /dev/null +++ b/db/migrate/20240414231910_add_include_committee_to_splashpage.rb @@ -0,0 +1,5 @@ +class AddIncludeCommitteeToSplashpage < ActiveRecord::Migration[7.0] + def change + add_column :splashpages, :include_committee, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 36c6b9d4a..6fe7ced7b 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[7.0].define(version: 2024_02_26_175634) do +ActiveRecord::Schema[7.0].define(version: 2024_04_14_231910) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -467,6 +467,7 @@ t.boolean "include_booths" t.boolean "shuffle_highlights", default: false, null: false t.boolean "include_happening_now" + t.boolean "include_committee" end create_table "sponsors", force: :cascade do |t| diff --git a/spec/factories/splashpages.rb b/spec/factories/splashpages.rb index 6bb3e70ff..a095cffdb 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_committee :boolean # include_happening_now :boolean # include_lodgings :boolean # include_program :boolean From d4061ac7f9e2784a8540f349ee411f0dd6acd891 Mon Sep 17 00:00:00 2001 From: Warren Huang Date: Mon, 15 Apr 2024 14:48:37 -0700 Subject: [PATCH 2/3] Add organizers pic on the splashpage --- app/controllers/conferences_controller.rb | 4 +--- app/views/conferences/_committee.haml | 17 +++++++++++++++++ app/views/conferences/show.html.haml | 3 +-- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 app/views/conferences/_committee.haml diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 435cca136..92688853f 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -66,9 +66,7 @@ def show @sponsors = @conference.sponsors end if @splashpage.include_committee? - @organizers = @conference.organizers - # @volunteers = @conference.volunteers - # @reviewers = @conference.reviewers + @organizers = User.with_role(:organizer, @conference) end end # rubocop:enable Metrics/CyclomaticComplexity diff --git a/app/views/conferences/_committee.haml b/app/views/conferences/_committee.haml new file mode 100644 index 000000000..5944fab67 --- /dev/null +++ b/app/views/conferences/_committee.haml @@ -0,0 +1,17 @@ +-# _committee.haml +.row + .col-md-12 + %h3.text-center + Committee +.row + .col-sd-6 + .row.row-centered + - organizers.shuffle.each do |organizer| + .col-sd-3.col-sm-1.col-xs-3.col-centered + .thumbnail{ style: 'border: none; background: none; padding: 20;' } + - if organizer.profile_picture.present? + = image_tag organizer.profile_picture(size: 150), + class: ['img-responsive', 'img-circle'], + title: organizer.name + .caption + %h4.text-center= organizer.name diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 056144503..b14f7397e 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -88,8 +88,7 @@ -# comittee - if @conference.splashpage.include_committee? - = render 'organizers', conference: @conference, organizers: @organizers - + = render 'committee', organizers: @organizers -# footer - if @conference.splashpage.include_social_media? && @conference.contact.has_social_media? From 81b174e6b678331f426e39b0753934ac226453cf Mon Sep 17 00:00:00 2001 From: Warren Huang Date: Mon, 15 Apr 2024 14:57:53 -0700 Subject: [PATCH 3/3] add profile link to organizer --- app/views/conferences/_committee.haml | 3 ++- app/views/conferences/show.html.haml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/conferences/_committee.haml b/app/views/conferences/_committee.haml index 5944fab67..4359fba32 100644 --- a/app/views/conferences/_committee.haml +++ b/app/views/conferences/_committee.haml @@ -8,7 +8,8 @@ .row.row-centered - organizers.shuffle.each do |organizer| .col-sd-3.col-sm-1.col-xs-3.col-centered - .thumbnail{ style: 'border: none; background: none; padding: 20;' } + = link_to user_path(organizer), class: 'thumbnail', + style: 'border: none; background: none; padding: 20px;' do - if organizer.profile_picture.present? = image_tag organizer.profile_picture(size: 150), class: ['img-responsive', 'img-circle'], diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index b14f7397e..49aa07b7e 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -86,7 +86,7 @@ sponsorship_levels: @sponsorship_levels, sponsors: @sponsors - -# comittee + -# committee - if @conference.splashpage.include_committee? = render 'committee', organizers: @organizers