Generate URL to restore settings, including subscriptions. Closes #89 (#116)

* Start recursive comments

* Update comment.html

* Fix move error

* Comment improvements

* Fix merge

* Remove extra endif from post.html

* Fix post.html

* Restore setting from link

* Tweak settings page

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
This commit is contained in:
robrobinbin 2021-02-13 21:55:23 +01:00 committed by GitHub
parent ff8685ae4c
commit 93cfc713c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 46 deletions

View file

@ -46,25 +46,27 @@
<label for="show_nsfw">Show NSFW posts:</label>
<input type="checkbox" name="show_nsfw" {% if prefs.show_nsfw == "on" %}checked{% endif %}>
</div>
<input id="save" type="submit" value="Save">
</div>
<p id="settings_note"><b>Note:</b> settings are saved in browser cookies. Clearing your cookie data will reset them.</p>
<input id="save" type="submit" value="Save">
</form>
{% if prefs.subs.len() > 0 %}
<aside class="prefs">
{% if prefs.subscriptions.len() > 0 %}
<div class="prefs" id="settings_subs">
<p>Subscribed Subreddits</p>
<ul id="settings_subs">
{% for sub in prefs.subs %}
<li>
<span>{{ sub }}</span>
<form action="/r/{{ sub }}/unsubscribe/?redirect=settings" method="POST">
<button class="unsubscribe">Unsubscribe</button>
</form>
</li>
{% endfor %}
</ul>
</aside>
{% for sub in prefs.subscriptions %}
<div>
<span>{{ sub }}</span>
<form action="/r/{{ sub }}/unsubscribe/?redirect=settings" method="POST">
<button class="unsubscribe">Unsubscribe</button>
</form>
</div>
{% endfor %}
</div>
{% endif %}
<div id="settings_note">
<p><b>Note:</b> settings and subscriptions are saved in browser cookies. Clearing your cookies will reset them.</p><br>
<p>You can restore your current settings and subscriptions after clearing your cookies using <a href="/settings/restore/?theme={{ prefs.theme }}&front_page={{ prefs.front_page }}&layout={{ prefs.layout }}&wide={{ prefs.wide }}&comment_sort={{ prefs.comment_sort }}&show_nsfw={{ prefs.show_nsfw }}&subscriptions={{ prefs.subscriptions.join("%2B") }}">this link</a>.</p>
</div>
</div>
{% endblock %}

View file

@ -85,7 +85,7 @@
<div>{{ sub.active }}</div>
</div>
<div id="sub_subscription">
{% if prefs.subs.contains(sub.name) %}
{% if prefs.subscriptions.contains(sub.name) %}
<form action="/r/{{ sub.name }}/unsubscribe/" method="POST">
<button class="unsubscribe">Unsubscribe</button>
</form>

View file

@ -41,7 +41,7 @@
{%- endmacro %}
{% macro sub_list(current) -%}
{% if prefs.subs.len() > 0 %}
{% if prefs.subscriptions.len() > 0 %}
<details id="feeds">
<summary>Feeds</summary>
<div id="feed_list">
@ -50,7 +50,7 @@
<a href="/r/popular">Popular</a>
<a href="/r/all">All</a>
<p>REDDIT FEEDS</p>
{% for sub in prefs.subs %}
{% for sub in prefs.subscriptions %}
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
{% endfor %}
</div>