diff --git a/community/forms.py b/community/forms.py index 3f288cb0..729abded 100644 --- a/community/forms.py +++ b/community/forms.py @@ -218,3 +218,78 @@ class AssignIssue(forms.Form): max_length=50, label='GitHub Username', widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True}) ) + + +class NewcomerPromotion(forms.Form): + github_username = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput(attrs={'autocomplete': 'off'}) + ) + gitlab_user_id = forms.IntegerField( + label='GitLab User ID', + widget=forms.NumberInput(attrs={'autocomplete': 'off'}) + ) + project_web_url = forms.URLField( + label='Personal Project URL', + help_text="A project in which you've added .coafile and build it!", + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + build_file_relative_path = forms.CharField( + label='Build File', + help_text='For example, if integrated Travis CI, provide ' + '/relative/path/to/travis.yml', + widget=forms.TextInput(attrs={'autocomplete': 'off'}) + ) + coafile_relative_path = forms.CharField( + label='.coafile File', + help_text="Add 5 or more sections in '.coafile'! Provide " + '/relative/path/to/.coafile', + widget=forms.TextInput(attrs={'autocomplete': 'off'}) + ) + gist_or_snippet_id = forms.IntegerField( + label='Gist or Snippet ID', + help_text='Paste your local build output to gist or snippet! Choose ' + 'Gist, if personal project on GitHub else choose ' + 'GitLab Snippet.', + widget=forms.NumberInput(attrs={'autocomplete': 'off'}) + ) + newcomer_solved_issue_web_url = forms.URLField( + label='Issue URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community/' + 'issues/1', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + newcomer_issue_related_pr = forms.URLField( + label='Merge Request URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community' + '/pulls/1', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + newcomer_issue_pr_reviewed_url = forms.URLField( + label='Reviewed PR URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community/' + 'pulls/2', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + low_level_solved_issue_web_url = forms.URLField( + label='Issue URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community/' + 'issues/1', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + low_level_issue_related_pr = forms.URLField( + label='Merge Request URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community' + '/pulls/1', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + low_level_issue_pr_reviewed_url = forms.URLField( + label='Reviewed PR URL', + help_text=f'For example, https://github.com/{ORG_NAME}/community/' + 'pulls/2', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + request_created_by_user = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True}) + ) diff --git a/community/views.py b/community/views.py index f4c0e224..8d456db6 100644 --- a/community/views.py +++ b/community/views.py @@ -18,7 +18,8 @@ CommunityEvent, OrganizationMentor, GSOCStudent, - AssignIssue + AssignIssue, + NewcomerPromotion ) from data.models import Team from gamification.models import Participant as GamificationParticipant @@ -49,6 +50,14 @@ def initialize_org_context_details(): return org_details +def get_newcomer_promotion_form_variables(context): + context['newcomer_promotion_form'] = NewcomerPromotion() + context['newcomer_promotion_form_name'] = os.environ.get( + 'NEWCOMER_PROMOTION_REQUEST_FORM_NAME', None + ) + return context + + def get_assign_issue_form_variables(context): context['assign_issue_form'] = AssignIssue() context['assign_issue_form_name'] = os.environ.get( @@ -95,6 +104,7 @@ def get_all_community_forms(context): context = get_community_mentor_form_variables(context) context = get_gsoc_student_form_variables(context) context = get_assign_issue_form_variables(context) + context = get_newcomer_promotion_form_variables(context) return context diff --git a/static/css/main.css b/static/css/main.css index 75ecbebd..5c00f1d0 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -108,6 +108,13 @@ body { position:fixed; } +.form-step-div { + box-shadow: 0 -5px 15px black; + margin: 30px 0 20px 0; + border-radius: 30px; + padding: 5px 10px 0 10px; +} + footer .footer-icons { display: flex; flex-wrap: wrap; diff --git a/static/js/forms.js b/static/js/forms.js index 3ce22188..80d02dc7 100644 --- a/static/js/forms.js +++ b/static/js/forms.js @@ -18,7 +18,8 @@ $(document).ready(function () { var is_user_authenticated = Cookies.get('authenticated'); var authenticated_username = Cookies.get('username'); - var username_input = $('[name$=user]'); + var username_input = $('[name$=user]').add($('.newcomer-promotion-form' + + ' [name$=username]')); username_input.attr('value', authenticated_username || 'Anonymous User'); username_input.attr('disabled', true); diff --git a/templates/community_forms.html b/templates/community_forms.html index af04760d..66071242 100644 --- a/templates/community_forms.html +++ b/templates/community_forms.html @@ -264,3 +264,155 @@