diff --git a/community/forms.py b/community/forms.py new file mode 100644 index 00000000..c109f7ff --- /dev/null +++ b/community/forms.py @@ -0,0 +1,82 @@ +from django import forms + + +class JoinCommunityForm(forms.Form): + + github_username = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput( + attrs={ + 'placeholder': 'Make sure to NOT enter your github profile url', + 'autocomplete': 'off' + } + ) + ) + gh_first_repo = forms.URLField( + required=False, label='GitHub Personal Repository', + widget=forms.URLInput( + attrs={ + 'placeholder': 'A valid github url of your personal repository', + 'autocomplete': 'off' + } + ) + ) + gh_git_training_exercise = forms.URLField( + required=False, label='From which GitHub repository you have done git' + ' training?', + widget=forms.URLInput( + attrs={ + 'placeholder': 'A valid github url of git training repository', + 'autocomplete': 'off' + } + ) + ) + gh_most_contributed_repo = forms.URLField( + required=False, + label="GitHub Repository to which you've contributed most!", + widget=forms.URLInput( + attrs={ + 'placeholder': 'A valid github public repository url', + 'autocomplete': 'off' + } + ) + ) + + gitlab_user_id = forms.IntegerField( + label='GitLab User ID', + widget=forms.NumberInput( + attrs={ + 'placeholder': 'Make sure to NOT enter your gitlab profile url', + 'autocomplete': 'off' + } + ) + ) + gl_first_repo_id = forms.IntegerField( + required=False, label='GitLab Personal Project ID', + widget=forms.NumberInput( + attrs={ + 'placeholder': 'Your personal gitlab project ID', + 'autocomplete': 'off' + } + ) + ) + gl_git_training_exercise = forms.IntegerField( + required=False, label='From which GitLab project you have done git' + ' training?', + widget=forms.NumberInput( + attrs={ + 'placeholder': 'A valid project ID of Git training project', + 'autocomplete': 'off' + } + ) + ) + gl_most_contributed_repo_id = forms.IntegerField( + required=False, + label="GitLab Project to which you've contributed most!", + widget=forms.NumberInput( + attrs={ + 'placeholder': 'A valid ID of gitlab public project', + 'autocomplete': 'off', + } + ) + ) diff --git a/community/urls.py b/community/urls.py index 42384cb3..a42078b6 100644 --- a/community/urls.py +++ b/community/urls.py @@ -6,7 +6,7 @@ from django.conf.urls.static import static from django.conf import settings -from community.views import HomePageView +from community.views import HomePageView, JoinCommunityView from gci.views import GCIStudentsList from gci.feeds import LatestTasksFeed as gci_tasks_rss from ci_build.view_log import BuildLogsView @@ -78,6 +78,12 @@ def get_organization(): distill_func=get_index, distill_file='index.html', ), + distill_url( + r'^join/', JoinCommunityView.as_view(), + name='join-community', + distill_func=get_index, + distill_file='join/index.html', + ), distill_url( r'gci/tasks/rss.xml', gci_tasks_rss(), name='gci-tasks-rss', diff --git a/community/views.py b/community/views.py index 38c83d23..02cb866f 100644 --- a/community/views.py +++ b/community/views.py @@ -1,3 +1,5 @@ +import os + import logging import requests @@ -10,10 +12,15 @@ get_org_name, get_remote_url ) +from .forms import JoinCommunityForm from data.models import Team from gamification.models import Participant as GamificationParticipant from meta_review.models import Participant as MetaReviewer +GL_NEWCOMERS_GRP = 'https://gitlab.com/{}/roles/newcomers'.format( + get_org_name() +) + def initialize_org_context_details(): org_name = get_org_name() @@ -110,3 +117,18 @@ def get_context_data(self, **kwargs): context['top_gamification_users'] = self.get_top_gamification_users( count=5) return context + + +class JoinCommunityView(TemplateView): + + template_name = 'join_community.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context = get_header_and_footer(context) + context['join_community_form'] = JoinCommunityForm() + context['gitlab_newcomers_group_url'] = GL_NEWCOMERS_GRP + context['join_community_form_name'] = os.environ.get( + 'JOIN_COMMUNITY_FORM_NAME', None + ) + return context diff --git a/static/css/join-community.css b/static/css/join-community.css new file mode 100644 index 00000000..85c9a153 --- /dev/null +++ b/static/css/join-community.css @@ -0,0 +1,25 @@ +.join-community-form .row { + margin: 5px auto; +} + +.join-community-form .row .input-field, +.join-community-form p { + margin: 0 auto; +} + +.join-community-form label{ + font-size: 1.3em; + color: black; +} + +.join-community-form ::placeholder{ + color: gray; +} + +.validation-checkboxes { + padding: 0 15px; +} + +.submit-btn{ + margin: 15px; +} diff --git a/static/css/main.css b/static/css/main.css index c9357db6..35a6a027 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -53,7 +53,8 @@ body { padding: 5px 10px; } -.form-popup { +.form-popup, +.form-submission-popup { width: 100%; height: 100%; justify-content: center; @@ -79,11 +80,16 @@ footer .social-buttons { text-transform: none; } +.inline-contents { + display: inline-flex; +} + .large-font { font-size: larger; } -.login-form { +.login-form, +.form-submission-message { width: 30%; min-width: 340px; background-color: white; @@ -100,6 +106,11 @@ footer .social-buttons { color: #37474f; } +.message { + padding: 10px; + text-align: justify; +} + nav { background-color: #37474f; } @@ -165,10 +176,6 @@ p { background-color: #263238; } -.inline-contents { - display: inline-flex; -} - .search-field { border-radius: 100px; box-shadow: 0 0 25px 2px black; @@ -202,6 +209,10 @@ p { float: none; } +strong { + font-weight: bold; +} + .student { padding-bottom: 20px; } diff --git a/static/js/main.js b/static/js/main.js index 91866c38..59fa47bc 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,9 +1,15 @@ -/* globals Cookies, netlify */ +/* globals Cookies, netlify, URLSearchParams */ $(document).ready(function(){ var login_user_el = $('.login-user'); var logout_user_el = $('.user-logout'); + var urlParams = new URLSearchParams(location.search); + var formSubmitted = urlParams.get('form_submitted'); + if(formSubmitted==='True'){ + $('.form-submission-popup').css('display', 'block'); + } + function activate_dropdown(){ if ($('nav').width() < 992 ){ $(".dropdown-trigger-sidenav").dropdown({coverTrigger: false}); @@ -100,6 +106,7 @@ $(document).ready(function(){ $('.close-form').click(function () { $('.form-popup').css('display', 'none'); + $('.form-submission-popup').css('display', 'none'); $('.oauth-error').css('display', 'none'); }); diff --git a/templates/base.html b/templates/base.html index cd7cd09c..66427388 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,7 +34,7 @@