From 93aae0f42f72243bf599ce68271fda4bf2a8a97f Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 25 Oct 2024 18:50:22 +0200 Subject: [PATCH 1/3] Group talks on `speakers#show` page --- app/controllers/speakers_controller.rb | 6 ++++ app/models/talk.rb | 12 ++++++++ app/views/speakers/_talks.html.erb | 15 ++++++++++ app/views/speakers/show.html.erb | 30 ++++++++++++------- data/balkanruby/balkanruby-2019/videos.yml | 4 +-- data/balkanruby/balkanruby-2024/videos.yml | 2 +- data/balticruby/balticruby-2024/videos.yml | 4 +-- data/euruko/euruko-2023/videos.yml | 2 +- data/pivorak/pivorak-conf-3/videos.yml | 2 +- data/railsconf/railsconf-2021/videos.yml | 2 +- .../videos.yml | 2 +- data/rubyconf/rubyconf-2015/videos.yml | 2 +- data/rubyconf/rubyconf-2019/videos.yml | 2 +- data/rubyconf/rubyconf-2021/videos.yml | 2 +- data/rubyday/rubyday-2021/videos.yml | 2 +- 15 files changed, 65 insertions(+), 24 deletions(-) create mode 100644 app/views/speakers/_talks.html.erb diff --git a/app/controllers/speakers_controller.rb b/app/controllers/speakers_controller.rb index c3ee3de80..4c777bf3a 100644 --- a/app/controllers/speakers_controller.rb +++ b/app/controllers/speakers_controller.rb @@ -23,6 +23,12 @@ def index def show @talks = @speaker.talks.with_essential_card_data.order(date: :desc) @back_path = speakers_path + + @grouped_talks = @talks.group_by { |talk| talk.groupable_title.downcase }.map { |title, talks| [talks.first.groupable_title, talks] }.to_h + + @ungrouped_talks = @grouped_talks.select { |title, talks| talks.count == 1 }.values.flatten + @grouped_talks = @grouped_talks.reject { |_title, talks| talks.count == 1 }.sort_by { |_title, talks| -talks.map(&:date).max.to_time.to_i } + set_meta_tags(@speaker) # fresh_when(@speaker) end diff --git a/app/models/talk.rb b/app/models/talk.rb index bdd278f2c..e11bec4c0 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -175,6 +175,18 @@ def related_talks(limit: 6) Talk.where(id: ids) end + def groupable_title + prefixes = ["Keynote", "Opening Keynote", "Closing Keynote", "Lightning Talks"] + + return slug if title.in?(prefixes) + + title.dup.tap do |t| + prefixes.each do |prefix| + t.delete_prefix!("#{prefix}: ") + end + end + end + def transcript enhanced_transcript.presence || raw_transcript end diff --git a/app/views/speakers/_talks.html.erb b/app/views/speakers/_talks.html.erb new file mode 100644 index 000000000..89cf47be7 --- /dev/null +++ b/app/views/speakers/_talks.html.erb @@ -0,0 +1,15 @@ +

<%= title %>

