Skip to content

Commit 11c881a

Browse files
committed
community/: Add a newcomer promotion request form
Closes #281
1 parent 3e06214 commit 11c881a

File tree

5 files changed

+242
-3
lines changed

5 files changed

+242
-3
lines changed

community/forms.py

+69
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,72 @@ class AssignIssue(forms.Form):
215215
max_length=50, label='GitHub Username',
216216
widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True})
217217
)
218+
219+
220+
class NewcomerPromotion(forms.Form):
221+
github_username = forms.CharField(
222+
max_length=50, label='GitHub Username',
223+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
224+
)
225+
gitlab_user_id = forms.IntegerField(
226+
label='GitLab User ID',
227+
widget=forms.NumberInput(attrs={'autocomplete': 'off'})
228+
)
229+
project_web_url = forms.URLField(
230+
label='Personal Project URL',
231+
help_text="A project in which you've added .coafile and build it!",
232+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
233+
)
234+
build_file_relative_path = forms.CharField(
235+
label='Build File',
236+
help_text='For example, if integrated Travis CI, provide '
237+
'/relative/path/to/travis.yml',
238+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
239+
)
240+
coafile_relative_path = forms.CharField(
241+
label='.coafile File',
242+
help_text="Add 5 or more sections in '.coafile'! Provide "
243+
'/relative/path/to/.coafile',
244+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
245+
)
246+
gist_or_snippet_id = forms.IntegerField(
247+
label='Gist or Snippet ID',
248+
help_text='Paste your local build output to gist or snippet! Choose '
249+
'Gist, if personal project on GitHub else choose '
250+
'GitLab Snippet.',
251+
widget=forms.NumberInput(attrs={'autocomplete': 'off'})
252+
)
253+
newcomer_solved_issue_web_url = forms.URLField(
254+
label='Issue URL',
255+
help_text='For example, https://github.com/org/repo_name/issues/1',
256+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
257+
)
258+
newcomer_issue_related_pr = forms.URLField(
259+
label='Merge Request URL',
260+
help_text='For example, https://github.com/org/repo_name/pulls/1',
261+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
262+
)
263+
newcomer_issue_pr_reviewed_url = forms.URLField(
264+
label='Reviewed PR URL',
265+
help_text='For example, https://github.com/org/repo_name/pulls/2',
266+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
267+
)
268+
low_level_solved_issue_web_url = forms.URLField(
269+
label='Issue URL',
270+
help_text='For example, https://github.com/org/repo_name/issues/1',
271+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
272+
)
273+
low_level_issue_related_pr = forms.URLField(
274+
label='Merge Request URL',
275+
help_text='For example, https://github.com/org/repo_name/pulls/1',
276+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
277+
)
278+
low_level_issue_pr_reviewed_url = forms.URLField(
279+
label='Reviewed PR URL',
280+
help_text='For example, https://github.com/org/repo_name/pulls/2',
281+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
282+
)
283+
request_created_by_user = forms.CharField(
284+
max_length=50, label='GitHub Username',
285+
widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True})
286+
)

community/views.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
CommunityEvent,
1919
OrganizationMentor,
2020
GSOCStudent,
21-
AssignIssue
21+
AssignIssue,
22+
NewcomerPromotion
2223
)
2324
from data.models import Team
2425
from gamification.models import Participant as GamificationParticipant
@@ -49,6 +50,14 @@ def initialize_org_context_details():
4950
return org_details
5051

5152

