New design and renaming for the blog which now named chat
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
{% load i18n static %}
|
||||
{% load humanize %}
|
||||
{% block head %}
|
||||
<title> TipPy Blog</title>
|
||||
<title> TipPy Blog</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block nav %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div id="content-main">
|
||||
<div id="content-main">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<h2>TipPy Blog</h2>
|
||||
@@ -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>
|
||||
@@ -67,5 +71,5 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
28
templates/chat.xhtml
Normal file
28
templates/chat.xhtml
Normal 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>
|
||||
@@ -2,46 +2,27 @@
|
||||
{% load i18n static %}
|
||||
{% load humanize %}
|
||||
{% block head %}
|
||||
<script type="text/javascript" src="{% static 'javascript/tippy.js'%}"></script>
|
||||
<script type="text/javascript" src="{% static 'javascript/tippy.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block nav %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% endblock %}
|
||||
|
||||
{% 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 id="content-main">
|
||||
<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">←</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">←</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">→</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">→</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<form role="form" action="" method="post">{% csrf_token %}
|
||||
@@ -56,12 +37,13 @@
|
||||
</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"/>
|
||||
{% else %}
|
||||
<td><img src="{{ STATIC_URL}}{{ match.iconTeam1 }}" />
|
||||
<td><img src="{{ STATIC_URL }}{{ match.iconTeam1 }}"/>
|
||||
{% endif %}
|
||||
<span class="hidden-xs"> {{ match.nameTeam1 }}</span>
|
||||
<span class="visible-xs"> {{ match.abbrTeam1 }}</span>
|
||||
@@ -69,13 +51,14 @@
|
||||
{% if match.iconURLTeam1 != "" %}
|
||||
<td><img src="{{ match.iconURLTeam2 }}" width="20"/>
|
||||
{% else %}
|
||||
<td><img src="{{ STATIC_URL}}{{ match.iconTeam2 }}" />
|
||||
<td><img src="{{ STATIC_URL }}{{ match.iconTeam2 }}"/>
|
||||
{% endif %}
|
||||
<span class="hidden-xs"> {{ match.nameTeam2 }}</span>
|
||||
<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>
|
||||
@@ -100,13 +83,13 @@
|
||||
{% if match.iconURLTeam1 != "" %}
|
||||
<img src="{{ match.iconURLTeam1 }}" width="20"/>
|
||||
{% else %}
|
||||
<img src="{{ STATIC_URL }}{{ match.iconTeam1 }}" />
|
||||
<img src="{{ STATIC_URL }}{{ match.iconTeam1 }}"/>
|
||||
{% endif %}
|
||||
<br /><br />
|
||||
<br/><br/>
|
||||
{% if match.iconURLTeam2 != "" %}
|
||||
<img src="{{ match.iconURLTeam2 }}" width="20"/>
|
||||
{% else %}
|
||||
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}" />
|
||||
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}"/>
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endfor %}
|
||||
@@ -125,5 +108,13 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</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 %}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n static %}
|
||||
{% block head %}
|
||||
<title> TipPy Blog</title>
|
||||
<title> TipPy Blog</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block nav %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% include "nav.html" with ls=ls season=season %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div id="content-main">
|
||||
<div id="content-main">
|
||||
{% if form_bp.errors %}
|
||||
<div>
|
||||
<p class="errornote">
|
||||
@@ -24,16 +24,16 @@
|
||||
<div class="col-md-8">
|
||||
<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>
|
||||
{{ form_bp.content.errors }}
|
||||
<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 %}
|
||||
<label for="{{choice.id_for_label}}">
|
||||
{{ choice.tag }} {{choice.choice_label}}
|
||||
<label for="{{ choice.id_for_label }}">
|
||||
{{ choice.tag }} {{ choice.choice_label }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -54,5 +54,5 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user