fds
This commit is contained in:
parent
1e28e6afc4
commit
79b0e77d44
3 changed files with 10 additions and 16 deletions
|
@ -357,6 +357,15 @@ class Comment(Base):
|
||||||
g.db.add(self.author)
|
g.db.add(self.author)
|
||||||
g.db.commit()
|
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
|
return body
|
||||||
|
|
||||||
def plainbody(self, v):
|
def plainbody(self, v):
|
||||||
|
@ -406,18 +415,6 @@ class Comment(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def active_flags(self): return self.flags.count()
|
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):
|
class Notification(Base):
|
||||||
|
|
||||||
__tablename__ = "notifications"
|
__tablename__ = "notifications"
|
||||||
|
|
|
@ -706,7 +706,7 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
return c.realbody(v) + c.options_html(v)
|
return c.realbody(v)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/delete/comment/<cid>")
|
@app.post("/delete/comment/<cid>")
|
||||||
|
|
|
@ -250,9 +250,6 @@
|
||||||
|
|
||||||
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter %}agendaposter{% endif %}" >
|
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter %}agendaposter{% endif %}" >
|
||||||
{{c.realbody(v) | safe}}
|
{{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)) %}
|
{% if c.author.sig_html and c.author_name != '👻' and (c.author_id == MOOSE_ID or not (v and v.sigs_disabled)) %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue