diff --git a/app/controllers/events/speakers_controller.rb b/app/controllers/events/speakers_controller.rb new file mode 100644 index 000000000..ef7d7986c --- /dev/null +++ b/app/controllers/events/speakers_controller.rb @@ -0,0 +1,15 @@ +class Events::SpeakersController < ApplicationController + skip_before_action :authenticate_user!, only: %i[index] + before_action :set_event, only: %i[index] + + def index + end + + private + + def set_event + @event = Event.includes(:organisation, talks: {speakers: :user}).find_by!(slug: params[:event_slug]) + + redirect_to schedule_event_path(@event.canonical), status: :moved_permanently if @event.canonical.present? + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 021c2a84e..16775da87 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,6 +5,17 @@ def back_path @back_path || root_path end + def active_link_to(text = nil, path = nil, active_class: "", **options, &) + path ||= text + + classes = active_class.presence || "active" + options[:class] = class_names(options[:class], classes) if current_page?(path) + + return link_to(path, options, &) if block_given? + + link_to text, path, options + end + def footer_credits output = ["Made with"] output << heroicon(:heart, variant: :solid, size: :sm, class: "text-primary inline") diff --git a/app/models/event.rb b/app/models/event.rb index 95cdff3af..9a98cf67f 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -125,7 +125,7 @@ def description keynotes = keynote_speakers.any? ? %(, including keynotes by #{keynote_speakers.map(&:name).to_sentence}) : "" <<~DESCRIPTION - #{organisation.name} is a #{organisation.frequency} #{organisation.kind}#{held_in_sentence} and features #{talks.count} #{"talk".pluralize(talks.count)} from various speakers#{keynotes}. + #{organisation.name} is a #{organisation.frequency} #{organisation.kind}#{held_in_sentence} and features #{talks.size} #{"talk".pluralize(talks.size)} from various speakers#{keynotes}. DESCRIPTION end diff --git a/app/models/talk.rb b/app/models/talk.rb index d6b0f48bf..c8f749951 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -83,7 +83,7 @@ class Talk < ApplicationRecord # enums enum :video_provider, %w[youtube mp4 scheduled not_published not_recorded].index_by(&:itself) enum :kind, - %w[talk keynote lightning_talk panel workshop gameshow podcast q_and_a discussion fireside_chat + %w[keynote talk lightning_talk panel workshop gameshow podcast q_and_a discussion fireside_chat interview award].index_by(&:itself) # attributes @@ -378,28 +378,30 @@ def set_kind end self.kind = case title - when /.*(keynote:|opening\ keynote|closing\ keynote|keynote|opening\ keynote|closing\ keynote).*/i + when /^(keynote:|keynote|opening\ keynote:|opening\ keynote|closing\ keynote:|closing\ keynote).*/i :keynote - when /.*(lightning\ talk:|lightning\ talk|lightning\ talks|micro\ talk:|micro\ talk).*/i + when /^(lightning\ talk:|lightning\ talk|lightning\ talks|micro\ talk:|micro\ talk).*/i :lightning_talk when /.*(panel:|panel).*/i :panel - when /.*(workshop:|workshop).*/i + when /^(workshop:|workshop).*/i :workshop - when /.*(gameshow|game\ show|gameshow:|game\ show:).*/i + when /^(gameshow|game\ show|gameshow:|game\ show:).*/i :gameshow - when /.*(podcast:|podcast\ recording:|live\ podcast:).*/i + when /^(podcast:|podcast\ recording:|live\ podcast:).*/i :podcast - when /.*(q&a|q&a:|ama|q&a\ with|ruby\ committers\ vs\ the\ world|ruby\ committers\ and\ the\ world).*/i + when /.*(q&a|q&a:|q&a\ with|ruby\ committers\ vs\ the\ world|ruby\ committers\ and\ the\ world).*/i, + /.*(AMA)$/, + /^(AMA:)/ :q_and_a - when /.*(fishbowl:|fishbowl\ discussion:|discussion:|discussion).*/i + when /^(fishbowl:|fishbowl\ discussion:|discussion:|discussion).*/i :discussion - when /.*(fireside\ chat:|fireside\ chat).*/i + when /^(fireside\ chat:|fireside\ chat).*/i :fireside_chat + when /^(award:|award\ show|ruby\ heroes\ awards|ruby\ heroes\ award|rails\ luminary).*/i + :award when /^(interview:|interview\ with).*/i :interview - when /.*(award:|award\ show|ruby\ hero\ awards|ruby\ hero\ award|rails\ luminary).*/i - :award else :talk end diff --git a/app/views/events/_header.html.erb b/app/views/events/_header.html.erb new file mode 100644 index 000000000..dbae3fe48 --- /dev/null +++ b/app/views/events/_header.html.erb @@ -0,0 +1,29 @@ +
+ <%= event.description %> +
+- <%= @event.description %> -
- - <% if false %> - - <% end %> -- No talks found for this event. -
-- Please - &body=<%= CGI.escape("\n\nIssue opened from event page: #{event_url(@event)}") %>" class="text-primary" target="_blank">open an issue on GitHub - if you know how to get access to the recordings of this event. Thank you! -
+ <% if @talks.empty? %> ++ No talks found for this event. +
++ Please + &body=<%= CGI.escape("\n\nIssue opened from event page: #{event_url(@event)}") %>" class="text-primary" target="_blank">open an issue on GitHub + if you know how to get access to the recordings of this event. Thank you! +
+