Merge pull request #30 from moosingin3space/master

Add controversial sort order
This commit is contained in:
Spike 2021-01-03 21:15:27 -08:00 committed by GitHub
commit 5934e34ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 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,12 +17,12 @@
<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" || sort.0 == "controversial" %}<select id="timeframe" name="t">
{% call utils::options(sort.1, ["hour", "day", "week", "month", "year", "all"], "day") %} {% call utils::options(sort.1, ["hour", "day", "week", "month", "year", "all"], "day") %}
<input id="sort_submit" type="submit" value="&rarr;"> <input id="sort_submit" type="submit" value="&rarr;">
</select>{% endif %} </select>{% endif %}