-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add list of speakers #143
Changes from 1 commit
bac82f5
42525a5
2068f94
6bc05eb
92b581b
986ae37
54b7ffb
e22c486
78adcc8
ef2e65f
a2e0635
81d1e88
d05d78b
69a320b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ gem 'builder' | |
gem 'pry' | ||
gem 'git' | ||
gem 'nokogiri' | ||
gem 'httparty' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"Mike Rogers": { | ||
"profile": { | ||
"github_username": "MikeRogers0" | ||
}, | ||
"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" | ||
] | ||
} | ||
} |
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 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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> | ||
|
||
|
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; | ||
} | ||
} |
There was a problem hiding this comment.
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.