Add gravatar to profile page. Attempt to make profile look nicer.
This commit is contained in:
parent
d504e5e914
commit
4e07bf00fd
6 changed files with 116 additions and 47 deletions
3
Gemfile
3
Gemfile
|
|
@ -146,3 +146,6 @@ gem 'omniauth-rails_csrf_protection'
|
||||||
|
|
||||||
# Role-based access
|
# Role-based access
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
|
|
||||||
|
# Gravatars
|
||||||
|
gem 'gravtastic'
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ GEM
|
||||||
sprockets-es6 (>= 0.9.0)
|
sprockets-es6 (>= 0.9.0)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
gravtastic (3.2.6)
|
||||||
guard (2.16.2)
|
guard (2.16.2)
|
||||||
formatador (>= 0.2.4)
|
formatador (>= 0.2.4)
|
||||||
listen (>= 2.7, < 4.0)
|
listen (>= 2.7, < 4.0)
|
||||||
|
|
@ -438,6 +439,7 @@ DEPENDENCIES
|
||||||
fastimage
|
fastimage
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
foundation-rails (~> 6.6)
|
foundation-rails (~> 6.6)
|
||||||
|
gravtastic
|
||||||
guard-minitest
|
guard-minitest
|
||||||
guard-rails
|
guard-rails
|
||||||
image_processing
|
image_processing
|
||||||
|
|
|
||||||
|
|
@ -611,3 +611,8 @@ a.black
|
||||||
.label.adminlabel.public { background-color: green !important};
|
.label.adminlabel.public { background-color: green !important};
|
||||||
.label.adminlabel.hidden { background-color: blue !important};
|
.label.adminlabel.hidden { background-color: blue !important};
|
||||||
.label.adminlabel.unapproved { background-color: orange !important};
|
.label.adminlabel.unapproved { background-color: orange !important};
|
||||||
|
|
||||||
|
.gravatar {
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,9 @@ class User < ApplicationRecord
|
||||||
# :github
|
# :github
|
||||||
]
|
]
|
||||||
|
|
||||||
|
include Gravtastic
|
||||||
|
gravtastic size: 120
|
||||||
|
|
||||||
# Return a human-friendly string describing the user's SSO provider
|
# Return a human-friendly string describing the user's SSO provider
|
||||||
def pretty_provider
|
def pretty_provider
|
||||||
case self.provider
|
case self.provider
|
||||||
|
|
@ -40,11 +43,24 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if a user has been created on-the-fly and is just an
|
def pretty_name
|
||||||
# anonymous user who uploaded a screenshot. They can turn this
|
if self.pseudo
|
||||||
# user record into a registered account though.
|
'Anonymous'
|
||||||
def is_anonymous?
|
elsif self.name?
|
||||||
self.provider == nil
|
self.name
|
||||||
|
else
|
||||||
|
'Dr. Who'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pretty_role
|
||||||
|
if self.pseudo
|
||||||
|
'Contributor'
|
||||||
|
elsif self.moderator_role
|
||||||
|
'Moderator'
|
||||||
|
elsif self.admin_role
|
||||||
|
'Admin'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.from_omniauth(auth)
|
def self.from_omniauth(auth)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
= render partial: 'menu'
|
= render partial: 'menu'
|
||||||
|
|
||||||
// Paginator and search bar
|
|
||||||
.grid-x
|
|
||||||
.small-6.medium-8.large-9.cell
|
|
||||||
// Paginator
|
|
||||||
= render(partial: 'packages/paginator', locals: {items: @logs})
|
|
||||||
|
|
||||||
/ .small-6.medium-4.large-3.cell
|
/ .small-6.medium-4.large-3.cell
|
||||||
/ // Search form
|
/ // Search form
|
||||||
/ = render 'packages/searchfield'
|
/ = render 'packages/searchfield'
|
||||||
|
|
||||||
- if @logs
|
- if @logs
|
||||||
|
// Paginator
|
||||||
|
.grid-x
|
||||||
|
.small-6.medium-8.large-9.cell
|
||||||
|
// Paginator
|
||||||
|
= render(partial: 'packages/paginator', locals: {items: @logs})
|
||||||
|
|
||||||
table
|
table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
|
|
@ -46,6 +47,12 @@
|
||||||
' -
|
' -
|
||||||
td #{log.ip_address}
|
td #{log.ip_address}
|
||||||
|
|
||||||
|
.grid-x
|
||||||
|
.small-6.medium-8.large-9.cell
|
||||||
|
// Paginator
|
||||||
|
= render(partial: 'packages/paginator', locals: {items: @logs})
|
||||||
|
|
||||||
|
|
||||||
- else
|
- else
|
||||||
p Nothing here.
|
p Nothing here.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,81 @@
|
||||||
|
|
||||||
= render partial: 'menu'
|
= render partial: 'menu'
|
||||||
|
|
||||||
h1 Your data
|
h1 Your data
|
||||||
|
|
||||||
- unless current_user.name.blank?
|
/ h2 Number of screenshots you uploaded
|
||||||
h2 Your name
|
/ p = current_user.screenshots.count
|
||||||
= current_user.name
|
|
||||||
|
|
||||||
- unless current_user.email.blank?
|
- if current_user.provider == 'salsa'
|
||||||
h2 Your email address
|
h1 Information for Debian project members
|
||||||
p = current_user.email
|
p
|
||||||
p.help-text
|
|
|
||||||
' This web site recognizes you by your email address.
|
You are recognized as a member of the Debian project.
|
||||||
' Don't worry - it will not be shown or given to anyone.
|
Thanks for visiting. Your account has moderation privileges.
|
||||||
|
That means you can approve screenshots uploaded by visitors.
|
||||||
|
If screenshots are waiting for moderation you will see a
|
||||||
|
prominent red bar right at the top. You can also upload your
|
||||||
|
own screenshots which are going public instantly.
|
||||||
|
If you stumble upon screenshots that you find offending,
|
||||||
|
misleading or just useless then feel free to hide them.
|
||||||
|
Every screenshot will have a status label and action buttons
|
||||||
|
that are only visible to you.
|
||||||
|
|
||||||
- unless current_user.provider.blank?
|
p
|
||||||
h2 Account provider
|
|
|
||||||
p You logged in using #{current_user.pretty_provider}.
|
If you have any questions about this web site please contact
|
||||||
|
Christoph Haas (haas) or Paul Wise (pabs).
|
||||||
|
|
||||||
h2 Number of screenshots you uploaded
|
|
||||||
p = current_user.screenshots.count
|
|
||||||
|
|
||||||
h2 Your permissions
|
.grid-x
|
||||||
ul
|
.cell.auto
|
||||||
- if can? :approve, Screenshot.new
|
.cell.small-8.card style="background-color: blue"
|
||||||
li
|
|
||||||
=> fa_icon 'thumbs-up'
|
.card
|
||||||
'approve uploaded screenshots
|
.grid-x.grid-padding-x.grid-padding-y.align-middle
|
||||||
- if can? :destroy, Screenshot.new
|
.cell.small-2
|
||||||
li
|
= image_tag current_user.gravatar_url, class: "gravatar"
|
||||||
=> fa_icon 'trash'
|
.cell.small-6
|
||||||
'delete screenshots
|
h3 = current_user.pretty_name
|
||||||
- if can? :hide, Screenshot.new
|
- unless current_user.email.blank?
|
||||||
li
|
div
|
||||||
=> fa_icon 'eye-slash'
|
i = current_user.email
|
||||||
'hide screenshots from the public
|
- unless current_user.provider.blank?
|
||||||
- if can? :unhide, Screenshot.new
|
div Logged in via #{current_user.pretty_provider}.
|
||||||
li
|
|
||||||
=> fa_icon 'eye'
|
.cell
|
||||||
'restore (unhide) screenshots for the public
|
hr
|
||||||
- if can? :view, Log
|
|
||||||
li
|
.card-section
|
||||||
=> fa_icon 'book'
|
h3 You are
|
||||||
'view logs
|
p
|
||||||
|
= current_user.pretty_role
|
||||||
|
|
||||||
|
.cell
|
||||||
|
hr
|
||||||
|
|
||||||
|
.card-section
|
||||||
|
h3 Your permissions
|
||||||
|
ul
|
||||||
|
- if can? :approve, Screenshot.new
|
||||||
|
li
|
||||||
|
=> fa_icon 'thumbs-up'
|
||||||
|
'approve uploaded screenshots
|
||||||
|
- if can? :destroy, Screenshot.new
|
||||||
|
li
|
||||||
|
=> fa_icon 'trash'
|
||||||
|
'delete screenshots
|
||||||
|
- if can? :hide, Screenshot.new
|
||||||
|
li
|
||||||
|
=> fa_icon 'eye-slash'
|
||||||
|
'hide screenshots from the public
|
||||||
|
- if can? :unhide, Screenshot.new
|
||||||
|
li
|
||||||
|
=> fa_icon 'eye'
|
||||||
|
'restore (unhide) screenshots for the public
|
||||||
|
- if can? :view, Log
|
||||||
|
li
|
||||||
|
=> fa_icon 'book'
|
||||||
|
'view logs
|
||||||
|
|
||||||
|
|
||||||
|
.cell.auto
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue