diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/static/style.css b/contrib/frontends/django/nntpchan/nntpchan/frontend/static/style.css index a08ac09..16b1d93 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/static/style.css +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/static/style.css @@ -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 { diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py index 1ab17c6..a48fc74 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py @@ -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 diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py index 869b0c8..7376d37 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py @@ -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): diff --git a/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/board.html b/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/board.html index bc0961c..5926e44 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/board.html +++ b/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/board.html @@ -16,12 +16,14 @@ {% for op in threads %}