forked from coala/community
-
Notifications
You must be signed in to change notification settings - Fork 0
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 coala#260
- Loading branch information
Showing
5 changed files
with
262 additions
and
54 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,104 @@ | ||
.bottom-center { | ||
position: absolute; | ||
width: 100px; | ||
bottom: 2%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
|
||
.gamifier-details { | ||
max-width: 79%; | ||
display: flex; | ||
} | ||
|
||
.gamifier-details-part-1, | ||
.gamifier-details-part-2, | ||
.gamifier-details-part-3 { | ||
max-width: 44%; | ||
max-height: 80%; | ||
padding: 10px 5px; | ||
} | ||
|
||
.gamifier-card { | ||
width: 100%; | ||
min-height: 380px; | ||
} | ||
|
||
.gamifier-image { | ||
width: 20%; | ||
} | ||
|
||
.gamifier-image img{ | ||
width: 90%; | ||
margin-right: 0px; | ||
margin-left: 1%; | ||
min-width: 100px; | ||
|
||
} | ||
|
||
.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: 890px){ | ||
|
||
.gamifier-card { | ||
max-width: 100%; | ||
width: auto; | ||
margin: 10px; | ||
} | ||
|
||
.gamifier-details { | ||
max-width: 100%; | ||
padding: 0px 10px; | ||
} | ||
|
||
.gamifier-image { | ||
margin: auto; | ||
width: 35%; | ||
} | ||
|
||
.bottom-center { | ||
bottom: 2%; | ||
} | ||
|
||
@media only screen and (max-width: 526px){ | ||
|
||
.gamifier-details-part-3 { | ||
display: none; | ||
} | ||
|
||
.gamifier-details-part-1, | ||
.gamifier-details-part-2 { | ||
max-width: 50%; | ||
} | ||
|
||
.gamifier-image { | ||
width: 50%; | ||
} | ||
|
||
} | ||
} |
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,147 @@ | ||
<!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> | ||
{% 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 gamifier-image"> | ||
<img src="//github.com/{{ contributor.username }}.png/?size=400"> | ||
<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="gamifier-details" > | ||
<div class="gamifier-details-part-1 column-flex"> | ||
<div class="column-flex large-font gray-font-color"> | ||
<span> | ||
<b>Username:</b> | ||
{{ contributor.username }} | ||
</span> | ||
<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:":2" %} | ||
<span> | ||
<b>{{ forloop.counter }}.</b> {{ activity.name }}, on {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:":2" #} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% if contributor.activities.all|slice:"2:6" %} | ||
<div class="gamifier-details-part-2 column-flex large-font gray-font-color"> | ||
{% for activity in contributor.activities.all|slice:"2:6" %} | ||
<span> | ||
<b>{{ forloop.counter|add:2 }}.</b> {{ activity.name }}, on {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:"2:6" #} | ||
</div> | ||
{% endif %}{# if contributor.activities.all|slice:"2:6" #} | ||
|
||
{% if contributor.activities.all|slice:"6:10" %} | ||
<div class="gamifier-details-part-3 column-flex large-font gray-font-color"> | ||
{% for activity in contributor.activities.all|slice:"6:10" %} | ||
<span> | ||
<b>{{ forloop.counter|add:6 }}.</b> {{ activity.name }}, on: {{ activity.performed_at }} | ||
</span> | ||
{% endfor %}{# for activity in contributor.activities.all|slice:"6:10" #} | ||
</div> | ||
{% endif %}{# if contributor.activities.all|slice:"6:10" #} | ||
</div> | ||
<hr> | ||
{% endfor %}{# for participant in participants #} | ||
</ul> | ||
</body> | ||
</html> | ||
</div> | ||
{% endfor %}{# for contributor in gamification_results #} | ||
</div> | ||
|
||
{% endblock %} | ||
|