Fix kaehmy styles and templates
This commit is contained in:
@@ -32,4 +32,16 @@ div.tooltip-inner {
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
overflow-wrap: break-word;
|
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>
|
<p class="card-text">{{ application.text|linebreaks|urlize }}</p>
|
||||||
|
|
||||||
{% if application.comment_count > 0 %}
|
{% 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 }})
|
{% trans "Show comments" %} ({{ application.comment_count }})
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div>
|
<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" %}
|
{% trans "Add comment" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<h6 class="card-subtitle mb-2 text-muted">{{ message.timestamp }}</h6>
|
<h6 class="card-subtitle mb-2 text-muted">{{ message.timestamp }}</h6>
|
||||||
<div>
|
<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" %}
|
{% trans "Reply" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+6
-3
@@ -14,7 +14,8 @@ from dealer.git import git
|
|||||||
|
|
||||||
from members.views.utils import *
|
from members.views.utils import *
|
||||||
from kaehmy.models import Application, CustomRole, PresetRole
|
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
|
@ensure_csrf_cookie
|
||||||
@@ -42,6 +43,9 @@ def list_view(request, *args, **kwargs):
|
|||||||
'application_count': len(applications),
|
'application_count': len(applications),
|
||||||
'filter_options': filter_options
|
'filter_options': filter_options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(applications[0])
|
||||||
|
|
||||||
return render(request, 'list.html', context)
|
return render(request, 'list.html', context)
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +54,7 @@ def list_view(request, *args, **kwargs):
|
|||||||
def comment(request, *args, **kwargs):
|
def comment(request, *args, **kwargs):
|
||||||
"""POST endpoint for commenting"""
|
"""POST endpoint for commenting"""
|
||||||
|
|
||||||
form = KaehmyCommentForm(request.POST)
|
form = CommentForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
comment = form.save()
|
comment = form.save()
|
||||||
email = comment.parent.email
|
email = comment.parent.email
|
||||||
@@ -66,7 +70,6 @@ def comment(request, *args, **kwargs):
|
|||||||
|
|
||||||
return redirect('/kaehmy')
|
return redirect('/kaehmy')
|
||||||
else:
|
else:
|
||||||
print(form)
|
|
||||||
context = {
|
context = {
|
||||||
'error': form.errors
|
'error': form.errors
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+3232
-1849
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,6 @@
|
|||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
console.log('pippeli')
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
+19
-1
@@ -1,9 +1,27 @@
|
|||||||
"""Webapp utils."""
|
"""Webapp utils."""
|
||||||
|
|
||||||
from django.utils import timezone
|
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():
|
def month_from_now():
|
||||||
"""Return date one month from now."""
|
"""Return date one month from now."""
|
||||||
return timezone.now() + timedelta(days=30)
|
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 webapp.tables import OhlhafvTable
|
||||||
from members.views.utils import *
|
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"])
|
@require_http_methods(["GET"])
|
||||||
def main_index(request, *args, **kwargs):
|
def main_index(request, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user