Skip to content

Commit 5487315

Browse files
committed
community/: Add a newcomer promotion request form
Closes coala#281
1 parent e341063 commit 5487315

File tree

5 files changed

+247
-2
lines changed

5 files changed

+247
-2
lines changed

Diff for: community/forms.py

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

Diff for: 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

Diff for: static/css/main.css

+7
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ body {
108108
position:fixed;
109109
}
110110

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

Diff for: 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

Diff for: templates/community_forms.html

+152
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,155 @@ <h5 class="text-center custom-green-color-font bold-text">
368368
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
369369
</div>
370370
</form>
371+
372+
<form name="{{ newcomer_promotion_form_name }}" method="post"
373+
netlify-honeypot="bot-field" class="newcomer-promotion-form display-none"
374+
data-netlify="true" action="/">
375+
<h5 class="text-center custom-green-color-font bold-text">
376+
Newcomer Promotion Request Form
377+
</h5>
378+
{% csrf_token %}
379+
<div class="form-step-div">
380+
<h6 class="bold-text custom-green-color-font">User Details</h6>
381+
<div class="row">
382+
<div class="input-field col s12">
383+
<p>{{ newcomer_promotion_form.github_username.label_tag }}</p>
384+
{{ newcomer_promotion_form.github_username }}
385+
</div>
386+
</div>
387+
<div class="row">
388+
<div class="input-field col s12">
389+
{{ newcomer_promotion_form.gitlab_user_id.label_tag }}
390+
{{ newcomer_promotion_form.gitlab_user_id }}
391+
</div>
392+
</div>
393+
</div>
394+
<div class="form-step-div">
395+
<h6 class="bold-text custom-green-color-font">Personal Project Details</h6>
396+
<div class="row">
397+
<div class="input-field col s12">
398+
{{ newcomer_promotion_form.project_web_url.label_tag }}
399+
{{ newcomer_promotion_form.project_web_url }}
400+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.project_web_url.help_text }}</i>
401+
</div>
402+
</div>
403+
<div style="padding-left: 10px">
404+
<h6 class="bold-text custom-green-color-font">Files Relative Path
405+
(to project root)
406+
</h6>
407+
<div class="row">
408+
<div class="input-field col s12">
409+
{{ newcomer_promotion_form.build_file_relative_path.label_tag }}
410+
{{ newcomer_promotion_form.build_file_relative_path }}
411+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.build_file_relative_path.help_text }}</i>
412+
</div>
413+
</div>
414+
<div class="row">
415+
<div class="input-field col s12">
416+
{{ newcomer_promotion_form.coafile_relative_path.label_tag }}
417+
{{ newcomer_promotion_form.coafile_relative_path }}
418+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.coafile_relative_path.help_text }}</i>
419+
</div>
420+
</div>
421+
</div>
422+
<div class="row">
423+
<div class="input-field col s12">
424+
{{ newcomer_promotion_form.gist_or_snippet_id.label_tag }}
425+
{{ newcomer_promotion_form.gist_or_snippet_id }}
426+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.gist_or_snippet_id.help_text }}</i>
427+
</div>
428+
</div>
429+
</div>
430+
<div class="form-step-div">
431+
<h6 class="bold-text custom-green-color-font">Newcomer Issue Related
432+
Details</h6>
433+
<div class="row">
434+
<div class="input-field col s12">
435+
{{ newcomer_promotion_form.newcomer_solved_issue_web_url.label_tag }}
436+
{{ newcomer_promotion_form.newcomer_solved_issue_web_url }}
437+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_solved_issue_web_url.help_text }}</i>
438+
</div>
439+
</div>
440+
<div class="row">
441+
<div class="input-field col s12">
442+
{{ newcomer_promotion_form.newcomer_issue_related_pr.label_tag }}
443+
{{ newcomer_promotion_form.newcomer_issue_related_pr }}
444+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_related_pr.help_text }}</i>
445+
</div>
446+
</div>
447+
<div class="row">
448+
<div class="input-field col s12">
449+
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.label_tag }}
450+
{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url }}
451+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.newcomer_issue_pr_reviewed_url.help_text }}</i>
452+
</div>
453+
</div>
454+
</div>
455+
<div class="form-step-div">
456+
<h6 class="bold-text custom-green-color-font">Low Difficulty Issue
457+
Related Details</h6>
458+
<div class="row">
459+
<div class="input-field col s12">
460+
{{ newcomer_promotion_form.low_level_solved_issue_web_url.label_tag }}
461+
{{ newcomer_promotion_form.low_level_solved_issue_web_url }}
462+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_solved_issue_web_url.help_text }}</i>
463+
</div>
464+
</div>
465+
<div class="row">
466+
<div class="input-field col s12">
467+
{{ newcomer_promotion_form.low_level_issue_related_pr.label_tag }}
468+
{{ newcomer_promotion_form.low_level_issue_related_pr }}
469+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_related_pr.help_text }}</i>
470+
</div>
471+
</div>
472+
<div class="row">
473+
<div class="input-field col s12">
474+
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.label_tag }}
475+
{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url }}
476+
<i class="fa fa-info-circle" aria-hidden="true">{{ newcomer_promotion_form.low_level_issue_pr_reviewed_url.help_text }}</i>
477+
</div>
478+
</div>
479+
<div class="row">
480+
<div class="input-field col s12">
481+
{{ newcomer_promotion_form.request_created_by_user }}
482+
</div>
483+
</div>
484+
</div>
485+
<div class="validation-checkboxes">
486+
<p>
487+
<label>
488+
<input type="checkbox" required>
489+
<span>I am a member of {{ org.name }} oragnization.</span>
490+
</label>
491+
</p>
492+
<p>
493+
<label>
494+
<input type="checkbox" required>
495+
<span>I have not submitted this form for more than 3 times. If so, I
496+
am liable of getting blacklisted!</span>
497+
</label>
498+
</p>
499+
<p>
500+
<label>
501+
<input type="checkbox" required>
502+
<span>All of the above information provided by me has no false
503+
entries. If so, I am liable of getting blacklisted.</span>
504+
</label>
505+
</p>
506+
<p style="display: none">
507+
<label>
508+
<input type="checkbox" name="bot-field">
509+
<span>I am a bot</span>
510+
</label>
511+
</p>
512+
<p>
513+
<strong>
514+
Note: You will receive an email within 24 hrs, if any of the
515+
validation checks are not passed.
516+
</strong>
517+
</p>
518+
</div>
519+
<div class="apply-flex center-content submit-btn">
520+
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
521+
</div>
522+
</form>

0 commit comments

Comments
 (0)