Add controversial sort order

This commit is contained in:
Nathan Moos 2021-01-03 21:00:36 -08:00
parent a422a74747
commit b40d21e559
2 changed files with 4 additions and 4 deletions

View File

@ -69,10 +69,10 @@ async fn main() -> std::io::Result<()> {
.route("/r/{sub}/wiki/{page}/", web::get().to(subreddit::wiki)) .route("/r/{sub}/wiki/{page}/", web::get().to(subreddit::wiki))
// SUBREDDIT SERVICES // SUBREDDIT SERVICES
.route("/r/{sub}/", web::get().to(subreddit::page)) .route("/r/{sub}/", web::get().to(subreddit::page))
.route("/r/{sub}/{sort:hot|new|top|rising}/", web::get().to(subreddit::page)) .route("/r/{sub}/{sort:hot|new|top|rising|controversial}/", web::get().to(subreddit::page))
// POPULAR SERVICES // POPULAR SERVICES
.route("/", web::get().to(subreddit::page)) .route("/", web::get().to(subreddit::page))
.route("/{sort:best|hot|new|top|rising}/", web::get().to(subreddit::page)) .route("/{sort:best|hot|new|top|rising|controversial}/", web::get().to(subreddit::page))
// POST SERVICES // POST SERVICES
.route("/{id:.{5,6}}/", web::get().to(post::item)) .route("/{id:.{5,6}}/", web::get().to(post::item))
.route("/r/{sub}/comments/{id}/{title}/", web::get().to(post::item)) .route("/r/{sub}/comments/{id}/{title}/", web::get().to(post::item))

View File

@ -17,9 +17,9 @@
<form id="sort"> <form id="sort">
<div id="sort_options"> <div id="sort_options">
{% if sub.name.is_empty() %} {% if sub.name.is_empty() %}
{% call utils::sort("", ["hot", "new", "top", "rising"], sort.0) %} {% call utils::sort("", ["hot", "new", "top", "rising", "controversial"], sort.0) %}
{% else %} {% else %}
{% call utils::sort(["/r/", sub.name.as_str()].concat(), ["hot", "new", "top", "rising"], sort.0) %} {% call utils::sort(["/r/", sub.name.as_str()].concat(), ["hot", "new", "top", "rising", "controversial"], sort.0) %}
{% endif %} {% endif %}
</div> </div>
{% if sort.0 == "top" %}<select id="timeframe" name="t"> {% if sort.0 == "top" %}<select id="timeframe" name="t">