-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The redesigned webpages provides a enhanced UI/UX design to web-page with additional functionality of searching the contributors. Closes #260
- Loading branch information
Showing
5 changed files
with
226 additions
and
56 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,10 +1,17 @@ | ||
from django.shortcuts import render | ||
from django.views.generic import TemplateView | ||
from django.db.models import Q | ||
|
||
from community.views import get_header_and_footer | ||
from gamification.models import Participant | ||
|
||
|
||
def index(request): | ||
Participant.objects.filter(username__startswith='testuser').delete() | ||
participants = Participant.objects.all() | ||
args = {'participants': participants} | ||
return render(request, 'gamification.html', args) | ||
class GamificationResults(TemplateView): | ||
template_name = 'gamification.html' | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super().get_context_data(**kwargs) | ||
context = get_header_and_footer(context) | ||
participants = Participant.objects.all().exclude( | ||
Q(username__startswith='testuser')) | ||
context['gamification_results'] = participants | ||
return context |
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.bottom-center { | ||
position: absolute; | ||
bottom: 2%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
|
||
.contributor-details-part-1, | ||
.contributor-details-part-2, | ||
.contributor-details-part-3 { | ||
width: 25%; | ||
max-height: 80%; | ||
overflow: auto; | ||
overflow-wrap: break-word; | ||
} | ||
|
||
.contributor-details-part-3 { | ||
padding-left: 5px; | ||
border-left: 1px #37474f solid; | ||
} | ||
|
||
.gamifier-card { | ||
width: 100%; | ||
min-height: 380px; | ||
} | ||
|
||
.github-icon { | ||
color: white; | ||
background-color: black; | ||
border-radius: 100px; | ||
} | ||
|
||
.gitlab-icon { | ||
color: #e33834; | ||
border-radius: 100px; | ||
} | ||
|
||
.filter-btn { | ||
width: 107px; | ||
margin-top: 3%; | ||
margin-left: 3%; | ||
} | ||
|
||
.filter-btn .btn { | ||
text-transform: none; | ||
border-radius: 100px; | ||
box-shadow: 0px 0px 25px 2px black; | ||
} | ||
|
||
.social-icons { | ||
font-size: 1.5em; | ||
} | ||
|
||
@media only screen and (max-width: 1107px){ | ||
.contributor-details-part-2 { | ||
width: 29%; | ||
} | ||
.contributor-details-part-3 { | ||
display: none; | ||
} | ||
@media only screen and (max-width: 693px){ | ||
.contributor-details-part-1, | ||
.contributor-details-part-2 { | ||
width: 31%; | ||
} | ||
|
||
.bottom-center { | ||
bottom: -57%; | ||
} | ||
} | ||
} |
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,50 +1,142 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<title>Newcomers Data</title> | ||
</head> | ||
<body> | ||
<h1>The gamification leaderboard</h1> | ||
<p>Note: All the datetime is in UTC</p> | ||
<hr> | ||
<ul> | ||
{% for participant in participants %} | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-6 col-md-4"> | ||
<div class="thumbnail"> | ||
<div class="caption"> | ||
<p>Username: {{ participant.username }}</p> | ||
<p><a href="//github.com/{{ participant.username }}"> | ||
GitHub Profile</a></p> | ||
<p><a href="//gitlab.com/{{ participant.username }}"> | ||
GitLab Profile</a></p> | ||
<p><a href="//www.openhub.net/accounts/{{ participant.username }}">OpenHub Profile</a></p> | ||
<p>Score: {{ participant.score }}</p> | ||
<p>Level: {{ participant.level.name }}</p> | ||
<p>Activities Performed: | ||
{% for activity in participant.activities.all %} | ||
<p>{{ forloop.counter }}. {{ activity.name }}, performed_at: | ||
{{ activity.performed_at }} updated_at: {{ activity.updated_at }} | ||
</p> | ||
{% endfor %}{# for activity in participant.activities.all #} | ||
<p>Badges Earned: | ||
{% for badge in participant.badges.all %} | ||
<p>{{ forloop.counter }}.{{ badge.name }}</p> | ||
{% endfor %}{# for badge in participant.badges.all #} | ||
</p> | ||
</div> | ||
</div> | ||
{% extends 'base.html' %} | ||
{% load staticfiles %} | ||
{% block title %} | ||
Community | Gamification Leaderboard | ||
{% endblock %} | ||
|
||
{% block add_css_files %} | ||
<link rel="stylesheet" href="{% static 'css/contributors.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/meta-reviewers.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/gamification.css' %}"> | ||
{% endblock %} | ||
|
||
{% block add_js_files %} | ||
<script src="{% static 'js/contributors.js' %}"></script> | ||
<script src="{% static 'js/gamification.js' %}"></script> | ||
{% endblock %} | ||
|
||
{% block main-content %} | ||
|
||
<div class="web-page-details apply-flex center-content"> | ||
<h3 style="padding-right: 15px">~</h3> | ||
<h3 class="page-name"> | ||
Contributors Gamification Leaderboard | ||
</h3> | ||
<h3 style="padding-left: 15px">~</h3> | ||
</div> | ||
|
||
<div class="apply-flex center-content"> | ||
<p class="container web-page-description"> | ||
The leaderboard is based upon the gamification system which automates the | ||
recognition of activities performed by community contributors. Based on activities | ||
performed, various parameters are calculated. | ||
</p> | ||
</div> | ||
|
||
<div class="contributors-section apply-flex center-content"> | ||
<div class="form-fields"> | ||
<form> | ||
<div class="input-field apply-flex center-content search-field"> | ||
<i class="fa fa-search social-icons"></i> | ||
<input id="search" type="search" autocomplete="off" placeholder="Search by username or name" required> | ||
<i class="fa fa-close social-icons"></i> | ||
</div> | ||
</form> | ||
<div class="search-results"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Search Results</th> | ||
</tr> | ||
</thead> | ||
<tbody class="search-results-tbody large-font"> | ||
<tr> | ||
<td> | ||
No results found! | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="contributors-cards column-flex"> | ||
{% for contributor in gamification_results %} | ||
<div class="contributor-card meta-reviewer gamifier-card apply-flex" login="{{ contributor.username }}"> | ||
<div class="contributor-image meta-reviewer-image"> | ||
<img src="//github.com/{{ contributor.username }}.png/?size=210"> | ||
<div class="bottom-center large-font bold-text social-links"> | ||
<a href="//github.com/{{ contributor.username }}" target="_blank"> | ||
<i class="fa fa-github github-icon social-icons" aria-hidden="true"></i> | ||
</a> | ||
<a href="//gitlab.com/{{ contributor.username }}" target="_blank"> | ||
<i class="fa fa-gitlab social-icons gitlab-icon" aria-hidden="true"></i> | ||
</a> | ||
<a href="//www.openhub.net/accounts/{{ contributor.username }}" target="_blank" class="social-icons">OH</a> | ||
</div> | ||
</div> | ||
<div class="contributor-details-part-1 column-flex"> | ||
<span class="bold-text large-font"> | ||
{{ contributor.username }} | ||
</span> | ||
<div class="column-flex large-font gray-font-color"> | ||
<span> | ||
<b>Score:</b> | ||
{{ contributor.score }} | ||
</span> | ||
<span> | ||
<b>Level:</b> | ||
{{ contributor.level.name }} | ||
</span> | ||
<div> | ||
{% if contributor.badges.all %} | ||
<b>Badges Earned:</b> | ||
<div class="column-flex"> | ||
{% for badge in contributor.badges.all %} | ||
<span> | ||
<b>-></b> | ||
{{ badge.name }} | ||
</span> | ||
{% endfor %}{# for badge in contributor.badges.all #} | ||
</div> | ||
{% else %}{# if contributor.badges.all #} | ||
<span> | ||
<b>No badges earned!<i class="fa fa-frown-o"></i></b> | ||
</span> | ||
{% endif %}{# if contributor.badges.all #} | ||
</div> | ||
<div class="column-flex"> | ||
<b>Some Activities permormed:</b> | ||
{% for activity in contributor.activities.all|slice:":1" %} | ||
<span> | ||
<b>{{ forloop.counter }}.</b> {{ activity.name }}, performed-on: {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:":1" #} | ||
</div> | ||
</div> | ||
<hr> | ||
{% endfor %}{# for participant in participants #} | ||
</ul> | ||
</body> | ||
</html> | ||
</div> | ||
{% if contributor.activities.all|slice:"1:4" %} | ||
<div class="contributor-details-part-2 column-flex large-font gray-font-color"> | ||
{% for activity in contributor.activities.all|slice:"1:4" %} | ||
<span> | ||
<b>{{ forloop.counter|add:1 }}.</b> {{ activity.name }}, performed-on: {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:"1:4" #} | ||
</div> | ||
{% endif %}{# if contributor.activities.all|slice:"1:4" #} | ||
{% if contributor.activities.all|slice:"4:7" %} | ||
<div class="contributor-details-part-3 column-flex large-font gray-font-color"> | ||
{% for activity in contributor.activities.all|slice:"4:7" %} | ||
<span> | ||
<b>{{ forloop.counter|add:4 }}.</b> {{ activity.name }}, performed-on: {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:"4:7" #} | ||
</div> | ||
{% endif %}{# if contributor.activities.all|slice:"4:7" #} | ||
</div> | ||
{% endfor %}{# for contributor in gamification_results #} | ||
</div> | ||
|
||
{% endblock %} | ||
|