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 c03de2e2..637f83aa 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, info +from community.views import HomePageView, info, JoinCommunityView from gci.views import index as gci_index from gci.feeds import LatestTasksFeed as gci_tasks_rss from twitter.view_twitter import index as twitter_index @@ -79,9 +79,15 @@ 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( 'info.txt', info, - name='index', + name='deploy-info', distill_func=get_index, distill_file='info.txt', ), diff --git a/community/views.py b/community/views.py index 4f98bebe..b3a98950 100644 --- a/community/views.py +++ b/community/views.py @@ -1,3 +1,5 @@ +import os + import logging import requests @@ -14,10 +16,15 @@ get_upstream_deploy_url, 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() @@ -113,6 +120,21 @@ def get_context_data(self, **kwargs): 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 + + def info(request): data = { 'Org name': get_org_name(), diff --git a/static/css/join-community.css b/static/css/join-community.css new file mode 100644 index 00000000..826077e1 --- /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; +} \ No newline at end of file diff --git a/static/css/main.css b/static/css/main.css index 711f7378..e7d2f304 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; @@ -82,7 +83,8 @@ footer .social-buttons { font-size: larger; } -.login-form { +.login-form, +.form-submission-message { width: 30%; min-width: 340px; background-color: white; @@ -168,6 +170,11 @@ p { display: inline-flex; } +.message { + padding: 10px; + text-align: justify; +} + .search-field { border-radius: 100px; box-shadow: 0px 0px 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 1b80a78d..983473a3 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -4,6 +4,12 @@ $(document).ready(function(){ var login_user_el = $('.login-user'); var logout_user_el = $('.user-logout'); + const urlParams = new URLSearchParams(location.search); + const 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 5d2d503e..74a29c02 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,7 +34,7 @@