Skip to content

Commit

Permalink
Merge pull request #3871 from gitcoinco/verified-profile
Browse files Browse the repository at this point in the history
Adds profile verification
  • Loading branch information
octavioamu authored Mar 5, 2019
2 parents 8b7a791 + 635c3d6 commit cf9c4d2
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 161 deletions.
115 changes: 82 additions & 33 deletions app/assets/v2/css/profile.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@
min-height: 150px;
}

.profile-header > .container {
padding-top: 3.5rem;
color: #fff;
.overflow-visible {
overflow: visible;
}

.profile-card {
background: white;
border-radius: 5px;
z-index: 1;
position: relative;
padding: 2rem;
}

.profile-header__avatar {
float: left;
width: 6.75rem;
height: 6.75rem;
border-radius: 50%;
border: 0.2rem solid #1AB56D;
}

.profile-header__handle {
padding-top: 1.5rem;
padding-top: 0.8rem;
margin-bottom: 0;
text-transform: uppercase;
line-height: 1;
font-weight: 700;
font-size: 1.7rem;
}

.profile-header__handle small {
Expand All @@ -39,17 +46,17 @@
padding: 0;
}

.profile-header__links a i {
.profile-header__links a {
margin-left: 2px;
margin-right: 2px;
font-size: 1.2rem;
transition: all 0.3s;
color: #FFF;
color: #000;
text-decoration: none;
}

.profile-header__links a:hover i {
color: #1AB56D;
transform: scale(1.5) rotate(360deg);
}

.profile-header__links img {
Expand Down Expand Up @@ -97,21 +104,31 @@
}
}

@media (min-width: 388px) {
.profile-card {
margin-top: -5rem;
}
}


.profile-header__stats {
background-color: transparent;
border: none;
}

.profile-header__stats .card-header {
padding: 0.1rem 0.7rem;
font-weight: bolder;
color: #0D0764;
text-transform: uppercase;
color: #666;
border-radius: 0;
border-bottom: none;
font-size: 1.2rem;
}

.profile-header__stats .card-header b {
color: #000;
font-size: 1.7rem;
}

.profile-header__stats .card-body {
font-weight: lighter;
padding: 0.7rem;
}

Expand Down Expand Up @@ -141,28 +158,55 @@
margin-top: 0;
}

