Archived
1
0

add initial censor ui

This commit is contained in:
Jeff Becker 2016-11-09 12:22:22 -05:00
parent e036db805e
commit 518a32016b
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
11 changed files with 206 additions and 36 deletions

View File

@ -0,0 +1,28 @@
/** censor tools */
function show_censortools() {
var e = document.getElementById("censor-tools");
e.checked = true;
}
function nntpchan_report_thread(posthash) {
var thread = document.getElementById(posthash);
if (!thread) return;
var posts = thread.getElementsByClassName("post");
for (var idx = 0; idx < posts.length; idx ++ ) {
var post = posts[idx];
nntpchan_report(post.dataset.msgid);
}
}
function nntpchan_report(msgid) {
var e = document.getElementById("modactions");
if (!e) return;
e.value += "delete "+msgid+"\n";
show_censortools();
}
onready(function() {
});

View File

@ -85,11 +85,12 @@ form {
width: 90%;
}
.postreport {
width: 100px;
}
.postform {
flex-direction: column;
align-items: flex-start;
max-height: 25%;
width: 90%;
width: 75%;
}
.pf-left {
@ -98,23 +99,6 @@ form {
width: 50%;
}
.postform > input {
align-items: flex-start;
}
.pf-item {
flex-basis: 100%;
flex-direction: row;
}
.pf-inner {
align-content: flex-start;
align-self: flex-end;
flex-direction: column;
width: 100%;
flex-basis: 100%;
}
.post-header {
padding-bottom: 1%;
flex-basis: 100%;
@ -206,3 +190,76 @@ footer {
.psy {
animation: psych 2s linear infinite;
}
.postform > tr, th {
background: #98E;
font-size: 10pt;
text-align: left;
padding-right: 10px;
padding-left: 4px;
}
.postform td{
padding: 0px 15px 0px 4px;
}
table {
margin: auto;
}
table.board-list-table {
width: 100%;
}
table tbody td {
margin: 0;
padding: 4px 15px 4px 4px;
vertical-align: top;
text-align: left;
}
table thead th {
border: 1px solid #000333;
padding: 4px 15px 5px 5px;
background: #98E;
color: #000333;
text-align: left;
white-space: nowrap;
}
.postform td{
padding: 0px 15px 0px 4px;
}
input[type="text"],input[type="password"],textarea {
border: 1px solid #a9a9a9;
text-indent: 0;
text-shadow: none;
text-transform: none;
word-spacing: normal;
font-size: inherit;
font-family: sans-serif;
}
/** mod stuff */
[type=checkbox] {
display: none;
}
:checked + div {
display: block !important;
}
#censor-toggle {
font-style: italic;
text-decoration: underline;
font-weight: normal;
}
#censor-toggle, a {
color: #34345C;
}
a:hover {
color: #ff0000;
}

View File

@ -4,7 +4,8 @@ from . import views
urlpatterns = [
url(r'^ctl-(?P<page>[0-9]+)\.html$', views.modlog, name='old-modlog'),
url(r'^ctl/((?P<page>[0-9]+)/)?$', views.modlog, name='modlog'),
url(r'^mod/$', views.modlog, name='modlog'),
url(r'^mod/(?P<page>[0-9]+)$', views.modlog, name='modlog-page'),
url(r'^overchan\.(?P<name>[a-zA-Z0-9\.]+)-(?P<page>[0-9]+)\.html$', views.BoardView.as_view(), name='old-board'),
url(r'^overchan\.(?P<name>[a-zA-Z0-9\.]+)/', views.BoardView.as_view(), name='board-alt'),
url(r'^thread-(?P<op>[a-fA-F0-9\.]{40})\.html$', views.ThreadView.as_view(), name='old-thread'),

View File

@ -121,10 +121,21 @@ class FrontPageView(generic.View):
return render(request, self.template_name, ctx)
def modlog(request, page):
if page is None:
page = 0
return HttpResponse('mod log page {}'.format(page))
def modlog(request, page=None):
page = int(page or '0')
ctx = {
'page': page,
}
if page > 0:
ctx['prevpage'] = reverse('frontend:modlog-page', args=[page - 1])
group, _ = Newsgroup.objects.get_or_create(name='ctl')
if page < group.max_pages:
ctx['nextpage'] = reverse('frontend:modlog-page', args=[page + 1])
begin = group.posts_per_page * page
end = begin + group.posts_per_page - 1
ctx['threads'] = Post.objects.filter(newsgroup='ctl').order_by('-last_bumped')[begin:end]
return render(request, 'frontend/board.html', ctx)
def create_captcha(request):
solution = util.randstr(7).lower()

View File

@ -112,7 +112,7 @@ DATE_FORMAT = "r"
USE_I18N = True
USE_L10N = True
USE_L10N = False
USE_TZ = True

View File

@ -10,6 +10,7 @@
<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>
<script type="text/javascript" src="{% static 'censor.js' %}"></script>
{% block head %}{% endblock %}
</head>
<body>

View File

@ -12,14 +12,25 @@
{% endif %}
{% endblock %}
{% block content %}
{% if captcha %}
{% include "frontend/postform.html" %}
{% endif %}
{% for op in threads %}
<div id="{{op.posthash}}" class="thread">
<div class="post op">
<div class="post op" data-msgid="{{op.msgid}}">
<div class="post-header">
<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-report">
<label for="report_{{op.posthash}}">[x]</label>
<input type="checkbox" id="report_{{op.posthash}}">
<div style="display: none;" onclick="nntpchan_report_thread('{{op.posthash}}')">
<div class="mod-delete">
[delete thread]
</div>
</div>
</div>
<div class="post-name">{{op.name}}</div>
<div class="post-subject">{{op.subject}}</div>
<div class="post-date">{{op.postdate|date}}</div>
@ -33,12 +44,20 @@
<pre class="postbody">{{op.message|truncate|memepost}}</pre>
</div>
{% for reply in op.get_board_replies %}
<div class="post reply" id="{{reply.posthash}}">
<div class="post reply" data-msgid="{{reply.msgid}}" id="{{reply.posthash}}">
<div class="post-header">
<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-report">
<label for="report_{{reply.posthash}}">[x]</label>
<input type="checkbox" id="report_{{reply.posthash}}">
<div style="display: none;" onclick="nntpchan_report('{{reply.msgid}}')">
<div class="mod-delete">
[delete post]
</div>
</div>
</div> <div class="post-name">{{reply.name}}</div>
<div class="post-subject">{{reply.subject}}</div>
<div class="post-date">{{reply.postdate|date}}</div>
</div>
@ -54,7 +73,6 @@
</div>
<hr />
{% endfor %}
<div class="paginator">
{% if prevpage %}
<span class="paginator_item"><a href="{{prevpage}}">prev</a></span>

View File

@ -0,0 +1 @@
{% extends "frontend/base.html" %}

View File

@ -0,0 +1,2 @@
<!-- begin modform -->
<!-- end modform -->

View File

@ -6,6 +6,7 @@
<tbody>
<tr>
<th>
Name
</th>
<td>
<span>
@ -16,6 +17,7 @@
</tr>
<tr>
<th>
Subject
</th>
<td>
<input type="text" name="subject" value="" id="postform_subject" />
@ -24,9 +26,10 @@
</tr>
<tr>
<th>
Message
</th>
<td>
<textarea id="postform_message" name="message" cols=40 rows=5></textarea>
<textarea cols=100 rows=10 id="postform_message" name="message"></textarea>
</td>
</tr>
<tr>
@ -38,7 +41,7 @@
</tr>
<tr>
<th>
Captcha
</th>
<td>
<img id="captcha_img" src="{{ captcha }}" alt="captcha" />
@ -46,11 +49,41 @@
</tr>
<tr>
<th>
Solution
</th>
<td>
<input type="text" name="captcha" autocomplete="off" id="captcha_solution" height="175" width="350"/>
</td>
</tr>
<tr>
<th>
<label id="censor-toggle" for="censor-tools">[censor tools]</label>
</th>
<td>
<input type="checkbox" id="censor-tools"><div style="display: none;">
<table>
<tbody>
<tr>
<th>
Actions:
</th>
<td>
<textarea cols=85 name="modactions" id="modactions"></textarea>
</td>
</tr>
<tr>
<th>
Secret:
</th>
<td>
<input type="password" name="modkey"></input>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>

View File

@ -7,11 +7,20 @@
{% block content %}
{% include "frontend/postform.html" %}
<div id="{{op.posthash}}" class="thread">
<div class="post op">
<div class="post op" data-msgid="{{op.msgid}}">
<div class="post-header">
<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-report">
<label for="report_{{op.posthash}}">[x]</label>
<input type="checkbox" id="report_{{op.posthash}}">
<div style="display: none;" onclick="nntpchan_report_thread('{{op.posthash}}')">
<div class="mod-delete">
[delete thread]
</div>
</div>
</div>
<div class="post-name">{{op.name}}</div>
<div class="post-subject">{{op.subject}}</div>
<div class="post-date">{{op.postdate|date}}</div>
@ -25,11 +34,20 @@
<pre class="postbody">{{op.message|memepost}}</pre>
</div>
{% for reply in op.get_all_replies %}
<div class="post reply" id="{{reply.posthash}}">
<div class="post reply" data-msgid="{{reply.msgid}}" id="{{reply.posthash}}">
<div class="post-header">
<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-report">
<label for="report_{{reply.posthash}}">[x]</label>
<input type="checkbox" id="report_{{reply.posthash}}">
<div style="display: none;" onclick="nntpchan_report('{{reply.msgid}}')">
<div class="mod-delete">
[delete post]
</div>
</div>
</div>
<div class="post-name">{{reply.name}}</div>
<div class="post-subject">{{reply.subject}}</div>
<div class="post-date">{{reply.postdate|date}}</div>