Skip to content
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

Merged
merged 6 commits into from Sep 23, 2016

Conversation

ejucovy
Copy link
Contributor

@ejucovy ejucovy commented Sep 17, 2016

Modeled after this flatpage which we put together by hand for the Florida event: https://floridaopendebate.com/top/

  • 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. "[#1]" vs "[#1] in Florida" vs "[#1] between Sep 25 - Oct 16")

* 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 %}
Copy link
Contributor Author

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()
Copy link
Contributor

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.

Copy link
Contributor Author

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>
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea.save() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jbradberry
Copy link
Contributor

Looks good to me. 👍

@ejucovy
Copy link
Contributor Author

ejucovy commented Sep 23, 2016

FYI I don't have commit access here - could someone else merge this if it looks ready?

@jbradberry jbradberry merged commit 02e38ff into caktus:develop Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants