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