1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

Sharing bookmarklet works

This commit is contained in:
Jason McBrayer 2019-11-07 19:44:09 -05:00
parent da1de5ea32
commit 2da4fd0de2
2 changed files with 24 additions and 2 deletions

View File

@ -166,6 +166,12 @@
value="Save" class="button is-primary" > value="Save" class="button is-primary" >
</div> </div>
</form> </form>
<h2 class="subtitle">Bookmarklet</h2>
<p>
<a href="{{ bookmarklet_url }}">Share via brutaldon</a>
</p>
<h2 class="subtitle">Filters and More</h2> <h2 class="subtitle">Filters and More</h2>
<p><a href="{% url "list_filters" %}">List filters</a></p> <p><a href="{% url "list_filters" %}">List filters</a></p>
<p><a href="{% url "follow_requests" %}">Follow requests</a></p> <p><a href="{% url "follow_requests" %}">Follow requests</a></p>

View File

@ -191,6 +191,11 @@ def min_visibility(visibility1, visibility2):
] ]
def bookmarklet_url(request):
share_url = request.build_absolute_uri(reverse("share"))
return f"javascript:location.href='{share_url}?url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)"
def timeline( def timeline(
request, request,
timeline="home", timeline="home",
@ -792,7 +797,13 @@ def settings(request):
return redirect(home) return redirect(home)
else: else:
return render( return render(
request, "setup/settings.html", {"form": form, "account": account} request,
"setup/settings.html",
{
"form": form,
"account": account,
"bookmarklet_url": bookmarklet_url(request),
},
) )
else: else:
request.session["timezone"] = account.preferences.timezone request.session["timezone"] = account.preferences.timezone
@ -800,7 +811,12 @@ def settings(request):
return render( return render(
request, request,
"setup/settings.html", "setup/settings.html",
{"form": form, "account": account, "preferences": account.preferences}, {
"form": form,
"account": account,
"preferences": account.preferences,
"bookmarklet_url": bookmarklet_url(request),
},
) )