-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to use a gravatar for the profile image
- Loading branch information
1 parent
1443bbc
commit 4f1c775
Showing
5 changed files
with
44 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
json.extract! profile, :id, :name, :handle, :bio, :created_at, :updated_at | ||
json.url profile_url(profile, format: :json) | ||
json.profile_picture_url profile_picture(profile.email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
<div class="container"> | ||
<div class="block"> | ||
<h1 class="title"><%= @profile.name %></h1> | ||
<h2 class="subtitle"><%= "@#{@profile.handle}" %></h2> | ||
<%= friendship_button(@profile) %> | ||
</div> | ||
<div class="block"> | ||
<p><%= @profile.bio %></p> | ||
</div> | ||
<% if @profile.events.present? %> | ||
<div class="section"> | ||
<div class="container"> | ||
<div class="media is-flex-wrap-wrap mb-3" style="row-gap:1em"> | ||
<figure class="media-left image"> | ||
<img src="<%= profile_picture(@profile.email) %>" alt="Profile pic"> | ||
</figure> | ||
<div class="media-content"> | ||
<p class="has-text-weight-bold is-size-4"><%= @profile.name %></p> | ||
<p class="has-text-weight-semi-bold is-size-6"><%= "@#{@profile.handle}" %></p> | ||
</div> | ||
<div class="media-right"> | ||
<%= friendship_button(@profile) %> | ||
</div> | ||
</div> | ||
<div class="block"> | ||
<%= render 'events/list', events: @events %> | ||
<p><%= @profile.bio %></p> | ||
</div> | ||
<% end %> | ||
<div> | ||
</div> | ||
</div> | ||
<% if @profile.events.present? %> | ||
<div class="section"> | ||
<div class="container"> | ||
<div class="block"> | ||
<%= render 'events/list', events: @events %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
<div class="section"> | ||
<div class="container"> | ||
<%= buttons(@profile, include_nav: true) %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,14 @@ | |
|
||
require "rails_helper" | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the ProfilesHelper. For example: | ||
# | ||
# describe ProfilesHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# expect(helper.concat_strings("this","that")).to eq("this that") | ||
# end | ||
# end | ||
# end | ||
RSpec.describe ProfilesHelper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
describe "#profile_picture" do | ||
subject { helper.profile_picture(email) } | ||
|
||
let(:email) { " [email protected] " } | ||
|
||
it "chomps, lowercases, and hashes the email" do | ||
is_expected.to eq "https://gravatar.com/avatar/973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b?s=80&d=retro&r=pg" | ||
end | ||
end | ||
end |