Implemented collapse bar colorization on the server side
This commit is contained in:
parent
d62b6e8215
commit
0bfbf17e45
6 changed files with 35 additions and 9 deletions
|
@ -36,6 +36,17 @@
|
|||
--background-odd: #fafafa;
|
||||
}
|
||||
|
||||
/* TODO: Update colors here for whatever depth */
|
||||
.collapse-bar-1 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-2 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-3 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-4 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-5 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-6 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-7 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-8 { border-color: var(--primary-overlay) !important; }
|
||||
.collapse-bar-9 { border-color: var(--primary-overlay) !important; }
|
||||
|
||||
* {
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
document.getElementById('awardModal').addEventListener('show.bs.modal', function (event) {
|
||||
document.getElementById("awardTarget").action = event.relatedTarget.dataset.url;
|
||||
});
|
||||
|
||||
(function(){
|
||||
let modal = document.getElementById('awardModal');
|
||||
if (modal) {
|
||||
modal.addEventListener('show.bs.modal', function (event) {
|
||||
let target = document.getElementById("awardTarget");
|
||||
target.action = event.relatedTarget.dataset.url;
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
function pick(kind, canbuy1, canbuy2) {
|
||||
let buy1 = document.getElementById('buy1')
|
||||
|
|
|
@ -56,4 +56,4 @@ function expandMarkdown(t,id) {
|
|||
let val = t.getElementsByTagName('span')[0]
|
||||
if (val.innerHTML == 'View source') val.innerHTML = 'Hide source'
|
||||
else val.innerHTML = 'View source'
|
||||
};
|
||||
};
|
|
@ -215,7 +215,7 @@ function comment_edit(id){
|
|||
}
|
||||
|
||||
|
||||
function post_comment(fullname){
|
||||
function post_comment(fullname,id,level = 1){
|
||||
const previewPlaceholderHTML= '<p class="preview-msg">Comment preview</p>';
|
||||
function reset_preview(element_id) {
|
||||
const element = document.getElementById(element_id);
|
||||
|
@ -236,6 +236,7 @@ function post_comment(fullname){
|
|||
|
||||
form.append('formkey', formkey());
|
||||
form.append('parent_fullname', fullname);
|
||||
form.append('parent_level', level);
|
||||
form.append('submission', submissionEl.value);
|
||||
form.append('body', bodyEl.value);
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ def api_comment(v):
|
|||
|
||||
parent_submission = request.values.get("submission").strip()
|
||||
parent_fullname = request.values.get("parent_fullname").strip()
|
||||
parent_level = int(request.values.get("parent_level").strip())
|
||||
|
||||
parent_post = get_post(parent_submission, v=v)
|
||||
sub = parent_post.sub
|
||||
|
@ -343,7 +344,7 @@ def api_comment(v):
|
|||
g.db.commit()
|
||||
|
||||
if request.headers.get("Authorization"): return c.json
|
||||
return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True)}
|
||||
return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True, parent_level=parent_level)}
|
||||
|
||||
|
||||
def comment_on_publish(comment):
|
||||
|
|
|
@ -160,7 +160,8 @@
|
|||
{% if not isreply %}
|
||||
<div class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement)"></div>
|
||||
<div class="comment-collapse-bar-click" onclick="collapse_comment('{{c.id}}', this.parentElement)">
|
||||
<div class="comment-collapse-bar"></div>
|
||||
{% set depth = level % 9 + 1 %}
|
||||
<div class="comment-collapse-bar collapse-bar-{{depth}}"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="comment-user-info">
|
||||
|
@ -547,7 +548,7 @@
|
|||
<input autocomplete="off" id="file-upload-reply-{{c.fullname}}" type="file" multiple="multiple" name="file" accept="image/*, video/*" {% if request.headers.get('cf-ipcountry')=="T1" %}disabled{% endif %} onchange="changename('filename-show-reply-{{c.fullname}}','file-upload-reply-{{c.fullname}}')" hidden>
|
||||
</label>
|
||||
</div>
|
||||
<a id="save-reply-to-{{c.fullname}}" class="btn btn-primary ml-2 fl-r commentmob" onclick="post_comment('{{c.fullname}}', '{{c.post.id}}')"role="button">Comment</a>
|
||||
<a id="save-reply-to-{{c.fullname}}" class="btn btn-primary ml-2 fl-r commentmob" onclick="post_comment('{{c.fullname}}', '{{c.post.id}}', {{level}})"role="button">Comment</a>
|
||||
<a role="button" onclick="document.getElementById('reply-to-{{c.id}}').classList.add('d-none')" class="btn btn-link text-muted ml-auto cancel-form fl-r commentmob">Cancel</a>
|
||||
</form>
|
||||
<div id="reply-edit-{{c.id}}" class="preview mb-3 mt-5"><p class="preview-msg">Comment preview</p></div>
|
||||
|
@ -745,7 +746,12 @@
|
|||
|
||||
{% for comment in comments %}
|
||||
|
||||
{{single_comment(comment)}}
|
||||
{% if parent_level %}
|
||||
{% set parent_level = parent_level | int %}
|
||||
{{ single_comment(comment,level = parent_level + 1) }}
|
||||
{% else %}
|
||||
{{ single_comment(comment) }}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue