show pending status, add some css
This commit is contained in:
parent
1bafe193ad
commit
2e1831f609
@ -39,7 +39,7 @@ def create(app, environ, request, path):
|
|||||||
md5 = rv.md5
|
md5 = rv.md5
|
||||||
rv.text = app.markup.convert(rv.text)
|
rv.text = app.markup.convert(rv.text)
|
||||||
|
|
||||||
response = Response(json.dumps(rv), 201, content_type='application/json')
|
response = Response(json.dumps(rv), 202 if rv.pending else 201, content_type='application/json')
|
||||||
response.set_cookie('session-%s-%s' % (urllib.quote(path, ''), rv.id),
|
response.set_cookie('session-%s-%s' % (urllib.quote(path, ''), rv.id),
|
||||||
app.signer.dumps([path, rv.id, md5]), max_age=app.MAX_AGE)
|
app.signer.dumps([path, rv.id, md5]), max_age=app.MAX_AGE)
|
||||||
return response
|
return response
|
||||||
|
@ -91,7 +91,7 @@ function form(id, appendfunc, eventfunc) {
|
|||||||
var formid = 'issoform' + (id ? ('_' + id) : ''), form =
|
var formid = 'issoform' + (id ? ('_' + id) : ''), form =
|
||||||
'<div class="issoform" id="' + formid + '">' +
|
'<div class="issoform" id="' + formid + '">' +
|
||||||
'<div>' +
|
'<div>' +
|
||||||
' <input type="text" name="name" id="author" value="" placeholder="Name">' +
|
' <input type="text" name="author" id="author" value="" placeholder="Name">' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div>' +
|
'<div>' +
|
||||||
' <input type="email" name="email" id="email" value="" placeholder="Email">' +
|
' <input type="email" name="email" id="email" value="" placeholder="Email">' +
|
||||||
@ -100,7 +100,7 @@ function form(id, appendfunc, eventfunc) {
|
|||||||
'<input type="url" name="website" id="website" value="" placeholder="Website URL">' +
|
'<input type="url" name="website" id="website" value="" placeholder="Website URL">' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div>' +
|
'<div>' +
|
||||||
' <textarea rows="10" name="comment" id="comment" placeholder="Comment"></textarea>' +
|
' <textarea rows="10" name="text" id="comment" placeholder="Comment"></textarea>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div>' +
|
'<div>' +
|
||||||
'<input type="submit" name="submit" value="Add Comment">' +
|
'<input type="submit" name="submit" value="Add Comment">' +
|
||||||
@ -127,12 +127,6 @@ function insert(post) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var path = encodeURIComponent(window.location.pathname);
|
var path = encodeURIComponent(window.location.pathname);
|
||||||
var author = post['author'] || 'Anonymous';
|
|
||||||
|
|
||||||
if (post['website']) {
|
|
||||||
author = '<a href="' + post['website'] + '" rel="nofollow">' + author + '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
var date = new Date(parseInt(post['created']) * 1000);
|
var date = new Date(parseInt(post['created']) * 1000);
|
||||||
|
|
||||||
// create <ul /> for parent, if used
|
// create <ul /> for parent, if used
|
||||||
@ -140,19 +134,48 @@ function insert(post) {
|
|||||||
$('#isso_' + post['parent']).append('<ul></ul>');
|
$('#isso_' + post['parent']).append('<ul></ul>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(post['parent'] ? '#isso_' + post['parent'] + ' > ul:last-child' : '#isso_thread > ul').append(
|
$(post['parent'] ? '#isso_' + post['parent'] + ' > ul:last-child' : '#isso_thread > ul')
|
||||||
|
.append(
|
||||||
'<article class="isso" id="isso_' + post['id'] + '">' +
|
'<article class="isso" id="isso_' + post['id'] + '">' +
|
||||||
' <header><span class="author">' + author + '</span>' +
|
' <header></header>' +
|
||||||
' </header>' +
|
' <div></div>' +
|
||||||
' <div class="text">' + post['text'] +
|
' <footer></footer>' +
|
||||||
' </div>' +
|
'</article>'
|
||||||
' <footer>' +
|
);
|
||||||
' <a href="#">Antworten</a>' +
|
|
||||||
' <a href="#isso_' + post['id'] + '">#' + post['id'] + '</a>' +
|
var node = $('#isso_' + post['id']),
|
||||||
' <time datetime="' + date.getUTCFullYear() + '-' + date.getUTCMonth() + '-' + date.getUTCDate() + '">' + format(date) +
|
author = post['author'] || 'Anonymous';
|
||||||
' </time>' +
|
|
||||||
' </footer>' +
|
if (post['website'])
|
||||||
'</article>');
|
author = '<a href="' + post['website'] + '" rel="nofollow">' + author + '</a>';
|
||||||
|
|
||||||
|
// deleted
|
||||||
|
if (post['mode'] == 4) {
|
||||||
|
node.addClass('deleted');
|
||||||
|
$('header', node).append('Kommentar entfernt')
|
||||||
|
$('div', node).append('<p> </p>')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('header', node).append('<span class="author">' + author + '</span>');
|
||||||
|
if (post['mode'] == 2 )
|
||||||
|
$('helpers', node).append('<span class="note">Kommentar muss noch freigeschaltet werden</span>');
|
||||||
|
|
||||||
|
$('div', node).append(post['text']);
|
||||||
|
|
||||||
|
$('footer', node).append(
|
||||||
|
'<a href="#">Antworten</a>' +
|
||||||
|
'<a href="#isso_' + post['id'] + '">#' + post['id'] + '</a>' +
|
||||||
|
'<time datetime="' + date.getUTCFullYear() + '-' + date.getUTCMonth() + '-' +
|
||||||
|
date.getUTCDate() + '">' + format(date) +
|
||||||
|
'</time>'
|
||||||
|
)
|
||||||
|
|
||||||
|
// pending notification
|
||||||
|
if (post['mode'] == 2 ) {
|
||||||
|
$('#isso_' + post['id'] + ' header')
|
||||||
|
.append('<span class="note">Kommentar muss noch freigeschaltet werden</span>');
|
||||||
|
}
|
||||||
|
|
||||||
if (read('session-' + path + '-' + post['id'])) {
|
if (read('session-' + path + '-' + post['id'])) {
|
||||||
$('#isso_' + post['id'] + '> footer > a:first-child')
|
$('#isso_' + post['id'] + '> footer > a:first-child')
|
||||||
@ -225,10 +248,11 @@ function insert(post) {
|
|||||||
parent: post['id']
|
parent: post['id']
|
||||||
}, function(status, rv) {
|
}, function(status, rv) {
|
||||||
$('#issoform_' + post['id']).remove();
|
$('#issoform_' + post['id']).remove();
|
||||||
|
if (status == 201 || status == 202) {
|
||||||
if (status == 201) {
|
|
||||||
insert(JSON.parse(rv));
|
insert(JSON.parse(rv));
|
||||||
} // XXX else ...
|
} else {
|
||||||
|
alert("Mööp.");
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -260,7 +284,7 @@ function initialize(thread) {
|
|||||||
website: $('input[id="website"]').val() || null,
|
website: $('input[id="website"]').val() || null,
|
||||||
parent: null
|
parent: null
|
||||||
}, function(status, rv) {
|
}, function(status, rv) {
|
||||||
if (status == 201) {
|
if (status == 201 || status == 202) {
|
||||||
insert(JSON.parse(rv));
|
insert(JSON.parse(rv));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,18 +8,37 @@
|
|||||||
margin-top: 18px;
|
margin-top: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isso footer a, .isso header a {
|
||||||
|
color: #111111;
|
||||||
|
font-family: Palatino, "times new roman", serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.95em;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isso footer a:hover, .isso header a:hover {
|
||||||
|
color: #111111;
|
||||||
|
text-shadow: #aaaaaa 0px 0px 1px;
|
||||||
|
}
|
||||||
|
|
||||||
.isso .author {
|
.isso .author {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.isso time {
|
.isso time {
|
||||||
color: lightgray;
|
color: lightgray;
|
||||||
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.isso > header {
|
.isso > header {
|
||||||
border-bottom: solid 1px lightgray;
|
border-bottom: solid 1px lightgray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isso > header .note {
|
||||||
|
float: right;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
.isso > footer > a {
|
.isso > footer > a {
|
||||||
padding: 0 10px 10px 0;
|
padding: 0 10px 10px 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user