.profile-header__stats--contributor {
border: 0.2rem solid #25E899;
.profile-header__stats--contributor .card-header {
background-color: transparent;
}

.profile-header__stats--contributor .card-header {
background-color: #25E899;
.card-header::after {
content: '';
position: relative;
height: 4px;
width: 100%;
display: block;
border-radius: 6px;
animation: grow 1s ease-in-out;
}

.profile-header__stats--contributor .highlight {
color: #25E899;
.animate-verify {
animation: verify 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.profile-header__stats--funder {
border: 0.2rem solid #FFCE08;
@keyframes grow {
0% {
width: 2%;
}
50% {
width: 2%;
}
100% {
width: 100%;
}
}

.profile-header__stats--funder .card-header {
background-color: #FFCE08;
@keyframes verify {
0% {
transform: scale(1.5, 1.3);
}
100% {
transform: scale(1);
}
}

.profile-header__stats--contributor .card-header::after {
background: #00eb93;
}

.profile-header__stats--funder .highlight {
color: #FFCE08;
.profile-header__stats--funder .card-header::after {
background: #FFCE08;
}

.profile-header__stats--funder .card-header {
background-color: transparent;
}

.profile-section-title {
Expand Down Expand Up @@ -238,14 +282,19 @@
.profile_details .works_with_list img {
max-width: 30px;
border-radius: 50%;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.10);
}

.profile-header__stats--contributor .works_with_list img {
border: 0.1rem solid #25E899;
}

.profile-header__stats--funder .works_with_list img {
border: 0.1rem solid #FFCE08;
.profile_details .works_with_list .plus-img{
width: 30px;
height: 30px;
display: inline-flex;
background: #F8F9FA;
border-radius: 30px;
align-items: center;
vertical-align: middle;
font-size: 10px;
justify-content: center;
}

.no-profile-button {
Expand All @@ -256,4 +305,4 @@

.no-profile-textcolor {
color: #666666;
}
}
1 change: 1 addition & 0 deletions app/assets/v2/images/badge-verify.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 0 additions & 42 deletions app/assets/v2/js/pages/profile.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,4 @@
$(document).ready(function() {
$('[data-toggle=popover]').popover({
html: true,
trigger: 'focus',
template: '<div class="popover wallet-popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',
content: function() {
var content = $(this).attr('data-popover-content');

return $(content).children('.popover-body').html();
},
title: function() {
var title = $(this).attr('data-popover-content');

return $(title).children('.popover-heading').html();
}
});

if (!document.hasPreferredPayoutAddress) {
$('[data-toggle=popover]').popover('show');
}

$('body').on('submit', '#form-wallets', function(e) {
e.preventDefault();

var data = $('#form-wallets').serializeArray();

data.push({'page': 2});

var postWallets = fetchData(
e.currentTarget.action,
e.currentTarget.method,
data
);

$.when(postWallets).then(function(response) {
var walletAddress = response.wallets[0];
var newAddress = new truncate(walletAddress);

$('#preferred-address').text(newAddress.elem);
$('#preferred-address').prop('title', walletAddress);
$('#kudos-section').html(response.kudos_html);
});
});

$('#kudos-section').on('click keypress', '.flip-card', e => {
if ($(e.target).is('a')) {
Expand Down
2 changes: 2 additions & 0 deletions app/dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .models import (
Activity, BlockedUser, Bounty, BountyFulfillment, BountySyncRequest, CoinRedemption, CoinRedemptionRequest,
Interest, LabsResearch, Profile, SearchHistory, Tip, TokenApproval, Tool, ToolVote, UserAction,
UserVerificationModel,
)


Expand Down Expand Up @@ -174,3 +175,4 @@ def network_link(self, instance):
admin.site.register(Tool, ToolAdmin)
admin.site.register(ToolVote, ToolVoteAdmin)
admin.site.register(LabsResearch)
admin.site.register(UserVerificationModel)
35 changes: 35 additions & 0 deletions app/dashboard/migrations/0015_auto_20190301_1625.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 2.1.7 on 2019-03-01 16:25

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import economy.models


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('dashboard', '0014_merge_20190221_2246'),
]

operations = [
migrations.CreateModel(
name='UserVerificationModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_on', models.DateTimeField(db_index=True, default=economy.models.get_time)),
('modified_on', models.DateTimeField(default=economy.models.get_time)),
('verified', models.BooleanField(default=False, help_text="Select to display the Verified checkmark on the user's profile")),
('speedy_and_responsive', models.BooleanField(default=False)),
('great_communication', models.BooleanField(default=False)),
('bug_free_code', models.BooleanField(default=False)),
('completed_x_bounties', models.BooleanField(default=False)),
('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]
30 changes: 30 additions & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,31 @@ def __str__(self):
return self.title


class UserVerificationModel(SuperModel):
"""Define the checkboxes for user verification."""

user = models.OneToOneField(User, on_delete=models.SET_NULL, null=True, blank=True)
verified = models.BooleanField(
default=False,
help_text='Select to display the Verified checkmark on the user\'s profile',
)
speedy_and_responsive = models.BooleanField(
default=False,
)
great_communication = models.BooleanField(
default=False,
)
bug_free_code = models.BooleanField(
default=False,
)
completed_x_bounties = models.BooleanField(
default=False,
)

def __str__(self):
return f"User: {self.user}; Verified: {self.verified}"


class ProfileQuerySet(models.QuerySet):
"""Define the Profile QuerySet to be used as the objects manager."""

Expand Down Expand Up @@ -1813,6 +1838,11 @@ def get_sent_kudos(self):

return kudos_transfers

@property
def get_my_verified_check(self):
verification = UserVerificationModel.objects.filter(user=self.user).first()
return verification

@property
def get_profile_referral_code(self):
return base64.urlsafe_b64encode(self.handle.encode()).decode()
Expand Down
20 changes: 10 additions & 10 deletions app/dashboard/templates/profiles/organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n static %}
{% load i18n static avatar_tags %}
<div class="col-12 col-lg-4">
<div class="profile-header__stats profile-header__stats--contributor card mb-4">
<div class="card-header font-subheader">
{% trans "Organization" %}
<b>#{{ scoreboard_position_org }}</b> {% trans "Organization" %}
</div>
<div class="card-body font-subheader">
<ul>
<li><span class="highlight">{{ count_bounties_on_repo }}</span> {% trans "bounties" %}</li>
<li><span class="highlight">{{ sum_eth_on_repos|floatformat:2 }}</span> {% trans "ETH" %}</li>
{% if scoreboard_position_org %}
<li><span class="highlight">#{{ scoreboard_position_org }}</span> {% trans "org" %}</li>
{% endif %}
<li><b>{{ count_bounties_on_repo }}</b> {% trans "bounties" %}</li>
<li><b>{{ sum_eth_on_repos|floatformat:2 }}</b> {% trans "ETH" %}</li>
<li class="works_with_list">
{% if works_with_org|length != 0 %}
<span class="font-body">( <i class="fa fa-code"></i> ) {% trans "Contributors" %}:</span>
{% for profile, num_times in works_with_org.items %}
<span class="font-body"><i class="fa fa-code"></i> {% trans "Contributors" %}:</span>
{% for profile, num_times in works_with_org.items|slice:":5" %}
<a href="{% url 'profile' profile %} ">
<img src='{% if profile.avatar and profile.avatar.svg %}{{ profile.avatar.svg.url }}{% else %}/dynamic/avatar/{{ profile }}{% endif %}' title="<div class='tooltip-info tooltip-xs'>{{ profile }}: {{ num_times }} times</div>">
<img src='{% avatar_url profile %}' title="<div class='tooltip-info tooltip-xs'>{{ profile }}: {{ num_times }} times</div>">
</a>
{% endfor %}
{% if works_with_org|length > 5 %}
<div href="" class="plus-img" data-container="body" data-toggle="popover" data-html="true" data-placement="bottom" data-trigger="hover click" data-content='{% for profile in works_with_org.items|slice:"5:" %}<a href="{% url "profile" profile %}"><img src="{% avatar_url profile %}"/></a>{% endfor %}'><span>+10</span></div>
{% endif %}
{% endif %}
</li>
</ul>
Expand Down
Loading

0 comments on commit cf9c4d2

Please sign in to comment.