Skip to content

Commit

Permalink
community/: Add a newcomer promotion request form
Browse files Browse the repository at this point in the history
Closes #281
  • Loading branch information
KVGarg committed Aug 6, 2019
1 parent e9dd16a commit 7714d9e
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 2 deletions.
75 changes: 75 additions & 0 deletions community/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
)
12 changes: 11 additions & 1 deletion community/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
CommunityEvent,
OrganizationMentor,
GSOCStudent,
AssignIssue
AssignIssue,
NewcomerPromotion
)
from data.models import Team
from gamification.models import Participant as GamificationParticipant
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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


Expand Down
7 changes: 7 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion static/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
152 changes: 152 additions & 0 deletions templates/community_forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,155 @@ <h5 class="text-center custom-green-color-font bold-text">
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
</div>
</form>

<form name="{{ newcomer_promotion_form_name }}" method="post"
netlify-honeypot="bot-field" class="newcomer-promotion-form display-none"
data-netlify="true" action="/">
<h5 class="text-center custom-green-color-font bold-text">
Newcomer Promotion Request Form
</h5>
{% csrf_token %}
<div class="form-step-div">
<h6 class="bold-text custom-green-color-font">User Details</h6>
<div class="row">
<div class="input-field col s12">
<p>{{ newcomer_promotion_form.github_username.label_tag }}</p>
{{ newcomer_promotion_form.github_username }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.gitlab_user_id.label_tag }}
{{ newcomer_promotion_form.gitlab_user_id }}
</div>
</div>
</div>
<div class="form-step-div">
<h6 class="bold-text custom-green-color-font">Personal Project Details</h6>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.project_web_url.label_tag }}
{{ newcomer_promotion_form.project_web_url }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.project_web_url.help_text }}</i>
</div>
</div>
<div style="padding-left: 10px">
<h6 class="bold-text custom-green-color-font">Files Relative Path
(to project root)
</h6>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.build_file_relative_path.label_tag }}
{{ newcomer_promotion_form.build_file_relative_path }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.build_file_relative_path.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.coafile_relative_path.label_tag }}
{{ newcomer_promotion_form.coafile_relative_path }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.coafile_relative_path.help_text }}</i>
</div>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.gist_or_snippet_id.label_tag }}
{{ newcomer_promotion_form.gist_or_snippet_id }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.gist_or_snippet_id.help_text }}</i>
</div>
</div>
</div>
<div class="form-step-div">
<h6 class="bold-text custom-green-color-font">Newcomer Issue Related
Details</h6>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.newcomer_solved_issue_web_url.label_tag }}
{{ newcomer_promotion_form.newcomer_solved_issue_web_url }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_solved_issue_web_url.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.newcomer_issue_related_pr.label_tag }}
{{ newcomer_promotion_form.newcomer_issue_related_pr }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_related_pr.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.label_tag }}
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.help_text }}</i>
</div>
</div>
</div>
<div class="form-step-div">
<h6 class="bold-text custom-green-color-font">Low Difficulty Issue
Related Details</h6>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.low_level_solved_issue_web_url.label_tag }}
{{ newcomer_promotion_form.low_level_solved_issue_web_url }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_solved_issue_web_url.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.low_level_issue_related_pr.label_tag }}
{{ newcomer_promotion_form.low_level_issue_related_pr }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_related_pr.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.label_tag }}
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url }}
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.help_text }}</i>
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ newcomer_promotion_form.request_created_by_user }}
</div>
</div>
</div>
<div class="validation-checkboxes">
<p>
<label>
<input type="checkbox" required>
<span>I am a member of {{ org.name }} oragnization.</span>
</label>
</p>
<p>
<label>
<input type="checkbox" required>
<span>I have not submitted this form for more than 3 times. If so, I
am liable of getting blacklisted!</span>
</label>
</p>
<p>
<label>
<input type="checkbox" required>
<span>All of the above information provided by me has no false
entries. If so, I am liable of getting blacklisted.</span>
</label>
</p>
<p style="display: none">
<label>
<input type="checkbox" name="bot-field">
<span>I am a bot</span>
</label>
</p>
<p>
<strong>
Note: You will receive an email within 24 hrs, if any of the
validation checks are not passed.
</strong>
</p>
</div>
<div class="apply-flex center-content submit-btn">
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
</div>
</form>

0 comments on commit 7714d9e

Please sign in to comment.