Skip to content

Commit 7714d9e

Browse files
committed
community/: Add a newcomer promotion request form
Closes coala#281
1 parent e9dd16a commit 7714d9e

File tree

5 files changed

+247
-2
lines changed

5 files changed

+247
-2
lines changed

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+
)

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
@@ -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;

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

+152
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,155 @@ <h5 class="text-center custom-green-color-font bold-text">
264264
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
265265
</div>
266266
</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+
Newcomer Promotion Request Form
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)