diff --git a/community/urls.py b/community/urls.py index 293e2a00..907426a4 100644 --- a/community/urls.py +++ b/community/urls.py @@ -11,7 +11,7 @@ from gci.feeds import LatestTasksFeed as gci_tasks_rss from twitter.view_twitter import index as twitter_index from ci_build.view_log import BuildLogsView -from data.views import index as contributors_index +from data.views import ContributorsListView from gamification.views import index as gamification_index from meta_review.views import index as meta_review_index from inactive_issues.inactive_issues_scraper import inactive_issues_json @@ -104,7 +104,7 @@ def get_organization(): distill_file='CI/Build/index.html', ), distill_url( - r'contributors/$', contributors_index, + r'contributors/$', ContributorsListView.as_view(), name='community-data', distill_func=get_index, distill_file='contributors/index.html', diff --git a/community/views.py b/community/views.py index 81f82e02..8e691fee 100644 --- a/community/views.py +++ b/community/views.py @@ -9,9 +9,6 @@ from .git import ( get_org_name, get_remote_url - get_owner, - get_upstream_deploy_url, - get_remote_url ) from data.models import Team from gamification.models import Participant as GamificationParticipant diff --git a/data/urls.py b/data/urls.py index a3780aa2..6eb2a98a 100644 --- a/data/urls.py +++ b/data/urls.py @@ -1,7 +1,7 @@ from django.conf.urls import url -from . import views +from .views import ContributorsListView urlpatterns = [ - url(r'^$', views.index, name='index'), + url(r'^$', ContributorsListView.as_view(), name='index'), ] diff --git a/data/views.py b/data/views.py index 40436c72..53cd8a3e 100644 --- a/data/views.py +++ b/data/views.py @@ -1,8 +1,16 @@ +from django.views.generic import TemplateView + +from community.views import get_header_and_footer from data.models import Contributor -from django.shortcuts import render -def index(request): - contributors = Contributor.objects.all() - args = {'contributors': contributors} - return render(request, 'contributors.html', args) +class ContributorsListView(TemplateView): + template_name = 'contributors.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context = get_header_and_footer(context) + contrib_objects = Contributor.objects.all() + context['contributors'] = contrib_objects.order_by('-num_commits', + 'name') + return context diff --git a/static/css/contributors.css b/static/css/contributors.css new file mode 100644 index 00000000..b7dd1a9b --- /dev/null +++ b/static/css/contributors.css @@ -0,0 +1,64 @@ +.commits, +.reviews, +.issues-opened { + padding: 0px 5px; +} + +.contributions { + margin: 10px; +} + +.contributions p { + margin: 0px; +} + +.contributors-cards { + display: flex; + justify-content: space-evenly; + flex-flow: row wrap; + margin: 50px; +} + +.contributor-card { + background-color: #efefef; + box-shadow: 0px 0px 25px 2px black; + border-radius: 30px; + margin: 0px 15px 20px 15px; + width: 220px; + border: 5px #c0c5d1 solid; +} + +.contributors-section .fa-close { + display: none; +} + +.contributor-details { + text-align: center; +} + +.contributor-image img { + border-radius: 30px 30px 0px 0px; + width: 210px; +} + +.form-fields { + margin-top: 3%; + width: 40%; + min-width: 300px; +} + +.search-results { + width: 100%; + background-color: transparent; + border-radius: 30px; + overflow: auto; + padding: 0px 20px; + max-height: 150px; + display: none; +} + +.side-border { + border-width: 0px 0px 0px 1px; + border-color: darkgray; + border-style: solid; +} diff --git a/static/js/contributors.js b/static/js/contributors.js new file mode 100644 index 00000000..a6164024 --- /dev/null +++ b/static/js/contributors.js @@ -0,0 +1,64 @@ +$(document).ready(function(){ + var search_input = $('#search'); + var close_icon = $('.contributors-section .fa-close'); + var results_body = $('.search-results-tbody'); + var searched_keyword = null; + + function appendChildren(element, username, el_result_value, + hide_all_contributors){ + var result_td = $('
+ Contributor's who've been putting their hard-work to make {{ org.name }} best of its + own. Thanks to all contributors to make {{ org.name }} what is it today. +
+Search Results | +
---|
+ No results found! + | +
{{ contributor.num_commits }}
+Commits
+{{ contributor.reviews }}
+Reviews
+{{ contributor.issues_opened }}
+Issues
+