Fix kaehmy styles and templates
This commit is contained in:
@@ -33,3 +33,15 @@ div.tooltip-inner {
|
||||
p {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.role-filter-form select {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.card a.comment-button {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -84,13 +84,13 @@
|
||||
<p class="card-text">{{ application.text|linebreaks|urlize }}</p>
|
||||
|
||||
{% if application.comment_count > 0 %}
|
||||
<a type="button" style="cursor: pointer" data-toggle="collapse" data-target="#collapse_{{ application.id }}" aria-expanded="false" aria-controls="collapse_{{ application.id }}">
|
||||
<a class="comment-button text-primary" data-toggle="collapse" data-target="#collapse_{{ application.id }}" aria-expanded="false" aria-controls="collapse_{{ application.id }}">
|
||||
{% trans "Show comments" %} ({{ application.comment_count }})
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<a type="button" onclick="commentOn({{ application.id }}, '{{ application.name }}')" style="cursor: pointer" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
<a onclick="commentOn({{ application.id }}, '{{ application.name }}')" class="comment-button text-primary" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
{% trans "Add comment" %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<h6 class="card-subtitle mb-2 text-muted">{{ message.timestamp }}</h6>
|
||||
<div>
|
||||
<a type="button" onclick="commentOn({{ message.id }}, '{{ message.name }}')" style="cursor: pointer" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
<a class="comment-button text-primary" onclick="commentOn({{ message.id }}, '{{ message.name }}')" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
{% trans "Reply" %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
+6
-3
@@ -14,7 +14,8 @@ from dealer.git import git
|
||||
|
||||
from members.views.utils import *
|
||||
from kaehmy.models import Application, CustomRole, PresetRole
|
||||
from kaehmy.forms import ApplicationForm
|
||||
from kaehmy.forms import ApplicationForm, CommentForm
|
||||
from webapp.utils import send_email
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
@@ -42,6 +43,9 @@ def list_view(request, *args, **kwargs):
|
||||
'application_count': len(applications),
|
||||
'filter_options': filter_options
|
||||
}
|
||||
|
||||
print(applications[0])
|
||||
|
||||
return render(request, 'list.html', context)
|
||||
|
||||
|
||||
@@ -50,7 +54,7 @@ def list_view(request, *args, **kwargs):
|
||||
def comment(request, *args, **kwargs):
|
||||
"""POST endpoint for commenting"""
|
||||
|
||||
form = KaehmyCommentForm(request.POST)
|
||||
form = CommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
comment = form.save()
|
||||
email = comment.parent.email
|
||||
@@ -66,7 +70,6 @@ def comment(request, *args, **kwargs):
|
||||
|
||||
return redirect('/kaehmy')
|
||||
else:
|
||||
print(form)
|
||||
context = {
|
||||
'error': form.errors
|
||||
}
|
||||
|
||||
Generated
+2777
-1394
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,6 @@
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
console.log('pippeli')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
+19
-1
@@ -1,9 +1,27 @@
|
||||
"""Webapp utils."""
|
||||
|
||||
from django.utils import timezone
|
||||
from datetime import timedelta
|
||||
from django.core.mail import send_mail
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
def month_from_now():
|
||||
"""Return date one month from now."""
|
||||
return timezone.now() + timedelta(days=30)
|
||||
|
||||
|
||||
def send_email(to, subject, body):
|
||||
try:
|
||||
success = send_mail(
|
||||
subject,
|
||||
body,
|
||||
settings.DEFAULT_EMAIL_FROM,
|
||||
[to],
|
||||
fail_silently=False,
|
||||
)
|
||||
if success == 0:
|
||||
raise Exception('Failed to send email!')
|
||||
|
||||
except Exception as ex:
|
||||
logging.exception('Failed to send email.')
|
||||
|
||||
@@ -18,24 +18,6 @@ from webapp.forms import OhlhafvForm
|
||||
from webapp.tables import OhlhafvTable
|
||||
from members.views.utils import *
|
||||
|
||||
from django.core.mail import send_mail
|
||||
|
||||
|
||||
def send_email(to, subject, body):
|
||||
try:
|
||||
success = send_mail(
|
||||
subject,
|
||||
body,
|
||||
settings.DEFAULT_EMAIL_FROM,
|
||||
[to],
|
||||
fail_silently=False,
|
||||
)
|
||||
if success == 0:
|
||||
raise Exception('Failed to send email!')
|
||||
|
||||
except Exception as ex:
|
||||
logging.exception('Failed to send email.')
|
||||
|
||||
|
||||
@require_http_methods(["GET"])
|
||||
def main_index(request, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user