more
This commit is contained in:
parent
2a744c45a2
commit
c3224379ca
@ -9,6 +9,14 @@ div {
|
|||||||
font-family: sans;
|
font-family: sans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
height: 0px;
|
||||||
|
border-width: 1px medium medium;
|
||||||
|
border-color: #b7c5d9;
|
||||||
|
border-style: solid none none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#navbar {
|
#navbar {
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -100,26 +108,38 @@ form {
|
|||||||
flex-basis: 100%;
|
flex-basis: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post > .header {
|
.post-header {
|
||||||
padding-bottom: 1%;
|
padding-bottom: 1%;
|
||||||
|
flex-basis: 100%;
|
||||||
|
flex-direction: row-reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
.postbody {
|
.postbody {
|
||||||
font-family: serif;
|
font-family: serif;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.post-name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #028241;
|
color: #028241;
|
||||||
|
margin-left: 1%;
|
||||||
|
margin-right: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subject {
|
.post-subject {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #480188;
|
color: #480188;
|
||||||
|
margin-left: 1%;
|
||||||
|
margin-right: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-date {
|
||||||
|
font-style: italic;
|
||||||
|
margin-left: 1%;
|
||||||
|
margin-right: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
.posts {
|
.posts {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -143,8 +163,12 @@ footer {
|
|||||||
padding-bottom: 5%;
|
padding-bottom: 5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cite {
|
.post-info {
|
||||||
float: right;
|
flex-basis: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-cite {
|
||||||
|
align-self: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.redtext {
|
.redtext {
|
||||||
|
@ -71,11 +71,11 @@ def createPost(newsgroup, ref, form, files):
|
|||||||
|
|
||||||
server = settings.NNTP_SERVER
|
server = settings.NNTP_SERVER
|
||||||
server['readermode'] = True
|
server['readermode'] = True
|
||||||
msgid = None
|
response = None
|
||||||
try:
|
try:
|
||||||
with nntplib.NNTP(**server) as nntp:
|
with nntplib.NNTP(**server) as nntp:
|
||||||
nntp.login(**settings.NNTP_LOGIN)
|
nntp.login(**settings.NNTP_LOGIN)
|
||||||
msgid = nntp.post(msg.as_bytes())
|
response = nntp.post(msg.as_bytes())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return None, e
|
return None, 'connection to backend failed, {}'.format(e)
|
||||||
return msgid, None
|
return response, None
|
||||||
|
@ -41,8 +41,10 @@ class Postable:
|
|||||||
ctx['msgid'], ctx['error'] = self.handle_post(request, **kwargs)
|
ctx['msgid'], ctx['error'] = self.handle_post(request, **kwargs)
|
||||||
request.session['captcha'] = ''
|
request.session['captcha'] = ''
|
||||||
request.session.save()
|
request.session.save()
|
||||||
|
code = 201
|
||||||
return render(request, 'frontend/postresult.html', ctx)
|
if ctx['error']:
|
||||||
|
code = 200
|
||||||
|
return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code)
|
||||||
|
|
||||||
|
|
||||||
class BoardView(generic.View, Postable):
|
class BoardView(generic.View, Postable):
|
||||||
@ -79,7 +81,7 @@ class BoardView(generic.View, Postable):
|
|||||||
begin = page * group.posts_per_page
|
begin = page * group.posts_per_page
|
||||||
end = begin + group.posts_per_page - 1
|
end = begin + group.posts_per_page - 1
|
||||||
roots = self.model.objects.filter(newsgroup=group, reference='').order_by('-last_bumped')[begin:end]
|
roots = self.model.objects.filter(newsgroup=group, reference='').order_by('-last_bumped')[begin:end]
|
||||||
ctx = self.context_for_get(request, {'threads': roots, 'page': page, 'name': newsgroup})
|
ctx = self.context_for_get(request, {'threads': roots, 'page': page, 'name': newsgroup, 'button': 'new thread'})
|
||||||
if page < group.max_pages:
|
if page < group.max_pages:
|
||||||
ctx['nextpage'] = reverse('board', args=[name]) + '?p={}'.format(page + 1)
|
ctx['nextpage'] = reverse('board', args=[name]) + '?p={}'.format(page + 1)
|
||||||
if page > 0:
|
if page > 0:
|
||||||
@ -103,7 +105,7 @@ class ThreadView(generic.View, Postable):
|
|||||||
|
|
||||||
def get(self, request, op):
|
def get(self, request, op):
|
||||||
posts = get_object_or_404(self.model, posthash=op)
|
posts = get_object_or_404(self.model, posthash=op)
|
||||||
ctx = self.context_for_get(request, {'op': posts})
|
ctx = self.context_for_get(request, {'op': posts, 'button': 'reply'})
|
||||||
return render(request, self.template_name, ctx)
|
return render(request, self.template_name, ctx)
|
||||||
|
|
||||||
class FrontPageView(generic.View):
|
class FrontPageView(generic.View):
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
{% for op in threads %}
|
{% for op in threads %}
|
||||||
<div id="{{op.posthash}}" class="thread">
|
<div id="{{op.posthash}}" class="thread">
|
||||||
<div class="post op">
|
<div class="post op">
|
||||||
<div class="header">
|
<div class="post-header">
|
||||||
<span class="name">{{op.name}}</span> <span class="subject">{{op.subject}}</span>
|
<div class="post-cite"><a href="{{op.get_absolute_url}}">>>{{op.shorthash}}</a></div>
|
||||||
<span class="posted">{{op.postdate|date}}</span>
|
<div class="post-info">
|
||||||
<span class="cite"><a href="{{op.get_absolute_url}}">>>{{op.shorthash}}</a></span>
|
<div class="post-name">{{op.name}}</div>
|
||||||
|
<div class="post-subject">{{op.subject}}</div>
|
||||||
|
<div class="post-date">{{op.postdate|date}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{% for a in op.attachments.all %}
|
{% for a in op.attachments.all %}
|
||||||
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
||||||
@ -31,10 +33,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% for reply in op.get_board_replies %}
|
{% for reply in op.get_board_replies %}
|
||||||
<div class="post reply" id="{{reply.posthash}}">
|
<div class="post reply" id="{{reply.posthash}}">
|
||||||
<div class="header">
|
<div class="post-header">
|
||||||
<span class="name">{{reply.name}}</span> <span class="subject">{{reply.subject}}</span>
|
<div class="post-cite"><a href="{{reply.get_absolute_url}}">>>{{reply.shorthash}}</a></div>
|
||||||
<span class="posted">{{reply.postdate|date}}</span>
|
<div class="post-info">
|
||||||
<span class="cite"><a href="{{reply.get_absolute_url}}">>>{{reply.shorthash}}</a></span>
|
<div class="post-name">{{reply.name}}</div>
|
||||||
|
<div class="post-subject">{{reply.subject}}</div>
|
||||||
|
<div class="post-date">{{reply.postdate|date}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{% for a in reply.attachments.all %}
|
{% for a in reply.attachments.all %}
|
||||||
@ -45,6 +50,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
<hr />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="paginator">
|
<div class="paginator">
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
<div class="frontpage posts">
|
<div class="frontpage posts">
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<div class="header">
|
|
||||||
<span class="boardname"><a href="{{post.newsgroup.get_absolute_url}}">{{post.newsgroup.name}}</a></span>
|
<div class="boardname"><a href="{{post.newsgroup.get_absolute_url}}">{{post.newsgroup.name}}</a></div>
|
||||||
|
<div class="post-header">
|
||||||
|
<div class="post-cite"><a href="{{post.get_absolute_url}}">>>{{post.shorthash}}</a></div>
|
||||||
|
<div class="post-info">
|
||||||
|
<div class="post-name">{{post.name}}</div>
|
||||||
|
<div class="post-subject">{{post.subject}}</div>
|
||||||
|
<div class="post-date">{{post.postdate|date}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header">
|
|
||||||
<span class="name">{{post.name}}</span> <span class="subject">{{post.subject}}</span>
|
|
||||||
<span class="posted">{{post.postdate|date}}</span>
|
|
||||||
<span class="cite"><a href="{{post.get_absolute_url}}">>>{{post.shorthash}}</a></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{% for a in post.attachments.all %}
|
{% for a in post.attachments.all %}
|
||||||
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
||||||
|
@ -2,19 +2,20 @@
|
|||||||
{% load chanup %}
|
{% load chanup %}
|
||||||
{% block title %} {{op.subject}} {% endblock %}
|
{% block title %} {{op.subject}} {% endblock %}
|
||||||
{% block navbar_links %}
|
{% block navbar_links %}
|
||||||
<span class="navbar_link"><a href="{{op.newsgroup.get_absolute_url}}">back to {{op.newsgroup.name}}</a></span>
|
<div class="navbar_link"><a href="{{op.newsgroup.get_absolute_url}}">back to {{op.newsgroup.name}}</a></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "frontend/postform.html" %}
|
{% include "frontend/postform.html" %}
|
||||||
<div id="{{op.posthash}}" class="thread">
|
<div id="{{op.posthash}}" class="thread">
|
||||||
<div class="post op">
|
<div class="post op">
|
||||||
<div class="header">
|
<div class="post-header">
|
||||||
<span class="name">{{op.name}}</span> <span class="subject">{{op.subject}}</span>
|
<div class="post-cite"><a href="{{op.get_absolute_url}}">>>{{op.shorthash}}</a></div>
|
||||||
<span class="msgid">{{op.msgid}}</span>
|
<div class="post-info">
|
||||||
<span class="posted">{{op.postdate|date}}</span>
|
<div class="post-name">{{op.name}}</div>
|
||||||
<span class="cite"><a href="{{op.get_absolute_url}}">>>{{op.shorthash}}</a></span>
|
<div class="post-subject">{{op.subject}}</div>
|
||||||
|
<div class="post-date">{{op.postdate|date}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{% for a in op.attachments.all %}
|
{% for a in op.attachments.all %}
|
||||||
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
<a target="_blank" href="{{a.source}}"><img class="thumb" src="{{a.thumb}}"></img></a>
|
||||||
@ -24,11 +25,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% for reply in op.get_all_replies %}
|
{% for reply in op.get_all_replies %}
|
||||||
<div class="post reply" id="{{reply.posthash}}">
|
<div class="post reply" id="{{reply.posthash}}">
|
||||||
<div class="header">
|
<div class="post-header">
|
||||||
<span class="name">{{reply.name}}</span> <span class="subject">{{reply.subject}}</span>
|
<div class="post-cite"><a href="{{reply.get_absolute_url}}">>>{{reply.shorthash}}</a></div>
|
||||||
<span class="msgid">{{reply.msgid}}</span>
|
<div class="post-info">
|
||||||
<span class="posted">{{reply.postdate|date}}</span>
|
<div class="post-name">{{reply.name}}</div>
|
||||||
<span class="cite"><a href="{{reply.get_absolute_url}}">>>{{reply.shorthash}}</a></span>
|
<div class="post-subject">{{reply.subject}}</div>
|
||||||
|
<div class="post-date">{{reply.postdate|date}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{% for a in reply.attachments.all %}
|
{% for a in reply.attachments.all %}
|
||||||
|
Reference in New Issue
Block a user