Skip to content

Commit 6e0effa

Browse files
committed
community/: Add a feedback form
Closes coala#274
1 parent 11c881a commit 6e0effa

File tree

6 files changed

+123
-8
lines changed

6 files changed

+123
-8
lines changed

Diff for: community/forms.py

+15
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,18 @@ class NewcomerPromotion(forms.Form):
284284
max_length=50, label='GitHub Username',
285285
widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True})
286286
)
287+
288+
289+
class Feedback(forms.Form):
290+
username = forms.CharField(
291+
label='GitHub Username', required=False,
292+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
293+
)
294+
feedback = forms.CharField(
295+
max_length=1000, label='What you want us to improve?',
296+
widget=forms.Textarea(attrs={'autocomplete': 'off'})
297+
)
298+
experience = forms.CharField(
299+
required=False,
300+
widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True})
301+
)

Diff for: community/views.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
OrganizationMentor,
2020
GSOCStudent,
2121
AssignIssue,
22-
NewcomerPromotion
22+
NewcomerPromotion,
23+
Feedback
2324
)
2425
from data.models import Team
2526
from gamification.models import Participant as GamificationParticipant
@@ -50,6 +51,14 @@ def initialize_org_context_details():
5051
return org_details
5152

5253

54+
def get_feedback_form_variables(context):
55+
context['feedback_form'] = Feedback()
56+
context['feedback_form_name'] = os.environ.get(
57+
'FEEDBACK_FORM_NAME', None
58+
)
59+
return context
60+
61+
5362
def get_newcomer_promotion_form_variables(context):
5463
context['newcomer_promotion_form'] = NewcomerPromotion()
5564
context['newcomer_promotion_form_name'] = os.environ.get(
@@ -105,6 +114,7 @@ def get_all_community_forms(context):
105114
context = get_gsoc_student_form_variables(context)
106115
context = get_assign_issue_form_variables(context)
107116
context = get_newcomer_promotion_form_variables(context)
117+
context = get_feedback_form_variables(context)
108118
return context
109119

110120

Diff for: static/css/main.css

+29-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ body {
3838
justify-content: center;
3939
}
4040

41-
.community-form {
41+
.community-form,
42+
.feedback {
4243
position: absolute;
4344
width: 70%;
4445
min-width: 330px;
@@ -52,25 +53,31 @@ body {
5253
overflow-x: auto;
5354
}
5455

55-
.community-form form {
56+
.community-form form,
57+
.feedback form {
5658
padding-bottom: inherit;
5759

5860
}
59-
.community-form form label {
61+
.community-form form label,
62+
.feedback form label,
63+
.experience {
6064
font-weight: bold;
6165
font-size: 1.5rem;
6266
color: darkcyan;
6367
}
6468

65-
.community-form form p{
69+
.community-form form p,
70+
.feedback form p {
6671
margin: 0;
6772
}
6873

69-
.community-form form textarea{
74+
.community-form form textarea,
75+
.feedback form textarea {
7076
margin-top: 10px;
7177
}
7278

73-
.community-form form .row{
79+
.community-form form .row,
80+
.feedback form .row {
7481
margin-bottom: 0;
7582
}
7683

@@ -97,6 +104,17 @@ body {
97104
display: none;
98105
}
99106

107+
.feedback-icon {
108+
position: fixed;
109+
bottom: 2%;
110+
right: 1%;
111+
}
112+
113+
.feedback-comment {
114+
width: 80px;
115+
cursor: pointer;
116+
}
117+
100118
.form-popup,
101119
.form-submission-popup {
102120
width: 100%;
@@ -276,6 +294,11 @@ strong {
276294
text-align: center;
277295
}
278296

297+
.user-feeling-level i {
298+
font-size: 3rem;
299+
cursor: pointer;
300+
}
301+
279302
#user-dropdown li.user-profile,
280303
#user-dropdown li.user-logout {
281304
display: none;

Diff for: static/js/forms.js

+22
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ $(document).ready(function () {
77
var get_issue_assigned_form_op = $('.get-issue-assigned-form-op');
88
var participated_in_gsoc_form_op = $('.participated-in-gsoc-form-op');
99
var mentor_students_form_op = $('.mentor-students-form-op');
10+
var feedback_form_op = $('.feedback-comment');
1011

1112
var community_google_form = $('.community-google-form');
1213
var newcomer_promotion_form = $('.newcomer-promotion-form');
1314
var calendar_event_form = $('.calendar-event-form');
1415
var get_issue_assigned_form = $('.get-issue-assigned-form');
1516
var participated_in_gsoc_form = $('.participated-in-gsoc-form');
1617
var mentor_students_form = $('.mentor-students-form');
18+
var feedback_form = $('.feedback');
1719

1820
var is_user_authenticated = Cookies.get('authenticated');
1921
var authenticated_username = Cookies.get('username');
@@ -87,6 +89,26 @@ $(document).ready(function () {
8789
display_form_or_error(mentor_students_form);
8890
});
8991

92+
feedback_form_op.on('click', function () {
93+
var top_offset = feedback_form_op.offset().top;
94+
feedback_form.css('top', (top_offset-440).toString()+'px');
95+
feedback_form.css('display', 'block');
96+
$('.user-feeling-level i').on('click', function () {
97+
var experience = $(this).attr('experience');
98+
$('input[name="experience"]').val(experience);
99+
$('.user-feeling-level i').css('color', 'black');
100+
if(experience==='Negative'){
101+
$(this).css('color', 'red');
102+
}
103+
else if(experience==='Neutral'){
104+
$(this).css('color', 'blue');
105+
}
106+
else {
107+
$(this).css('color', 'darkgreen');
108+
}
109+
})
110+
});
111+
90112
$(':input').focusin(function () {
91113
if (is_user_authenticated===undefined &&
92114
authenticated_username===undefined) {

Diff for: static/js/main.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ $(document).ready(function(){
129129
$('.form-submission-popup').css('display', 'none');
130130
$('.oauth-error').css('display', 'none');
131131
$('.community-form').css('display', 'none');
132-
$('form').css('display', 'none');
132+
$('.feedback').css('display', 'none');
133+
$('.community-form form').css('display', 'none');
133134
});
134135

135136
logout_user_el.click(function () {

Diff for: templates/base.html

+44
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,50 @@ <h6>Enjoy Coding 'n' Learning</h6>
175175
{% include 'community_forms.html' %}
176176
</div>
177177

178+
<div class="feedback-icon">
179+
<img alt="feedback" class="feedback-comment"
180+
src="https://www.agcsoftware.com/wp-content/uploads//2017/06/feedback-icon.png">
181+
</div>
182+
183+
<div class="feedback display-none">
184+
<div class="apply-flex close-form">
185+
<i class="fa fa-times" aria-hidden="true"></i>
186+
</div>
187+
<form name="{{ feedback_form_name }}" method="post"
188+
netlify-honeypot="bot-field" class="feedback-form"
189+
data-netlify="true" action="/">
190+
<h5 class="text-center custom-green-color-font bold-text">
191+
Feedback
192+
</h5>
193+
{% csrf_token %}
194+
{% for field in feedback_form %}
195+
{% if field.name != 'experience' %}
196+
<div class="row">
197+
<div class="input-field col s12">
198+
{{ field.label_tag }}
199+
{{ field }}
200+
</div>
201+
</div>
202+
{% else %}
203+
{{ field }}
204+
{% endif %}
205+
{% endfor %}
206+
<div class="row">
207+
<div class="input-field col s12">
208+
<h6 class="experience">Feeling about {{ org.name }} organization?</h6>
209+
<div class="user-feeling-level apply-flex evenly-spread-content">
210+
<i class="fa fa-frown-o" experience="Negative" aria-hidden="true"></i>
211+
<i class="fa fa-meh-o" experience="Neutral" aria-hidden="true"></i>
212+
<i class="fa fa-smile-o" experience="Positive" aria-hidden="true"></i>
213+
</div>
214+
</div>
215+
</div>
216+
<div class="apply-flex center-content submit-btn">
217+
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
218+
</div>
219+
</form>
220+
</div>
221+
178222
<footer class="page-footer">
179223
<div class="row">
180224
<div class="col m3 s12">

0 commit comments

Comments
 (0)