New design and renaming for the blog which now named chat

This commit is contained in:
Martin Bley
2022-10-04 17:29:21 +02:00
parent 2f970d6eb4
commit 446a55f3e5
6 changed files with 243 additions and 219 deletions

View File

@@ -19,25 +19,29 @@
</p>
</div>
</div>
<ul class="media-list">
{% for post, avatar in posts %}
<div class="row">
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-heading">
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
</div>
<div class="panel-body">
<li class="media">
<a href="#" class="pull-left">
{% if avatar %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/{{avatar}}" />
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
src="/media/{{ avatar }}"/>
{% else %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/profiles/dummy.png" />
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
src="/media/profiles/dummy.png"/>
{% endif %}
{{post.content|safe}}
</div>
</div>
</div>
</a>
<div class="media-body">
<span class="text-muted pull-right">
<small class="text-muted">{{ post.created|naturaltime }}</small>
</span>
<strong class="text-success">{{ post.author.first_name }}</strong>
<p>{{ post.content|safe }}</p>
</div>
</li>
{% endfor %}
</ul>
<div class="row">
<div class="col-md-7">
<nav>

28
templates/chat.xhtml Normal file
View File

@@ -0,0 +1,28 @@
{% load humanize %}
<hr>
<p class="text-left">
<a class="btn btn-default" href="/blog/newpost" role="button">neuer Post</a>
</p>
<ul class="media-list">
{% for post, avatar in posts %}
<li class="media">
<a href="#" class="pull-left">
{% if avatar %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
src="/media/{{ avatar }}"/>
{% else %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
src="/media/profiles/dummy.png"/>
{% endif %}
</a>
<div class="media-body">
<span class="text-muted pull-right">
<small class="text-muted">{{ post.created|naturaltime }}</small>
</span>
<strong class="text-success">{{ post.author.first_name }}</strong>
<p>{{ post.content|safe }}</p>
</div>
</li>
{% endfor %}
</ul>

View File

@@ -11,37 +11,18 @@
{% block body %}
<div id="content-main">
<div class="row">
<div class="col-md-7">
<h2>Neueste Nachrichten</h2>
<p class="text-right">
<a class="btn btn-default" href="/blog/1" role="button">zum Blog</a>
</p>
{% for post, avatar in posts %}
<div class="panel panel-default">
<div class="panel-heading">
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
</div>
<div class="panel-body">
{% if avatar %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/{{avatar}}" />
{% else %}
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/profiles/dummy.png" />
{% endif %}
{{post.content|safe}}
</div>
</div>
{% endfor %}
</div>
</div>
<div class="row">
<div class="col-md-7">
<h2>Deine Tipps</h2>
<nav>
<ul class="pager">
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous"><a href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"-1"|stringformat:"02i" }}"><span aria-hidden="true">&larr;</span></a></li>
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous"><a
href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"-1"|stringformat:"02i" }}"><span
aria-hidden="true">&larr;</span></a></li>
{{ md_name }}
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next"><a href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"1"|stringformat:"02i" }}"><span aria-hidden="true">&rarr;</span></a></li>
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next"><a
href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"1"|stringformat:"02i" }}"><span
aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
<form role="form" action="" method="post">{% csrf_token %}
@@ -56,7 +37,8 @@
</tr>
{% for match in matches %}
{% if match.started and not match.finished %}
<tr class="danger">{% else %}<tr>{% endif %}
<tr class="danger">{% else %}
<tr>{% endif %}
<td>{{ match.matchDateTime }}</td>
{% if match.iconURLTeam1 != "" %}
<td><img src="{{ match.iconURLTeam1 }}" width="20"/>
@@ -75,7 +57,8 @@
<span class="visible-xs"> {{ match.abbrTeam2 }}</span>
</td>
<td>{{ match.matchResult }}</td>
<td>{{ match.tippFormTeam1 }}</td><td>{{ match.tippFormTeam2 }}</td>
<td>{{ match.tippFormTeam1 }}</td>
<td>{{ match.tippFormTeam2 }}</td>
</tr>
{% endfor %}
</table>
@@ -125,5 +108,13 @@
</div>
{% endfor %}
</div>
<div class="row">
<div class="col-md-7">
<h2>Chat</h2>
{% block chat %}
{% include "chat.xhtml" with posts=posts %}
{% endblock %}
</div>
</div>
</div>
{% endblock %}

View File

@@ -25,10 +25,10 @@
<form class="form-horizontal" action="" method="post">{% csrf_token %}
<div class="form-group">
{{ form_bp.content.errors }}
<label for="id_content" class="col-sm-4 control-label required">{% trans 'Content' %}</label>
<div class="col-sm-5">
<textarea class="form-control" maxlength="256" rows="2"
id="id_content" name="content"></textarea>
<div class="panel-body">
<textarea class="form-control" placeholder="Schreibe einen Kommentar..." id="id_content"
name="content" maxlength="100" rows="2"></textarea>
{% if cnt_mandants > 1 %}
{{ form_mandants.mandants.label_tag }}
{% for choice in form_mandants.mandants %}

View File

@@ -25,7 +25,8 @@ urlpatterns = [
re_path(r'^accounts/login/', auth_views.LoginView.as_view()),
re_path(r'^accounts/logout/', auth_views.LogoutView.as_view())
]
# Redirect on logout
LOGOUT_REDIRECT_URL = "home"
if settings.DEBUG is True:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@@ -446,7 +446,7 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
pm = RelPostMandant.objects.filter(mandant__in=mandants). \
values_list('post', flat=True)
posts = []
for post in Post.objects.filter(id__in=pm, published=True)[:1]:
for post in Post.objects.filter(id__in=pm, published=True)[:5]:
try:
avatar = UserProfile.objects.get(user_id=post.author_id). \
avatar.name