Fix kaehmy styles and templates

This commit is contained in:
Jan Tuomi
2018-01-28 16:56:51 +02:00
parent 77330dffe9
commit 7dc9fac597
8 changed files with 3272 additions and 1875 deletions
+12
View File
@@ -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;
}
+2 -2
View File
@@ -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>
+1 -1
View File
@@ -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
View File
@@ -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
}
+3232 -1849
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -27,7 +27,6 @@
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
console.log('pippeli')
})
</script>
+19 -1
View File
@@ -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
View File
@@ -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):