mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Add gravatar picture to header
This commit is contained in:
@@ -4,4 +4,8 @@
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 920px;
|
max-width: 920px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gravatar {
|
||||||
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
@@ -9,4 +9,14 @@
|
|||||||
font-size: 18pt;
|
font-size: 18pt;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
.fullname {
|
||||||
|
vertical-align: middle;
|
||||||
|
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-toggle::after {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ class User < ApplicationRecord
|
|||||||
self.role ||= :user
|
self.role ||= :user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gravatar_url
|
||||||
|
gravatar_id = Digest::MD5::hexdigest(email.downcase)
|
||||||
|
"https://secure.gravatar.com/avatar/#{gravatar_id}"
|
||||||
|
end
|
||||||
|
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :validatable,
|
:recoverable, :rememberable, :validatable,
|
||||||
:confirmable
|
:confirmable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
<h2>Profile settings</h2>
|
||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
@@ -11,6 +11,9 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label :email %>
|
<%= f.label :email %>
|
||||||
<%= f.email_field :email, autocomplete: "email", class: "form-control" %>
|
<%= f.email_field :email, autocomplete: "email", class: "form-control" %>
|
||||||
|
<small id="emailGravatarHelp" class="form-text text-muted">
|
||||||
|
the email is <a href="https://gravatar.com">gravatar</a>ized
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||||
@@ -53,5 +56,3 @@
|
|||||||
<h3>Cancel my account</h3>
|
<h3>Cancel my account</h3>
|
||||||
|
|
||||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger" %></p>
|
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger" %></p>
|
||||||
|
|
||||||
<%= link_to "Back", :back %>
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
|
<%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
|
||||||
<% if @minimum_password_length %>
|
<% if @minimum_password_length %>
|
||||||
<small id="passwordHelp" class="form-text text-muted">
|
<small id="passwordHelp" class="form-text text-muted">
|
||||||
(<%= @minimum_password_length %> characters minimum)
|
<%= @minimum_password_length %> characters minimum
|
||||||
</small>
|
</small>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-light">
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<%= link_to "Astuto", "#", class: "navbar-brand" %>
|
<%= link_to "Astuto", root_path, class: "navbar-brand" %>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<%= current_user.full_name %>
|
<%= image_tag(current_user.gravatar_url, class: "gravatar", alt: current_user.full_name, size: 24) %>
|
||||||
|
<span class="fullname"><%= current_user.full_name %></span>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
<%= link_to "Profile settings", edit_user_registration_path, class: "dropdown-item" %>
|
<%= link_to "Profile settings", edit_user_registration_path, class: "dropdown-item" %>
|
||||||
|
|||||||
Reference in New Issue
Block a user