remotes/1693045480750635534/spooky-22
Aevann1 2022-01-19 16:08:45 +02:00
parent 35225ea1b4
commit 064e21115b
3 changed files with 10 additions and 16 deletions

View File

@ -357,6 +357,15 @@ class Comment(Base):
g.db.add(self.author)
g.db.commit()
for o in self.options:
body += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{o.id}" name="option"'
if o.poll_voted(v): body += " checked"
if v: body += f''' onchange="poll_vote('{o.id}', '{self.id}')"'''
else: body += f''' onchange="poll_vote_no_v('{o.id}', '{self.id}')"'''
body += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
if not self.total_poll_voted(v): body += ' d-none'
body += f'"> - <a href="/votes?link=t3_{o.id}"><span id="poll-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'
return body
def plainbody(self, v):
@ -406,18 +415,6 @@ class Comment(Base):
@lazy
def active_flags(self): return self.flags.count()
def options_html(self, v):
html = ""
for o in self.options:
html += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{o.id}" name="option"'
if o.poll_voted(v): html += " checked"
if v: html += f''' onchange="poll_vote('{o.id}', '{self.id}')"'''
else: html += f''' onchange="poll_vote_no_v('{o.id}', '{self.id}')"'''
html += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
if not self.total_poll_voted(v): html += ' d-none'
html += f'"> - <a href="/votes?link=t3_{o.id}"><span id="poll-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'
return html
class Notification(Base):
__tablename__ = "notifications"

View File

@ -706,7 +706,7 @@ def edit_comment(cid, v):
g.db.commit()
return c.realbody(v) + c.options_html(v)
return c.realbody(v)
@app.post("/delete/comment/<cid>")

View File

@ -250,9 +250,6 @@
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter %}agendaposter{% endif %}" >
{{c.realbody(v) | safe}}
{% if c.options %}
{{c.options_html(v) | safe}}
{% endif %}
{% if c.author.sig_html and c.author_name != '👻' and (c.author_id == MOOSE_ID or not (v and v.sigs_disabled)) %}
<hr>