Archived
1
0
This commit is contained in:
Jeff Becker 2016-11-08 07:22:43 -05:00
parent 56b90bf5f7
commit e036db805e
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
8 changed files with 36 additions and 11 deletions

View File

@ -0,0 +1,19 @@
/** cite.js */
function thread_citepost(hash) {
var e = document.getElementById("postform_message");
if (!e) return; // no postform element
e.value += ">>"+hash.slice(0, 18) + "\n";
}
function board_postcite(hash) {
// TODO implement
}
onready(function() {
// inject postciter
forEachInClass("post-cite", function(elem) {
});
});

View File

@ -11,3 +11,9 @@ function ready() {
}
}
function forEachInClass(clazz, cb) {
var elems = document.getElementsByClassName(clazz);
for (var idx = 0; idx < elems.length; idx ++) {
cb(elems[idx]);
}
}

View File

@ -48,7 +48,6 @@ def createPost(newsgroup, ref, form, files):
msg['Content-Type'] = 'multipart/mixed'
msg["Subject"] = form["subject"] or "None"
msg['Date'] = email.utils.format_datetime(datetime.now())
msg['Message-ID'] = email.utils.make_msgid(randstr(13), settings.FRONTEND_NAME)
if ref and not msgid_valid(ref):
return None, "invalid reference: {}".format(ref)
if ref:
@ -80,4 +79,4 @@ def createPost(newsgroup, ref, form, files):
return None, 'connection to backend failed, {}'.format(e)
if ref:
return ref, None
return msg["Message-ID"], None
return None, None

View File

@ -44,7 +44,7 @@ class Postable:
code = 201
if ctx['error']:
code = 200
else:
elif ctx['msgid']:
ctx['refresh_url'] = reverse('frontend:thread', args=[util.hashid(ctx['msgid'])])
return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code)

View File

@ -9,6 +9,7 @@
<script type="text/javascript" src="{% static 'banners.js' %}"></script>
<script type="text/javascript" src="{% static 'settings.js' %}"></script>
<script type="text/javascript" src="{% static 'captcha.js' %}"></script>
<script type="text/javascript" src="{% static 'cite.js' %}"></script>
{% block head %}{% endblock %}
</head>
<body>

View File

@ -17,7 +17,8 @@
<div id="{{op.posthash}}" class="thread">
<div class="post op">
<div class="post-header">
<div class="post-cite"><a href="{{op.get_absolute_url}}">&gt;&gt;{{op.shorthash}}</a></div>
<div class="post-reply"><a href="{{op.get_absolute_url}}">[reply]</a></div>
<div class="post-cite"><a onclick="board_citepost('{{op.posthash}}')" href="#{{op.posthash}}">&gt;&gt;{{op.shorthash}}</a></div>
<div class="post-info">
<div class="post-name">{{op.name}}</div>
<div class="post-subject">{{op.subject}}</div>
@ -34,7 +35,8 @@
{% for reply in op.get_board_replies %}
<div class="post reply" id="{{reply.posthash}}">
<div class="post-header">
<div class="post-cite"><a href="{{reply.get_absolute_url}}">&gt;&gt;{{reply.shorthash}}</a></div>
<div class="post-reply"><a href="{{reply.get_absolute_url}}">[reply]</a></div>
<div class="post-cite"><a onclick="board_citepost('{{reply.posthash}}')" href="#{{reply.posthash}}">&gt;&gt;{{reply.shorthash}}</a></div>
<div class="post-info">
<div class="post-name">{{reply.name}}</div>
<div class="post-subject">{{reply.subject}}</div>

View File

@ -8,11 +8,7 @@
{% if error %}
<pre class="error"> failed to post: {{error}} </pre>
{% else %}
{% if msgid %}
<pre class="posted"> posted </pre>
{% else %}
<pre class="posted"> message was not posted </pre>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -9,7 +9,8 @@
<div id="{{op.posthash}}" class="thread">
<div class="post op">
<div class="post-header">
<div class="post-cite"><a href="{{op.get_absolute_url}}">&gt;&gt;{{op.shorthash}}</a></div>
<div class="post-reply"><a href="{{op.get_absolute_url}}">[reply]</a></div>
<div class="post-cite" onclick="thread_citepost('{{op.posthash}}')">&gt;&gt;{{op.shorthash}}</div>
<div class="post-info">
<div class="post-name">{{op.name}}</div>
<div class="post-subject">{{op.subject}}</div>
@ -26,7 +27,8 @@
{% for reply in op.get_all_replies %}
<div class="post reply" id="{{reply.posthash}}">
<div class="post-header">
<div class="post-cite"><a href="{{reply.get_absolute_url}}">&gt;&gt;{{reply.shorthash}}</a></div>
<div class="post-reply"><a href="{{reply.get_absolute_url}}">[reply]</a></div>
<div class="post-cite" onclick="thread_citepost('{{reply.posthash}}')">&gt;&gt;{{reply.shorthash}}</div>
<div class="post-info">
<div class="post-name">{{reply.name}}</div>
<div class="post-subject">{{reply.subject}}</div>