Skip to content

Commit

Permalink
add hackathon projects to profile (#5802)
Browse files Browse the repository at this point in the history
  • Loading branch information
octavioamu authored and danlipert committed Jan 15, 2020
1 parent cc3dec8 commit 9e35a0d
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/dashboard/templates/ftux/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h2 class="text-center">{% trans "Job Opportunities" %}</h2>
<div class="col-12 font-body mt-4">
<label class="form__label label d-block" for="linkedinUrl">{% trans "Linkedin profile" %}</label>
<div class="d-flex align-items-center">
<span>https://www.linkedin.com/in/</span><input name="linkedinUrl" id="linkedinUrl" value="{{profile.linkedin_url}}" class="form__input" type="text" placeholder="username" />
<span>https://www.linkedin.com/in/</span><input name="linkedinUrl" id="linkedinUrl" value="{% firstof profile.linkedin_url or '' %}" class="form__input" type="text" placeholder="username" />
</div>
</div>

Expand Down
101 changes: 101 additions & 0 deletions app/dashboard/templates/profiles/tab_hackathons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{% load i18n static %}

<style>

.card-bg {
padding: 1em;
background-size: cover;
}

.project-grid {
display: grid;
grid-template-columns: repeat(1, 1fr);
grid-gap: 5rem 3rem;
}

.card-project {
/* padding: 2em; */
text-align: center;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.card-badge {
right: 1em;
top: 1em;
filter: drop-shadow(0 0.3rem 0.2rem rgba(0,0,0,0.25));
width: 4em;
}

.card-project-logo {
background-color: rgba(255, 255, 255, 0.30);
object-fit: contain;
}

@media (min-width: 768px) {
.project-grid {
grid-template-columns: repeat(2, 1fr);
}
}

@media (min-width: 992px) {
.project-grid {
grid-template-columns: repeat(2, 1fr);
}
}

@media (min-width: 1200px) {
.project-grid {
grid-template-columns: repeat(3, 1fr);
}
}

</style>
<div class="project-grid">

{% for project in projects %}
<div class="card card-project">
{% if project.badge %}
<img class="position-absolute card-badge" width="50" src="{{project.badge}}" alt="badge" />
{% endif %}

<div class="card-bg rounded-top" style="background-image: url({% firstof project.profiles.first.profile_wallpaper or '/static/wallpapers/burst-pink.png' %})">
{% if project.logo %}
<img class="card-project-logo m-auto mw-100 rounded shadow" height="200" width="200" src="{{MEDIA_URL}}{{project.logo}}" alt="Hackathon logo" />
{% else %}
<img class="card-project-logo m-auto mw-100 rounded shadow" height="200" width="200" src="{{ project.bounty.avatar_url }}" alt="{{project.bounty.org_name}}" />
{% endif %}
</div>
<div class="card-body">
<h5 class="card-title text-uppercase">{{ project.name }}</h5>
<a href="{{project.work_url}}" target="_blank" class="font-weight-bold card-subtitle">Project Home</a>
<div class="my-2">
<b class="text-muted">Project Summary</b>
<p>
{{project.summary | truncatechars:90}}
</p>
</div>
<div class="mb-2">
<b class="text-muted">Team Members</b>
<div class="mt-1">
{% for profile in project.profiles.all %}
<a href="{% url 'profile' profile %}" class="">
<img src="{{profile.avatar_url}}" alt="{{profile}}" title="@{{profile}}" width="30" height="30" class="rounded-circle">
</a>
{% endfor %}
</div>
</div>
<div class="mb-2">
<a href="{{project.bounty.url}}">Prize Bounty</a>
</div>
<div class="font-smaller-2">
<b class="text-muted">Sponsor</b>
<img class="" width="20" src="{{ project.bounty.avatar_url }}" alt="{{project.bounty.org_name}}" />
<a href="{% url 'profile' project.bounty.org_name %}">{{project.bounty.org_name}}</a>
</div>
<div class="font-smaller-2">
<a href="{% url 'hackathon' project.bounty.event.slug %}" class="uppercase">{{project.bounty.event.name}}</a>
</div>
</div>
</div>
{% endfor %}
</div>
14 changes: 12 additions & 2 deletions app/dashboard/templates/profiles/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,17 @@
</li>
{% endif %}
{% if not profile.is_org or total_kudos_count %}
<li class="nav-item">
<a class="nav-link nav-line {% if tab == 'kudos' %}active{% endif %}" href="{{profile.url}}/kudos">
Kudos {% if total_kudos_count %}<span>{{total_kudos_count}}</span>{% endif %}
</a>
</li>
{% endif %}
{% if projects_count %}
<li class="nav-item">
<a class="nav-link nav-line {% if tab == 'kudos' %}active{% endif %}" href="{{profile.url}}/kudos">
Kudos {% if total_kudos_count %}<span>{{total_kudos_count}}</span>{% endif %}
<a class="nav-link nav-line {% if tab == 'hackathons' %}active{% endif %}" href="{{profile.url}}/hackathons">
Hackathons
{% if projects_count %}<span>{{projects_count}}</span>{% endif %}
</a>
</li>
{% endif %}
Expand Down Expand Up @@ -146,6 +154,8 @@
{% include 'profiles/tab_grant_contribs.html' %}
{% elif tab == 'quests' %}
{% include 'profiles/tab_quests.html' %}
{% elif tab == 'hackathons' %}
{% include 'profiles/tab_hackathons.html' %}
{% endif %}
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2502,6 +2502,7 @@ def get_profile_tab(request, profile, tab, prev_context):
active_bounties = active_bounties.order_by('-web3_created')
context['active_bounties_count'] = active_bounties.count()
context['portfolio_count'] = len(context['portfolio']) + profile.portfolio_items.count()
context['projects_count'] = HackathonProject.objects.filter( profiles__id=profile.id).count()
context['my_kudos'] = profile.get_my_kudos.distinct('kudos_token_cloned_from__name')[0:7]

# specific tabs
Expand Down Expand Up @@ -2605,6 +2606,8 @@ def get_profile_tab(request, profile, tab, prev_context):
pass
elif tab == 'people':
pass
elif tab == 'hackathons':
context['projects'] = HackathonProject.objects.filter( profiles__id=profile.id)
elif tab == 'quests':
context['quest_wins'] = profile.quest_attempts.filter(success=True)
elif tab == 'grants':
Expand Down Expand Up @@ -2718,7 +2721,7 @@ def profile(request, handle, tab=None):
handle = handle.replace("@", "")

# make sure tab param is correct
all_tabs = ['active', 'ratings', 'portfolio', 'viewers', 'activity', 'resume', 'kudos', 'earnings', 'spent', 'orgs', 'people', 'grants', 'quests', 'tribe']
all_tabs = ['active', 'ratings', 'portfolio', 'viewers', 'activity', 'resume', 'kudos', 'earnings', 'spent', 'orgs', 'people', 'grants', 'quests', 'tribe', 'hackathons']
tab = default_tab if tab not in all_tabs else tab
if handle in all_tabs and request.user.is_authenticated:
# someone trying to go to their own profile?
Expand Down

0 comments on commit 9e35a0d

Please sign in to comment.