Clean-up and more consistent styles.
This commit is contained in:
parent
c71df35b22
commit
11e4ff42ed
@ -100,8 +100,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.route("/", web::get().to(subreddit::page))
|
.route("/", web::get().to(subreddit::page))
|
||||||
.route("/{sort:hot|new|top|rising|controversial}/", web::get().to(subreddit::page))
|
.route("/{sort:hot|new|top|rising|controversial}/", web::get().to(subreddit::page))
|
||||||
// Handle subscribe/unsubscribe
|
// Handle subscribe/unsubscribe
|
||||||
.route("/{action:subscribe|unsubscribe}/", web::post().to(subreddit::set))
|
.route("/{action:subscribe|unsubscribe}/", web::post().to(subreddit::subscriptions))
|
||||||
//.route("/unsubscribe/", web::post().to(subreddit::unsubscribe))
|
|
||||||
// View post on subreddit
|
// View post on subreddit
|
||||||
.service(
|
.service(
|
||||||
web::scope("/comments/{id}/{title}")
|
web::scope("/comments/{id}/{title}")
|
||||||
|
@ -65,7 +65,7 @@ pub async fn page(req: HttpRequest) -> HttpResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sub or unsub by setting subscription cookie using response "Set-Cookie" header
|
// Sub or unsub by setting subscription cookie using response "Set-Cookie" header
|
||||||
pub async fn set(req: HttpRequest) -> HttpResponse {
|
pub async fn subscriptions(req: HttpRequest) -> HttpResponse {
|
||||||
let mut res = HttpResponse::Found();
|
let mut res = HttpResponse::Found();
|
||||||
let default = cookie(&req, "front_page");
|
let default = cookie(&req, "front_page");
|
||||||
let sub = req
|
let sub = req
|
||||||
|
@ -145,7 +145,7 @@ pub fn prefs(req: HttpRequest) -> Preferences {
|
|||||||
wide: cookie(&req, "wide"),
|
wide: cookie(&req, "wide"),
|
||||||
hide_nsfw: cookie(&req, "hide_nsfw"),
|
hide_nsfw: cookie(&req, "hide_nsfw"),
|
||||||
comment_sort: cookie(&req, "comment_sort"),
|
comment_sort: cookie(&req, "comment_sort"),
|
||||||
subs: cookie(&req, "subscriptions").split(",").map(|s| s.to_string()).filter(|s| s != "").collect(),
|
subs: cookie(&req, "subscriptions").split(",").map(String::from).filter(|s| s != "").collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ aside {
|
|||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Subscriptions/Favorites */
|
/* Subscriptions */
|
||||||
|
|
||||||
#sub_subscription {
|
#sub_subscription {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
@ -242,20 +242,33 @@ aside {
|
|||||||
#sub_subscription > input {
|
#sub_subscription > input {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
color: var(--foreground);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sub_subscription > .add { color: var(--foreground); background-color: var(--accent); }
|
#sub_subscription > .add {
|
||||||
#sub_subscription > .remove { color: var(--text); background-color: var(--highlighted); }
|
color: var(--foreground);
|
||||||
|
background-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
#sub_list {
|
#sub_subscription > .remove {
|
||||||
|
color: var(--text);
|
||||||
|
background-color: var(--highlighted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Subscribed subreddit list */
|
||||||
|
|
||||||
|
#subscriptions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: 0 auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#subs {
|
.wide #subscriptions {
|
||||||
|
max-width: calc(100% - 40px);
|
||||||
|
}
|
||||||
|
|
||||||
|
#sub_list {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
background: var(--outside);
|
background: var(--outside);
|
||||||
@ -263,11 +276,11 @@ aside {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#subs a {
|
#sub_list > a {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#subs > .selected {
|
#sub_list > .selected {
|
||||||
background-color: var(--accent);
|
background-color: var(--accent);
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
}
|
}
|
||||||
@ -1009,7 +1022,10 @@ td, th {
|
|||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sub_list { padding: 10px; }
|
#sub_list {
|
||||||
|
padding: 10px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
aside, #subreddit, #user {
|
aside, #subreddit, #user {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
{% block search %}{% endblock %}
|
{% block search %}{% endblock %}
|
||||||
<a id="code" href="https://github.com/spikecodes/libreddit">code</a>
|
<a id="code" href="https://github.com/spikecodes/libreddit">code</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- SUBSCRIBED SUBREDDITS -->
|
|
||||||
{% block sub_list %}
|
{% block sub_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
|
|
||||||
{% macro sub_list(current) -%}
|
{% macro sub_list(current) -%}
|
||||||
{% if prefs.subs.len() > 0 %}
|
{% if prefs.subs.len() > 0 %}
|
||||||
<div id="sub_list">
|
<div id="subscriptions">
|
||||||
<div id="subs">
|
<div id="sub_list">
|
||||||
{% for sub in prefs.subs %}
|
{% for sub in prefs.subs %}
|
||||||
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
|
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user