Update various windows that open to have their height automatically set
Some windows have a variable height based on the user's permissions (e.g. having a capcode option). This sets the window height to the minimum requiremed height based on the document loaded in. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -28,8 +28,11 @@ function openBanWindow(banUrl) {
|
|||||||
title: "New Ban",
|
title: "New Ban",
|
||||||
name: banWindowName,
|
name: banWindowName,
|
||||||
width: 475,
|
width: 475,
|
||||||
height: 475,
|
|
||||||
url: banUrl,
|
url: banUrl,
|
||||||
});
|
});
|
||||||
|
$(banWindow.iframe, "iframe").on("load", () => {
|
||||||
|
fitWindowToContent(banWindow);
|
||||||
|
banWindow.setResizable(false);
|
||||||
|
});
|
||||||
banWindow.show();
|
banWindow.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,11 @@ function openModifyWindow(modifyUrl) {
|
|||||||
title: "Modifying post",
|
title: "Modifying post",
|
||||||
name: modifyWindowName,
|
name: modifyWindowName,
|
||||||
width: 475,
|
width: 475,
|
||||||
height: 475,
|
|
||||||
url: modifyUrl,
|
url: modifyUrl,
|
||||||
});
|
});
|
||||||
|
$(modifyWindow.iframe, "iframe").on("load", () => {
|
||||||
|
fitWindowToContent(modifyWindow);
|
||||||
|
modifyWindow.setResizable(false);
|
||||||
|
});
|
||||||
modifyWindow.show();
|
modifyWindow.show();
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ const CLOSED = "closed";
|
|||||||
const replyWindowName = "reply-window";
|
const replyWindowName = "reply-window";
|
||||||
const postWindowName = "post-window";
|
const postWindowName = "post-window";
|
||||||
const reportWindowName = "report-window"
|
const reportWindowName = "report-window"
|
||||||
|
const WINDOW_INNER_PADDING = 25;
|
||||||
|
|
||||||
function documentClick(e) {
|
function documentClick(e) {
|
||||||
let sender = e.target;
|
let sender = e.target;
|
||||||
@@ -53,6 +54,14 @@ function openMenu(e) {
|
|||||||
$(document).on("click", closeMenu);
|
$(document).on("click", closeMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Generic window functions
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
function fitWindowToContent(frame) {
|
||||||
|
let rect = frame.$("html").getBoundingClientRect();
|
||||||
|
frame.setSize(rect.width, rect.bottom + WINDOW_INNER_PADDING)
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Reply window
|
// Reply window
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -67,10 +76,13 @@ function openReplyWindow(replyUrl) {
|
|||||||
let replyWindow = window.top.jsFrame.create({
|
let replyWindow = window.top.jsFrame.create({
|
||||||
title: "New Reply",
|
title: "New Reply",
|
||||||
name: replyWindowName,
|
name: replyWindowName,
|
||||||
width: 385,
|
width: 500,
|
||||||
height: 350,
|
|
||||||
url: replyUrl
|
url: replyUrl
|
||||||
});
|
});
|
||||||
|
$(replyWindow.iframe, "iframe").on("load", () => {
|
||||||
|
fitWindowToContent(replyWindow);
|
||||||
|
replyWindow.$("#id_text").focus();
|
||||||
|
});
|
||||||
replyWindow.show();
|
replyWindow.show();
|
||||||
return replyWindow;
|
return replyWindow;
|
||||||
}
|
}
|
||||||
@@ -114,10 +126,13 @@ function openPostWindow(postUrl) {
|
|||||||
let postWindow = window.top.jsFrame.create({
|
let postWindow = window.top.jsFrame.create({
|
||||||
title: "New Thread",
|
title: "New Thread",
|
||||||
name: postWindowName,
|
name: postWindowName,
|
||||||
width: 385,
|
width: 500,
|
||||||
height: 350,
|
|
||||||
url: postUrl,
|
url: postUrl,
|
||||||
});
|
});
|
||||||
|
$(postWindow.iframe, "iframe").on("load", () => {
|
||||||
|
fitWindowToContent(postWindow);
|
||||||
|
postWindow.$("#id_text").focus();
|
||||||
|
});
|
||||||
postWindow.show();
|
postWindow.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +156,11 @@ function openReportWindow(reportUrl) {
|
|||||||
let reportWindow = window.top.jsFrame.create({
|
let reportWindow = window.top.jsFrame.create({
|
||||||
url: reportUrl,
|
url: reportUrl,
|
||||||
name: reportWindowName,
|
name: reportWindowName,
|
||||||
modal: true,
|
|
||||||
width: 360,
|
width: 360,
|
||||||
height: 95,
|
});
|
||||||
|
$(reportWindow.iframe, "iframe").on("load", () => {
|
||||||
|
fitWindowToContent(reportWindow);
|
||||||
|
reportWindow.setResizable(false);
|
||||||
});
|
});
|
||||||
reportWindow.show();
|
reportWindow.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,30 @@
|
|||||||
{% extends "board/base.html" %}
|
{% extends "board/base.html" %}
|
||||||
{% load i18n post_body %}
|
{% load i18n post_body %}
|
||||||
|
|
||||||
|
{% block extrastyle %}
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
width: 1%;
|
||||||
|
white-space: wrap;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
input[type=text] {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post" action="{% url 'board:post_create' url=board.url %}" enctype="multipart/form-data">
|
<form method="post" action="{% url 'board:post_create' url=board.url %}" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|||||||
@@ -1,11 +1,34 @@
|
|||||||
{% extends "board/base.html" %}
|
{% extends "board/base.html" %}
|
||||||
{% load i18n post_body %}
|
{% load i18n post_body %}
|
||||||
|
|
||||||
|
{% block extrastyle %}
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
width: 1%;
|
||||||
|
white-space: wrap;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
input[type=text] {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post" action="{% url 'board:reply_create' url=board.url id=post.id %}" enctype="multipart/form-data">
|
<form method="post" action="{% url 'board:reply_create' url=board.url id=post.id %}" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
{# {{ form.as_table }} #}
|
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% if field.name != "capcode" %}
|
{% if field.name != "capcode" %}
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user