+ +
+ <%= render( + partial: "talks/card", + collection: talks, + as: :talk, + locals: { + favoritable: true, + user_favorite_talks_ids: user_favorite_talks_ids, + back_to: request.fullpath, + back_to_title: speaker.name + } + ) %> +
diff --git a/app/views/speakers/show.html.erb b/app/views/speakers/show.html.erb index 81c3e5ffb..0100381ab 100644 --- a/app/views/speakers/show.html.erb +++ b/app/views/speakers/show.html.erb @@ -30,17 +30,25 @@
-
- <%= render partial: "talks/card", - collection: @talks, - as: :talk, - locals: { - favoritable: true, - user_favorite_talks_ids: @user_favorite_talks_ids, - back_to: request.fullpath, - back_to_title: @speaker.name - } %> -
+ <% if @grouped_talks.any? %> +
+ +
+ <% @grouped_talks.each do |title, talks| %> + <%= render partial: "talks", locals: {title: title, talks: talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> + <% end %> + + <%= render partial: "talks", locals: {title: "Ungrouped", talks: @ungrouped_talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> +
+ + +
+ <%= render partial: "talks", locals: {talks: @talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> +
+
+ <% else %> + <%= render partial: "talks", locals: {talks: @talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> + <% end %>
diff --git a/data/balkanruby/balkanruby-2019/videos.yml b/data/balkanruby/balkanruby-2019/videos.yml index 26c9e3561..abd7b1d77 100644 --- a/data/balkanruby/balkanruby-2019/videos.yml +++ b/data/balkanruby/balkanruby-2019/videos.yml @@ -1,5 +1,5 @@ --- -- title: 'Compacting GC for MRI' +- title: 'Compacting GC for MRI in Ruby 2.7' raw_title: Balkan Ruby 2019 – Aaron Patterson – Compacting GC for MRI speakers: - Aaron Patterson @@ -35,7 +35,7 @@ description: '' video_id: QMhgm9ir8js -- title: 'The Past, Present and Future of Rails at GitHub' +- title: 'The Past, Present, and Future of Rails at GitHub' raw_title: Balkan Ruby 2019 – Eileen Uchitelle – The Past, Present and Future of Rails at GitHub speakers: - Eileen M. Uchitelle diff --git a/data/balkanruby/balkanruby-2024/videos.yml b/data/balkanruby/balkanruby-2024/videos.yml index 246b5995f..95eaaee4e 100644 --- a/data/balkanruby/balkanruby-2024/videos.yml +++ b/data/balkanruby/balkanruby-2024/videos.yml @@ -86,7 +86,7 @@ Join him on a journey to explore the use-cases and benefits of running SQLite in a production environment. video_id: 7QMYfpU6_-s -- title: 'The history of a Rails monolith' +- title: '2000 Engineers, 2 Millions Lines of Code: The History of a Rails Monolith' raw_title: Cristian Planas & Anatoly Mikhaylov – The history of a Rails monolith speakers: - Cristian Planas diff --git a/data/balticruby/balticruby-2024/videos.yml b/data/balticruby/balticruby-2024/videos.yml index 08afb588a..355705067 100644 --- a/data/balticruby/balticruby-2024/videos.yml +++ b/data/balticruby/balticruby-2024/videos.yml @@ -36,7 +36,7 @@ data integrity, efficiency and performance along the way! video_id: xa9ixrLU7X4 -- title: "2000 engineers, 2 millions lines of code: the history of a Rails monolith" +- title: "2000 Engineers, 2 Millions Lines of Code: The History of a Rails Monolith" raw_title: '"2000 engineers, 2 millions lines of code: the history of a Rails monolith"' speakers: - Cristian Planas @@ -167,7 +167,7 @@ problems along the way. video_id: mZzIJ4QpQck -- title: "Keynote: Second system syndrome" +- title: "Keynote: Second System Syndrome" raw_title: '"Second system syndrome"' speakers: - Yukihiro "Matz" Matsumoto diff --git a/data/euruko/euruko-2023/videos.yml b/data/euruko/euruko-2023/videos.yml index 5679e2d76..2a4e242da 100644 --- a/data/euruko/euruko-2023/videos.yml +++ b/data/euruko/euruko-2023/videos.yml @@ -156,7 +156,7 @@ description: "" video_id: 79LN5Sn4Nac -- title: "Panel: 30 years of Ruby" +- title: "Panel: 30 Years of Ruby" raw_title: Panel discussion "30 years of Ruby" speakers: - James Bell diff --git a/data/pivorak/pivorak-conf-3/videos.yml b/data/pivorak/pivorak-conf-3/videos.yml index c0d0fe9ec..bca520285 100644 --- a/data/pivorak/pivorak-conf-3/videos.yml +++ b/data/pivorak/pivorak-conf-3/videos.yml @@ -42,7 +42,7 @@ benefits: https://bit.ly/313cImj" video_id: Bm7XpipPU9g -- title: 'Compacting GC in Ruby 2.7' +- title: 'Compacting GC for MRI in Ruby 2.7' raw_title: Compacting GC in Ruby 2.7 - Aaron Patterson speakers: - Aaron Patterson diff --git a/data/railsconf/railsconf-2021/videos.yml b/data/railsconf/railsconf-2021/videos.yml index e281a426d..e8b5e96cc 100644 --- a/data/railsconf/railsconf-2021/videos.yml +++ b/data/railsconf/railsconf-2021/videos.yml @@ -1236,7 +1236,7 @@ After a quick recap of the fundamentals, you'll learn the procedural, technical and human factors that can affect the trustworthiness of a test. More importantly, I'll show you how to mitigate these issues with easy, actionable tips that will have you A/B testing accurately in no time! video_id: IsgQ9RJ0rJE -- title: The Rising Storm of Ethics in Open Source +- title: The Rising Ethical Storm in Open Source raw_title: "RailsConf 2021: The Rising Storm of Ethics in Open Source - Coraline Ada Ehmke" speakers: - Coraline Ada Ehmke diff --git a/data/ruby-warsaw-community-conference/ruby-warsaw-community-conference-summer-edition-2024/videos.yml b/data/ruby-warsaw-community-conference/ruby-warsaw-community-conference-summer-edition-2024/videos.yml index 12774c251..cac6ca039 100644 --- a/data/ruby-warsaw-community-conference/ruby-warsaw-community-conference-summer-edition-2024/videos.yml +++ b/data/ruby-warsaw-community-conference/ruby-warsaw-community-conference-summer-edition-2024/videos.yml @@ -22,7 +22,7 @@ https://github.com/visualitypl" video_id: TDQ2wtmgeKw -- title: '2000 Engineers, 2 millions lines of code: The history of a Rails monolith' +- title: '2000 Engineers, 2 Millions Lines of Code: The History of a Rails Monolith' raw_title: "[EN] 2000 Engineers, 2 millions lines of code: The history of a Rails monolith - Cristian Planas" speakers: - Cristian Planas diff --git a/data/rubyconf/rubyconf-2015/videos.yml b/data/rubyconf/rubyconf-2015/videos.yml index 95f8388d4..ca70170b6 100644 --- a/data/rubyconf/rubyconf-2015/videos.yml +++ b/data/rubyconf/rubyconf-2015/videos.yml @@ -234,7 +234,7 @@ Your code is your partner. It struggles against you, but also alongside you. Your code comes to you as it is, not as you wish it were. Like a real-life partner, it has a history that you’ll never fully know; like a real-life child, it bears your imprint, but it is wild, unruly, and fiercely self-sovereign. You’ll never stop working with code that’s hard to figure out or difficult to change. But this code, this stubborn creature, is entrusted to you. Let go of your anger at the developer who wrote it. Let go of the terror of being blamed for its unforeseeable regressions. Let go--and find joy. video_id: JC4mS7sYQlU -- title: How does Bundler work, anyway? +- title: How Does Bundler Work, Anyway? raw_title: RubyConf 2015 - How does Bundler work, anyway? by Andre Arko speakers: - André Arko diff --git a/data/rubyconf/rubyconf-2019/videos.yml b/data/rubyconf/rubyconf-2019/videos.yml index a6e4fb6ab..bb40ef56d 100644 --- a/data/rubyconf/rubyconf-2019/videos.yml +++ b/data/rubyconf/rubyconf-2019/videos.yml @@ -1068,7 +1068,7 @@ so I'll try to explain it by emoji\n\n\n\n#confreaks #rubyconf2019" video_id: SzgmcVN7qu4 -- title: Compacting Heaps in Ruby 2.7 +- title: Compacting GC for MRI in Ruby 2.7 raw_title: RubyConf 2019 - Compacting Heaps in Ruby 2.7 by Aaron Patterson speakers: - Aaron Patterson diff --git a/data/rubyconf/rubyconf-2021/videos.yml b/data/rubyconf/rubyconf-2021/videos.yml index 18d903d45..d4b3a2657 100644 --- a/data/rubyconf/rubyconf-2021/videos.yml +++ b/data/rubyconf/rubyconf-2021/videos.yml @@ -1231,7 +1231,7 @@ description: "" video_id: cWzsmOw-AFw -- title: "Keynote: Beyond Ruby3.0" +- title: "Keynote: Beyond Ruby 3.0" raw_title: "RubyConf 2021 - Keynote: Beyond Ruby3.0 by Yukihiro (Matz) Matsumoto" speakers: - Yukihiro "Matz" Matsumoto diff --git a/data/rubyday/rubyday-2021/videos.yml b/data/rubyday/rubyday-2021/videos.yml index 6bc8c169c..43ee234dc 100644 --- a/data/rubyday/rubyday-2021/videos.yml +++ b/data/rubyday/rubyday-2021/videos.yml @@ -71,7 +71,7 @@ 7th 2021. \n\nSpeaker and details on https://2021.rubyday.it/" video_id: OevCwq5I9fM -- title: "Ruby 3.0 and Beyond" +- title: "Ruby 3 and Beyond" raw_title: Ruby3.0 and Beyond - Yukihiro "Matz" Matsumoto - rubyday 2021 speakers: - Yukihiro "Matz" Matsumoto From f2a63dc7c84588062e495b269d4693635f5970b2 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 25 Oct 2024 20:01:52 +0200 Subject: [PATCH 2/3] Group ungrouped talks by year --- app/controllers/speakers_controller.rb | 6 ++++-- app/models/talk.rb | 2 +- app/views/speakers/show.html.erb | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/speakers_controller.rb b/app/controllers/speakers_controller.rb index 4c777bf3a..780c338a0 100644 --- a/app/controllers/speakers_controller.rb +++ b/app/controllers/speakers_controller.rb @@ -26,8 +26,10 @@ def show @grouped_talks = @talks.group_by { |talk| talk.groupable_title.downcase }.map { |title, talks| [talks.first.groupable_title, talks] }.to_h - @ungrouped_talks = @grouped_talks.select { |title, talks| talks.count == 1 }.values.flatten - @grouped_talks = @grouped_talks.reject { |_title, talks| talks.count == 1 }.sort_by { |_title, talks| -talks.map(&:date).max.to_time.to_i } + @ungrouped_by_year = @grouped_talks.select { |title, talks| talks.count == 1 }.values.flatten.group_by { |talk| "#{talk.date.year} talks" } + @grouped_talks = @grouped_talks.reject { |_title, talks| talks.count == 1 } + + @grouped_talks = (@ungrouped_by_year.to_a + @grouped_talks.to_a).to_h.sort_by { |_title, talks| -talks.map(&:date).max.to_time.to_i } set_meta_tags(@speaker) # fresh_when(@speaker) diff --git a/app/models/talk.rb b/app/models/talk.rb index e11bec4c0..14f1d8a82 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -178,7 +178,7 @@ def related_talks(limit: 6) def groupable_title prefixes = ["Keynote", "Opening Keynote", "Closing Keynote", "Lightning Talks"] - return slug if title.in?(prefixes) + return "#{title} - #{event.name}" if title.in?(prefixes) title.dup.tap do |t| prefixes.each do |prefix| diff --git a/app/views/speakers/show.html.erb b/app/views/speakers/show.html.erb index 0100381ab..1e3f9f733 100644 --- a/app/views/speakers/show.html.erb +++ b/app/views/speakers/show.html.erb @@ -37,8 +37,6 @@ <% @grouped_talks.each do |title, talks| %> <%= render partial: "talks", locals: {title: title, talks: talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> <% end %> - - <%= render partial: "talks", locals: {title: "Ungrouped", talks: @ungrouped_talks, speaker: @speaker, user_favorite_talks_ids: @user_favorite_talks_ids} %> From b0d2f936b9b2838d4f4577d206bbf4840674b24f Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Tue, 29 Oct 2024 14:16:42 +0100 Subject: [PATCH 3/3] Do You Need That Validation? Let Me Call You Back About It --- data/pivorak/pivorak-conf-3/videos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/pivorak/pivorak-conf-3/videos.yml b/data/pivorak/pivorak-conf-3/videos.yml index b54d6bbe0..1181b409b 100644 --- a/data/pivorak/pivorak-conf-3/videos.yml +++ b/data/pivorak/pivorak-conf-3/videos.yml @@ -23,7 +23,7 @@ benefits: https://bit.ly/313cImj" video_id: vKN3v3omJqM -- title: Do You Need That Validation? +- title: Do You Need That Validation? Let Me Call You Back About It raw_title: Do You Need That Validation? - Tobias Pfeiffer speakers: - Tobias Pfeiffer