New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'top questions archive' feature #195
Conversation
* Moderators can visit /moderation/top/ to add entries manually into an archive of top questions, with a manually specified ordinal rank * Multiple independent archives can be created via TopSubmissionCategory; each category will have its own view at /top/{{slug}}/ -- so that multiple debate events can be hosted within the same site without resetting the archive * When a question is added into an archive, its headline, followup and vote count are copied over into a new archive object; that way, even if the question is later changed by moderators or has its vote count changed, the archive will remain frozen * For each category, moderators can specify an HTML title/preamble to display on the page, to provide a page heading and some descriptive text if desired (e.g. a summary of the rules that led to this ranking) * For each category, moderators can specify a caption/suffix to display after the rank of individual questions (e.g. "boldprogressives#1" vs "boldprogressives#1 in Florida" vs "boldprogressives#1 between Sep 25 - Oct 16")
{{ category.title|safe }} | ||
<div class="row idea-list"> | ||
<div class="winners"> | ||
{% for idea in submissions %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: everything inside this for loop is very very similar to templates/opendebates/snippets/idea.html
-- I'm not happy about the duplication, but there are enough differences (e.g. ordinal rank instead of vote button, no share section, no hyperlinks) that I thought I'd better not try to share code, especially since that idea.html template is already enormously complex and branchy.
@rendered_with("opendebates/moderation/top_archive.html") | ||
def add_to_top_archive(request): | ||
if not request.user.is_superuser: | ||
return HttpResponseNotFound() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think raising a PermissionDenied
would be more appropriate here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
class="vote-tally-number">{{ idea.votes|localize }}</span> | ||
</div> | ||
<div class="vote-bottom center-block center-text"> | ||
<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<br>
s instead of <p>
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>
picks up some extra styles that we don't want (https://cl.ly/0g2a1Z0e0u0q, vs the desired https://cl.ly/3F1t0D0f0G0d) and with upcoming events looming I'm reluctant to start making any CSS changes, since this markup is so closely shared with the existing snippets/idea.html
code.
# the archive remains frozen: | ||
idea.headline = "An entirely new headline" | ||
idea.followup = "Some totally different followup text" | ||
idea.votes += 1500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idea.save()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Looks good to me. 👍 |
FYI I don't have commit access here - could someone else merge this if it looks ready? |
Modeled after this flatpage which we put together by hand for the Florida event: https://floridaopendebate.com/top/
questions, with a manually specified ordinal rank
will have its own view at /top/{{slug}}/ -- so that multiple debate events can be hosted
within the same site without resetting the archive
are copied over into a new archive object; that way, even if the question is later
changed by moderators or has its vote count changed, the archive will remain frozen
to provide a page heading and some descriptive text if desired (e.g. a summary of the
rules that led to this ranking)
of individual questions (e.g.
"[#1]"
vs"[#1] in Florida"
vs"[#1] between Sep 25 - Oct 16"
)