Display sub list from list in cookie.

Very basic sub list setup. Cookie must be manually added in devtools.
This commit is contained in:
Matthew Crossman 2021-01-30 16:00:55 +11:00
parent 49a6168607
commit 75bbcefbec
No known key found for this signature in database
GPG key ID: C6B942B019794CC2
10 changed files with 95 additions and 2 deletions

View file

@ -26,6 +26,10 @@
{% block search %}{% endblock %}
<a id="code" href="https://github.com/spikecodes/libreddit">code</a>
</nav>
<!-- SUBSCRIBED SUBREDDITS -->
{% block sub_list %}
{% endblock %}
<!-- MAIN CONTENT -->
{% block body %}

View file

@ -13,6 +13,10 @@
<meta name="author" content="u/{{ post.author.name }}">
{% endblock %}
{% block sub_list %}
{% call utils::sub_list(post.community.as_str()) %}
{% endblock %}
<!-- OPEN COMMENT MACRO -->
{% macro comment(item) -%}
<div id="{{ item.id }}" class="comment">

View file

@ -3,6 +3,10 @@
{% block title %}Libreddit: search results - {{ params.q }}{% endblock %}
{% block sub_list %}
{% call utils::sub_list("") %}
{% endblock %}
{% block content %}
<div id="column_one">
<form id="search_sort">

View file

@ -7,6 +7,10 @@
{% call utils::search("".to_owned(), "", "") %}
{% endblock %}
{% block sub_list %}
{% call utils::sub_list("") %}
{% endblock %}
{% block content %}
<form id="settings" action="/settings" method="POST">
<div id="prefs">

View file

@ -11,6 +11,10 @@
{% call utils::search(["/r/", sub.name.as_str()].concat(), "") %}
{% endblock %}
{% block sub_list %}
{% call utils::sub_list(sub.name.as_str()) %}
{% endblock %}
{% block body %}
<main>
<div id="column_one">
@ -121,6 +125,13 @@
<div>{{ sub.members }}</div>
<div>{{ sub.active }}</div>
</div>
<div id="sub_subscription">
{% if prefs.subs.contains(sub.name) %}
<a class="subscribe remove">Unsubscribe</a>
{% else %}
<a class="subscribe add">Subscribe</a>
{% endif %}
</div>
</div>
</div>
<details class="panel" id="sidebar">

View file

@ -7,6 +7,10 @@
{% block title %}{{ user.name.replace("u/", "") }} (u/{{ user.name }}) - Libreddit{% endblock %}
{% block sub_list %}
{% call utils::sub_list("") %}
{% endblock %}
{% block body %}
<main>
<div id="column_one">

View file

@ -39,3 +39,15 @@
{% else if flair_part.flair_part_type == "text" %}<span>{{ flair_part.value }}</span>{% endif %}
{% endfor %}
{%- endmacro %}
{% macro sub_list(current) -%}
{% if prefs.subs.len() > 0 %}
<div id="sub_list">
<div id="subs">
{% for sub in prefs.subs %}
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
{% endfor %}
</div>
</div>
{% endif %}
{%- endmacro %}

View file

@ -10,6 +10,10 @@
{% call utils::search(["/r/", sub.as_str()].concat(), "") %}
{% endblock %}
{% block sub_list %}
{% call utils::sub_list(sub.as_str()) %}
{% endblock %}
{% block body %}
<main>
<div class="panel" id="column_one">