53+
def get_newcomer_promotion_form_variables(context):
54+
context['newcomer_promotion_form'] = NewcomerPromotion()
55+
context['newcomer_promotion_form_name'] = os.environ.get(
56+
'NEWCOMER_PROMOTION_REQUEST_FORM_NAME', None
57+
)
58+
return context
59+
60+
5261
def get_assign_issue_form_variables(context):
5362
context['assign_issue_form'] = AssignIssue()
5463
context['assign_issue_form_name'] = os.environ.get(
@@ -95,6 +104,7 @@ def get_all_community_forms(context):
95104
context = get_community_mentor_form_variables(context)
96105
context = get_gsoc_student_form_variables(context)
97106
context = get_assign_issue_form_variables(context)
107+
context = get_newcomer_promotion_form_variables(context)
98108
return context
99109

100110

static/css/main.css

+7
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ body {
107107
position:absolute;
108108
}
109109

110+
.form-step-div {
111+
box-shadow: 0 -5px 15px black;
112+
margin: 30px 0 20px 0;
113+
border-radius: 30px;
114+
padding: 5px 10px 0 10px;
115+
}
116+
110117
footer .footer-icons {
111118
display: flex;
112119
flex-wrap: wrap;

static/js/forms.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ $(document).ready(function () {
1818
var is_user_authenticated = Cookies.get('authenticated');
1919
var authenticated_username = Cookies.get('username');
2020

21-
var username_input = $('[name$=user]');
21+
var username_input = $('[name$=user]').add($('.newcomer-promotion-form' +
22+
' [name$=username]'));
2223
username_input.attr('value', authenticated_username || 'Anonymous User');
2324
username_input.attr('disabled', true);
2425

templates/community_forms.html

+153-1
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,156 @@ <h5 class="text-center custom-green-color-font bold-text">
263263
<div class="apply-flex center-content submit-btn">
264264
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
265265
</div>
266-
</form>
266+
</form>
267+
268+
<form name="{{ newcomer_promotion_form_name }}" method="post"
269+
netlify-honeypot="bot-field" class="newcomer-promotion-form display-none"
270+
data-netlify="true" action="/">
271+
<h5 class="text-center custom-green-color-font bold-text">
272+
On which Issue you want to work?
273+
</h5>
274+
{% csrf_token %}
275+
<div class="form-step-div">
276+
<h6 class="bold-text custom-green-color-font">User Details</h6>
277+
<div class="row">
278+
<div class="input-field col s12">
279+
<p>{{ newcomer_promotion_form.github_username.label_tag }}</p>
280+
{{ newcomer_promotion_form.github_username }}
281+
</div>
282+
</div>
283+
<div class="row">
284+
<div class="input-field col s12">
285+
{{ newcomer_promotion_form.gitlab_user_id.label_tag }}
286+
{{ newcomer_promotion_form.gitlab_user_id }}
287+
</div>
288+
</div>
289+
</div>
290+
<div class="form-step-div">
291+
<h6 class="bold-text custom-green-color-font">Personal Project Details</h6>
292+
<div class="row">
293+
<div class="input-field col s12">
294+
{{ newcomer_promotion_form.project_web_url.label_tag }}
295+
{{ newcomer_promotion_form.project_web_url }}
296+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.project_web_url.help_text }}</i>
297+
</div>
298+
</div>
299+
<div style="padding-left: 10px">
300+
<h6 class="bold-text custom-green-color-font">Files Relative Path
301+
(to project root)
302+
</h6>
303+
<div class="row">
304+
<div class="input-field col s12">
305+
{{ newcomer_promotion_form.build_file_relative_path.label_tag }}
306+
{{ newcomer_promotion_form.build_file_relative_path }}
307+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.build_file_relative_path.help_text }}</i>
308+
</div>
309+
</div>
310+
<div class="row">
311+
<div class="input-field col s12">
312+
{{ newcomer_promotion_form.coafile_relative_path.label_tag }}
313+
{{ newcomer_promotion_form.coafile_relative_path }}
314+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.coafile_relative_path.help_text }}</i>
315+
</div>
316+
</div>
317+
</div>
318+
<div class="row">
319+
<div class="input-field col s12">
320+
{{ newcomer_promotion_form.gist_or_snippet_id.label_tag }}
321+
{{ newcomer_promotion_form.gist_or_snippet_id }}
322+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.gist_or_snippet_id.help_text }}</i>
323+
</div>
324+
</div>
325+
</div>
326+
<div class="form-step-div">
327+
<h6 class="bold-text custom-green-color-font">Newcomer Issue Related
328+
Details</h6>
329+
<div class="row">
330+
<div class="input-field col s12">
331+
{{ newcomer_promotion_form.newcomer_solved_issue_web_url.label_tag }}
332+
{{ newcomer_promotion_form.newcomer_solved_issue_web_url }}
333+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_solved_issue_web_url.help_text }}</i>
334+
</div>
335+
</div>
336+
<div class="row">
337+
<div class="input-field col s12">
338+
{{ newcomer_promotion_form.newcomer_issue_related_pr.label_tag }}
339+
{{ newcomer_promotion_form.newcomer_issue_related_pr }}
340+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_related_pr.help_text }}</i>
341+
</div>
342+
</div>
343+
<div class="row">
344+
<div class="input-field col s12">
345+
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.label_tag }}
346+
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url }}
347+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.help_text }}</i>
348+
</div>
349+
</div>
350+
</div>
351+
<div class="form-step-div">
352+
<h6 class="bold-text custom-green-color-font">Low Difficulty Issue
353+
Related Details</h6>
354+
<div class="row">
355+
<div class="input-field col s12">
356+
{{ newcomer_promotion_form.low_level_solved_issue_web_url.label_tag }}
357+
{{ newcomer_promotion_form.low_level_solved_issue_web_url }}
358+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_solved_issue_web_url.help_text }}</i>
359+
</div>
360+
</div>
361+
<div class="row">
362+
<div class="input-field col s12">
363+
{{ newcomer_promotion_form.low_level_issue_related_pr.label_tag }}
364+
{{ newcomer_promotion_form.low_level_issue_related_pr }}
365+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_related_pr.help_text }}</i>
366+
</div>
367+
</div>
368+
<div class="row">
369+
<div class="input-field col s12">
370+
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.label_tag }}
371+
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url }}
372+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.help_text }}</i>
373+
</div>
374+
</div>
375+
<div class="row">
376+
<div class="input-field col s12">
377+
{{ newcomer_promotion_form.request_created_by_user }}
378+
</div>
379+
</div>
380+
</div>
381+
<div class="validation-checkboxes">
382+
<p>
383+
<label>
384+
<input type="checkbox" required>
385+
<span>I am a member of {{ org.name }} oragnization.</span>
386+
</label>
387+
</p>
388+
<p>
389+
<label>
390+
<input type="checkbox" required>
391+
<span>I have not submitted this form for more than 3 times. If so, I
392+
am liable of getting blacklisted!</span>
393+
</label>
394+
</p>
395+
<p>
396+
<label>
397+
<input type="checkbox" required>
398+
<span>All of the above information provided by me has no false
399+
entries. If so, I am liable of getting blacklisted.</span>
400+
</label>
401+
</p>
402+
<p style="display: none">
403+
<label>
404+
<input type="checkbox" name="bot-field">
405+
<span>I am a bot</span>
406+
</label>
407+
</p>
408+
<p>
409+
<strong>
410+
Note: You will receive an email within 24 hrs, if any of the
411+
validation checks are not passed.
412+
</strong>
413+
</p>
414+
</div>
415+
<div class="apply-flex center-content submit-btn">
416+
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
417+
</div>
418+
</form>

0 commit comments

Comments
 (0)