Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add list of speakers #143

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gem 'builder'
gem 'pry'
gem 'git'
gem 'nokogiri'
gem 'httparty'
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ GEM
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (2.3.0)
Expand Down Expand Up @@ -71,8 +74,12 @@ GEM
servolux
tilt (~> 2.0.9)
uglifier (~> 3.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mini_portile2 (2.4.0)
minitest (5.14.2)
multi_xml (0.6.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
padrino-helpers (0.13.3.4)
Expand Down Expand Up @@ -110,6 +117,7 @@ PLATFORMS
DEPENDENCIES
builder
git
httparty
middleman
nokogiri
pry
Expand Down
3 changes: 3 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
require "lib/lrug_helpers"
helpers LRUGHelpers

require "lib/speaker_helpers"
helpers SpeakerHelpers

# get our kramdown `{::blah}` extensions
require 'lib/lrug_extended_kramdown'
# we have to refer to this via `@app` as otherwise it ends up being a
Expand Down
80 changes: 80 additions & 0 deletions data/speakers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"Mike Rogers": {
"profile": {
"github_username": "MikeRogers0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cool thing about GitHub is we can pull a bunch more data about the speaker via their API without an API key.

},
"talks": []
},
"Ali Najaf": {
"profile": {
"github_username": "",
"twitter_username": "alinajaf",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"how-to-manage-happy-remote-development-teams"
]
},
"Jon Rowe": {
"profile": {
"github_username": "",
"twitter_username": "JonRowe",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"semantic-versioning-ruby-versioning-and-the-forward-march-of-progress"
]
},
"Nitish Rathi": {
"profile": {
"github_username": "",
"twitter_username": "latebound",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"from-confusion-to-contribution"
]
},
"Mugurel Chirica": {
"profile": {
"github_username": "",
"twitter_username": "budmc29",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"influence-your-company-beyond-code"
]
},
"Alfredo Motta": {
"profile": {
"github_username": "",
"twitter_username": "mottalrd",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"designing-domain-oriented-obvservability-in-your-system"
]
},
"Elena Tanasoiu": {
"profile": {
"github_username": "",
"twitter_username": "elenatanasoiu",
"avatar_url": "",
"bio": "",
"blog": ""
},
"talks": [
"you-dont-know-what-you-dont-know"
]
}
}
47 changes: 47 additions & 0 deletions lib/speaker_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'httparty'
require 'ostruct'

module SpeakerHelpers
def all_speakers
data.speakers
.collect { |name, speaker_data| Speaker.new(name, speaker_data) }
.sort_by { |speaker| speaker.name }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should order this by recency of the speakers talks, so it changes once each meeting is published to show the most recent speakers? I don't think sorting by frequency of talks is a good idea, but maybe recency is weird. We've enough speakers that maybe we'd want A..Z in page navigation so doing anything other than alphabetical is weird?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should sort by most recently published, I think it's possible now I've figured out a way to pull the coverage data into a easier to work with format.

end

private

class Speaker
attr_reader :name
attr_reader :profile
attr_reader :talks

delegate :github_username,
:twitter_username,
:avatar_url,
:bio,
:blog, to: :profile

def initialize(name, speaker_data)
@name = name
@talks = speaker_data[:talks]

if speaker_data[:profile][:github_username].present?
@profile = OpenStruct.new github_profile(speaker_data[:profile][:github_username])
else
@profile = OpenStruct.new speaker_data[:profile]
end
end

private

def github_profile(username)
@@github_users ||= {}
@@github_users[username] ||= load_github_profile_from_api(username)
end

def load_github_profile_from_api(username)
MikeRogers0 marked this conversation as resolved.
Show resolved Hide resolved
response = HTTParty.get("https://api.github.com/users/#{username}")
JSON.parse(response.body, symbolize_names: true)
end
end
end
1 change: 1 addition & 0 deletions source/images/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions source/images/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions source/speakers/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,39 @@ created_by:
name: Mike Rogers
---

<div class="speaker__list">

<% all_speakers.each do |speaker| %>
<div class="speaker">
<div class="speaker__avatar">
<%= image_tag speaker.avatar_url, alt: "#{speaker.name} avatar" %>
</div>

<div class="speaker__details">
<h2 class="speaker__name"><%= speaker.name %></h2>
<div class="speaker__socials">
<% link_to "https://twitter.com/#{speaker.twitter_username}" do %>
<%= image_tag 'twitter.svg', width: 24, height: 24 %>
<% end %>

<% link_to "https://github.com/#{speaker.github_username}" do %>
<%= image_tag 'github.svg', width: 24, height: 24 %>
<% end %>
</div>

<p><%= speaker.bio %></p>

<p>Talks: <%= speaker.talks.count %></p>

<p>
<%= link_to speaker.blog, speaker.blog %>
</p>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we've taken inspiration from some other website on this, but I'm pretty sure we'll never get most of these details, so lets pare it right back. I quite like the svg icons for the twitter / GitHub links, but I also know that without a huge amount of effort we're probably not going to get twitter and GitHub links for most of our speakers, and for some we don't even have those, some folk just link to LinkedIn and personal websites were the preferred link back in the past. Perhaps we can just introspect on the one link we do have and render an appropriate icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can just introspect on the one link we do have and render an appropriate icon?

I agree :) I was hoping to find a way to pull in a bit more information, I think I'll save that for another PR :)

</div>
<% end %>

</div>

<% data.coverage.sort_by { |key, value| -key.to_i }.each do |year, month_and_talks| %>
MikeRogers0 marked this conversation as resolved.
Show resolved Hide resolved
<h2><%= year %></h2>

Expand Down
1 change: 1 addition & 0 deletions source/stylesheets/all.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
@import "components/meeting-sponsor-list";
@import "components/coverage";
@import "components/calendar-link";
@import "components/speaker";

@import "utilities/custom";
51 changes: 51 additions & 0 deletions source/stylesheets/components/_speaker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.speaker__list {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-gap: $space-6;
}

.speaker {
grid-column: span 13;

display: grid;
grid-template-columns: repeat(12, 1fr);
grid-gap: $space-6;
}

.speaker__avatar {
grid-column: 1 / 3;

img {
width: 100%;
border-radius: 0.25rem;
}
}


.speaker__details {
grid-column: 3 / 13;
}

.speaker__name {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
margin-right: $space-4;
}

.speaker__socials {
display: inline-block;

a {
padding-left: $space-3;

&:hover {
background: none;
opacity: 0.5;
}
}

img {
display: inline-block;
}
}