Skip to content

Commit c07e8a1

Browse files
comment length should be greater than 15
tests clear
1 parent 782fb53 commit c07e8a1

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

junction/profiles/admin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ class ProfileAdmin(admin.ModelAdmin):
66
list_display = ('user', 'city', 'contact_no')
77
search_fields = ('contact_no', 'city')
88

9+
910
admin.site.register(Profile, ProfileAdmin)

junction/templates/proposals/detail/comments.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ <h5 class="text-muted clear-margin vote-count">
8989
{% bootstrap_field proposal_comment_form.reviewer %}
9090

9191
{% buttons %}
92-
<button type="submit" class="btn btn-primary">
92+
<button type="button" id="comment" class="btn btn-primary">
9393
Add Comment
9494
</button>
9595
<button type="button" class="btn btn-default js-hide-comment-form">Cancel</button>
@@ -138,6 +138,23 @@ <h5 class="text-muted clear-margin vote-count">
138138
location.reload(true);
139139
});
140140
});
141+
$("textarea").keypress(function(){
142+
$(".alert").remove()
143+
var text = $("textarea").val();
144+
if (text.length<15) {
145+
$(this).after("<p class='alert alert-warning'><strong>Remember! </strong>Length should be greater than 15!</p>");
146+
}
147+
})
148+
149+
$("#comment").click(function() {
150+
$(".alert").remove()
151+
var text = $("textarea").val();
152+
if (text.length >= 15) {
153+
$("form").submit();
154+
} else {
155+
$("textarea").after("<p class='alert alert-danger'><strong>Oops! </strong>Length should be greater than 15.</p>");
156+
}
157+
})
141158

142159
{% else %}
143160
$('.js-proposal-upvote, .js-proposal-downvote, .js-proposal-comment-upvote, .js-proposal-comment-downvote').click(function(e){

settings/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"junction.base.context_processors.site_info",
104104
],
105105

106-
'debug': DEBUG,
106+
'debug': DEBUG, # noqa
107107
},
108108
},
109109
]

settings/test_settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
DATABASES = {
1212
'default': {
1313
'ENGINE': 'django.db.backends.sqlite3',
14-
'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'),
14+
'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'), # noqa
1515
}
1616
}
1717

18-
TEMPLATE_CONTEXT_PROCESSORS += (
18+
TEMPLATE_CONTEXT_PROCESSORS += ( # noqa
1919
"django.core.context_processors.debug",
2020
)
2121

2222
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
2323

24-
INSTALLED_APPS += ('django_extensions',)
24+
INSTALLED_APPS += ('django_extensions',) # noqa
2525

2626
DEVICE_VERIFICATION_CODE = 11111

tests/integrations/test_reviewer_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_reviewer_private_comment(self, settings, login, conferences,
2222
data = {'comment': 'Test', 'private': True}
2323

2424
response = client.post(url, data)
25-
25+
print(response.url)
2626
assert response.status_code == 302
2727
assert response.url.endswith('#js-reviewers')
2828

0 commit comments

Comments
 (0)