diff --git a/community/urls.py b/community/urls.py index a171c0e8..42384cb3 100644 --- a/community/urls.py +++ b/community/urls.py @@ -11,7 +11,7 @@ from gci.feeds import LatestTasksFeed as gci_tasks_rss from ci_build.view_log import BuildLogsView from data.views import ContributorsListView -from gamification.views import index as gamification_index +from gamification.views import GamificationResults from meta_review.views import ContributorsMetaReview from inactive_issues.inactive_issues_scraper import inactive_issues_json from openhub.views import index as openhub_index @@ -193,7 +193,7 @@ def get_organization(): distill_file='static/unassigned-issues.json', ), distill_url( - r'gamification/$', gamification_index, + r'gamification/$', GamificationResults.as_view(), name='community-gamification', distill_func=get_index, distill_file='gamification/index.html', diff --git a/gamification/tests/test_views.py b/gamification/tests/test_views.py index 64e270c7..fa7a1a22 100644 --- a/gamification/tests/test_views.py +++ b/gamification/tests/test_views.py @@ -25,4 +25,4 @@ def test_view_uses_correct_template(self): def test_all_contributors_on_template(self): resp = self.client.get(reverse('community-gamification')) self.assertEqual(resp.status_code, 200) - self.assertTrue(len(resp.context['participants']) == 10) + self.assertTrue(len(resp.context['gamification_results']) == 10) diff --git a/gamification/views.py b/gamification/views.py index 25b14243..d006b231 100644 --- a/gamification/views.py +++ b/gamification/views.py @@ -1,10 +1,14 @@ -from django.shortcuts import render +from django.views.generic import TemplateView +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) + context['gamification_results'] = Participant.objects.all() + return context diff --git a/static/css/gamification.css b/static/css/gamification.css new file mode 100644 index 00000000..30c8edcd --- /dev/null +++ b/static/css/gamification.css @@ -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: 0; + 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: 0 0 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: 0 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%; + } + + } +} diff --git a/templates/gamification.html b/templates/gamification.html index 48becb65..eec292fa 100644 --- a/templates/gamification.html +++ b/templates/gamification.html @@ -1,50 +1,146 @@ - - -
- - - - - -Note: All the datetime is in UTC
-