Add floating window for new threads
New threads get a floating window just like new replies have. This only pops up on the board detail view. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -23,23 +23,9 @@
|
||||
<div class="column"> </div>
|
||||
<div class="column">
|
||||
<div class="row">
|
||||
<h2>{% translate "Create a new thread" %}</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form method="post" action="{% url 'board:board_detail' url=board.url %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td>
|
||||
{% translate "Max image size" %}:
|
||||
{{ max_upload_size|measure_bytes }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th> </th><td><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<h2>
|
||||
<a id="create_post" href="{% url 'board:post_create' url=board.url %}">{% translate "Create a new thread" %}</a>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column"> </div>
|
||||
@@ -85,4 +71,12 @@
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const POST_URL = "{% url 'board:post_create' url=board.url %}";
|
||||
$("#create_post").on("click", (e) => {
|
||||
e.preventDefault();
|
||||
openPostWindow(POST_URL);
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
34
board/templates/board/post_create_view.html
Normal file
34
board/templates/board/post_create_view.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{% extends "board/base.html" %}
|
||||
{% load i18n post_body %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="{% url 'board:post_create' url=board.url %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{% for field in form %}
|
||||
{% if field.name != "capcode" %}
|
||||
<tr>
|
||||
<th>{{field.label_tag}}</th>
|
||||
<td>{{field}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if capcodes %}
|
||||
<tr>
|
||||
<th>{{form.capcode.label_tag}}</th>
|
||||
<td>
|
||||
{{form.capcode}}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td>
|
||||
{% translate "Max image size" %}:
|
||||
{{ max_upload_size|measure_bytes }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td> </td><td><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
@@ -54,14 +54,7 @@ $("#create_reply").on("click", (e) => {
|
||||
$(window).on("quote", (e, postId) => {
|
||||
openReplyWindow(REPLY_URL);
|
||||
let toAdd = ">>" + postId + "\n";
|
||||
let textbox = replyTextbox();
|
||||
if (typeof textbox === "undefined" || textbox.length === 0) {
|
||||
$("iframe").on("load", () => {
|
||||
replyAppend(toAdd);
|
||||
});
|
||||
} else {
|
||||
replyAppend(toAdd);
|
||||
}
|
||||
replyAppend(toAdd);
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
@@ -15,16 +15,22 @@ function isIframe() {
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
if(isIframe()) {
|
||||
// check for possible windows
|
||||
let replyWindow = getReplyWindow();
|
||||
if(replyWindow) {
|
||||
replyWindow.closeFrame();
|
||||
$(window).on("load", () => {
|
||||
setTimeout(function() {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
let next = params.get("next");
|
||||
let target = isIframe()
|
||||
? window.top
|
||||
: window;
|
||||
if(next) {
|
||||
target.location = next;
|
||||
if(next.includes("#")) {
|
||||
target.location.reload();
|
||||
}
|
||||
} else {
|
||||
target.close();
|
||||
}
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
}, 1000 * {{window_timeout}});
|
||||
}, 1000 * {{window_timeout}});
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user