more
This commit is contained in:
parent
56b90bf5f7
commit
e036db805e
@ -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) {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
@ -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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,7 +48,6 @@ def createPost(newsgroup, ref, form, files):
|
|||||||
msg['Content-Type'] = 'multipart/mixed'
|
msg['Content-Type'] = 'multipart/mixed'
|
||||||
msg["Subject"] = form["subject"] or "None"
|
msg["Subject"] = form["subject"] or "None"
|
||||||
msg['Date'] = email.utils.format_datetime(datetime.now())
|
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):
|
if ref and not msgid_valid(ref):
|
||||||
return None, "invalid reference: {}".format(ref)
|
return None, "invalid reference: {}".format(ref)
|
||||||
if ref:
|
if ref:
|
||||||
@ -80,4 +79,4 @@ def createPost(newsgroup, ref, form, files):
|
|||||||
return None, 'connection to backend failed, {}'.format(e)
|
return None, 'connection to backend failed, {}'.format(e)
|
||||||
if ref:
|
if ref:
|
||||||
return ref, None
|
return ref, None
|
||||||
return msg["Message-ID"], None
|
return None, None
|
||||||
|
@ -44,7 +44,7 @@ class Postable:
|
|||||||
code = 201
|
code = 201
|
||||||
if ctx['error']:
|
if ctx['error']:
|
||||||
code = 200
|
code = 200
|
||||||
else:
|
elif ctx['msgid']:
|
||||||
ctx['refresh_url'] = reverse('frontend:thread', args=[util.hashid(ctx['msgid'])])
|
ctx['refresh_url'] = reverse('frontend:thread', args=[util.hashid(ctx['msgid'])])
|
||||||
return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code)
|
return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code)
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<script type="text/javascript" src="{% static 'banners.js' %}"></script>
|
<script type="text/javascript" src="{% static 'banners.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'settings.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 'captcha.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'cite.js' %}"></script>
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
<div id="{{op.posthash}}" class="thread">
|
<div id="{{op.posthash}}" class="thread">
|
||||||
<div class="post op">
|
<div class="post op">
|
||||||
<div class="post-header">
|
<div class="post-header">
|
||||||
<div class="post-cite"><a href="{{op.get_absolute_url}}">>>{{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}}">>>{{op.shorthash}}</a></div>
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<div class="post-name">{{op.name}}</div>
|
<div class="post-name">{{op.name}}</div>
|
||||||
<div class="post-subject">{{op.subject}}</div>
|
<div class="post-subject">{{op.subject}}</div>
|
||||||
@ -34,7 +35,8 @@
|
|||||||
{% 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="post-header">
|
<div class="post-header">
|
||||||
<div class="post-cite"><a href="{{reply.get_absolute_url}}">>>{{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}}">>>{{reply.shorthash}}</a></div>
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<div class="post-name">{{reply.name}}</div>
|
<div class="post-name">{{reply.name}}</div>
|
||||||
<div class="post-subject">{{reply.subject}}</div>
|
<div class="post-subject">{{reply.subject}}</div>
|
||||||
|
@ -8,11 +8,7 @@
|
|||||||
{% if error %}
|
{% if error %}
|
||||||
<pre class="error"> failed to post: {{error}} </pre>
|
<pre class="error"> failed to post: {{error}} </pre>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if msgid %}
|
|
||||||
<pre class="posted"> posted </pre>
|
<pre class="posted"> posted </pre>
|
||||||
{% else %}
|
|
||||||
<pre class="posted"> message was not posted </pre>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
<div id="{{op.posthash}}" class="thread">
|
<div id="{{op.posthash}}" class="thread">
|
||||||
<div class="post op">
|
<div class="post op">
|
||||||
<div class="post-header">
|
<div class="post-header">
|
||||||
<div class="post-cite"><a href="{{op.get_absolute_url}}">>>{{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}}')">>>{{op.shorthash}}</div>
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<div class="post-name">{{op.name}}</div>
|
<div class="post-name">{{op.name}}</div>
|
||||||
<div class="post-subject">{{op.subject}}</div>
|
<div class="post-subject">{{op.subject}}</div>
|
||||||
@ -26,7 +27,8 @@
|
|||||||
{% 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="post-header">
|
<div class="post-header">
|
||||||
<div class="post-cite"><a href="{{reply.get_absolute_url}}">>>{{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}}')">>>{{reply.shorthash}}</div>
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<div class="post-name">{{reply.name}}</div>
|
<div class="post-name">{{reply.name}}</div>
|
||||||
<div class="post-subject">{{reply.subject}}</div>
|
<div class="post-subject">{{reply.subject}}</div>
|
||||||
|
Reference in New Issue
Block a user