forked from MarseyWorld/MarseyWorld
add "pins" toggle to the frontpage
parent
870ea381b8
commit
b2de11cb1a
|
@ -177,7 +177,6 @@ AEVANN_ID = 5
|
|||
SNAKES_ID = 0
|
||||
HOMO_ID = 0
|
||||
SOREN_ID = 0
|
||||
Q_ID = 0
|
||||
LAWLZ_ID = 0
|
||||
LLM_ID = 0
|
||||
DAD_ID = 0
|
||||
|
@ -237,7 +236,6 @@ if SITE in {'rdrama.net', 'devrama.xyz', 'deuxrama.net'}:
|
|||
SNAKES_ID = 10288
|
||||
HOMO_ID = 147
|
||||
SOREN_ID = 2546
|
||||
Q_ID = 1480
|
||||
LAWLZ_ID = 3833
|
||||
LLM_ID = 253
|
||||
DAD_ID = 2513
|
||||
|
|
|
@ -51,6 +51,8 @@ def front_all(v, sub=None, subdomain=None):
|
|||
try: lt=int(request.values.get("before", 0))
|
||||
except: lt=0
|
||||
|
||||
pins = session.get("pins", True)
|
||||
|
||||
ids, next_exists = frontlist(sort=sort,
|
||||
page=page,
|
||||
t=t,
|
||||
|
@ -60,7 +62,8 @@ def front_all(v, sub=None, subdomain=None):
|
|||
gt=gt,
|
||||
lt=lt,
|
||||
sub=sub,
|
||||
site=SITE
|
||||
site=SITE,
|
||||
pins=pins
|
||||
)
|
||||
|
||||
posts = get_posts(ids, v=v)
|
||||
|
@ -70,12 +73,12 @@ def front_all(v, sub=None, subdomain=None):
|
|||
award_timers(v)
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||
return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, home=True)
|
||||
return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, home=True, pins=pins)
|
||||
|
||||
|
||||
|
||||
@cache.memoize(timeout=86400)
|
||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false", filter_words='', gt=0, lt=0, sub=None, site=None):
|
||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false", filter_words='', gt=0, lt=0, sub=None, site=None, pins=True):
|
||||
|
||||
posts = g.db.query(Submission)
|
||||
|
||||
|
@ -97,7 +100,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
|
|||
|
||||
posts = posts.filter_by(is_banned=False, private=False, deleted_utc = 0)
|
||||
|
||||
if (sort == "hot" or (v and v.id == Q_ID)) and ccmode == "false" and not gt and not lt:
|
||||
if pins and ccmode == "false" and not gt and not lt:
|
||||
posts = posts.filter_by(stickied=None, hole_pinned=None)
|
||||
|
||||
if v:
|
||||
|
@ -137,7 +140,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
|
|||
|
||||
posts = posts[:size]
|
||||
|
||||
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
|
||||
if pins and page == 1 and ccmode == "false" and not gt and not lt:
|
||||
if sub:
|
||||
pins = g.db.query(Submission).filter(Submission.sub == sub.name, Submission.hole_pinned != None)
|
||||
else:
|
||||
|
|
|
@ -1263,3 +1263,12 @@ def fp(v, fp):
|
|||
print(v.username + ' + ' + u.username, flush=True)
|
||||
g.db.add(v)
|
||||
return '', 204
|
||||
|
||||
@app.get("/toggle_pins")
|
||||
def toggle_pins():
|
||||
pins = session.get("pins", True)
|
||||
session['pins'] = not pins
|
||||
if is_site_url(request.referrer):
|
||||
return redirect(request.referrer)
|
||||
|
||||
return redirect('/')
|
|
@ -38,18 +38,24 @@
|
|||
<a data-bs-toggle="tooltip" data-bs-placement="bottom" title="Catalog View" class="btn btn-secondary mx-2 d-none d-md-block" href="/catalog?sort={{sort}}&t={{t}}&ccmode=false"><i class="fas fa-columns-3 mr-2 "></i>Catalog</a>
|
||||
{% endif %}
|
||||
|
||||
{% if pins %}
|
||||
<a class="btn btn-primary text-primary mx-2 smol-fp" href="/toggle_pins"><i class="fas fas fa-thumbtack fa-rotate--45 mr-2 "></i>Pins</a>
|
||||
{% else %}
|
||||
<a class="btn btn-secondary mx-2 smol-fp" href="/toggle_pins"><i class="fas fas fa-thumbtack fa-rotate--45 mr-2 "></i>Pins</a>
|
||||
{% endif %}
|
||||
|
||||
{% if v and SITE_NAME == 'rDrama' %}
|
||||
{% if v.paid_dues %}
|
||||
{% if ccmode=="true" %}
|
||||
<a data-bs-toggle="tooltip" data-bs-placement="bottom" title="Only show country club posts" class="btn btn-primary text-primary mx-2" href="?sort={{sort}}&t={{t}}&ccmode=false"><i class="fas fa-golf-club mr-2 "></i>CC</a>
|
||||
<a data-bs-toggle="tooltip" data-bs-placement="bottom" title="Only show country club posts" class="btn btn-primary text-primary mx-2 smol-fp" href="?sort={{sort}}&t={{t}}&ccmode=false"><i class="fas fa-golf-club mr-2 "></i>CC</a>
|
||||
{% else %}
|
||||
<a data-bs-toggle="tooltip" data-bs-placement="bottom" title="Only show country club posts" class="btn btn-secondary mx-2" href="?sort={{sort}}&t={{t}}&ccmode=true"><i class="fas fa-golf-club mr-2 "></i>CC</a>
|
||||
<a data-bs-toggle="tooltip" data-bs-placement="bottom" title="Only show country club posts" class="btn btn-secondary mx-2 smol-fp" href="?sort={{sort}}&t={{t}}&ccmode=true"><i class="fas fa-golf-club mr-2 "></i>CC</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="dropdown dropdown-actions mx-2">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button class="btn btn-secondary dropdown-toggle smol-fp" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{% if t=="hour" %}<i class="fas fa-clock mr-2 "></i>
|
||||
{% elif t=="day" %}<i class="fas fa-calendar-day mr-2 "></i>
|
||||
{% elif t=="week" %}<i class="fas fa-calendar-week mr-2 "></i>
|
||||
|
@ -59,7 +65,7 @@
|
|||
{% endif %}
|
||||
{{t | capitalize}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px;">
|
||||
<div class="dropdown-menu smol-fp" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px;">
|
||||
{% if t != "hour" %}<a class="dropdown-item" href="?sort={{sort}}&t=hour&ccmode={{ccmode}}"><i class="fas fa-clock mr-2 "></i>Hour</a>{% endif %}
|
||||
{% if t != "day" %}<a class="dropdown-item" href="?sort={{sort}}&t=day&ccmode={{ccmode}}"><i class="fas fa-calendar-day mr-2 "></i>Day</a>{% endif %}
|
||||
{% if t != "week" %}<a class="dropdown-item" href="?sort={{sort}}&t=week&ccmode={{ccmode}}"><i class="fas fa-calendar-week mr-2 "></i>Week</a>{% endif %}
|
||||
|
@ -70,7 +76,7 @@
|
|||
</div>
|
||||
|
||||
<div class="dropdown dropdown-actions ml-2">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button class="btn btn-secondary dropdown-toggle smol-fp" type="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{% if sort=="hot" %}<i class="fas fa-fire mr-2 "></i>{% endif %}
|
||||
{% if sort=="warm" %}<i class="fas fa-fire mr-2 "></i>{% endif %}
|
||||
{% if sort=="bump" %}<i class="fas fa-arrow-up mr-2 "></i>{% endif %}
|
||||
|
@ -82,7 +88,7 @@
|
|||
{% if sort=="comments" %}<i class="fas fa-comments mr-2 "></i>{% endif %}
|
||||
{{sort | capitalize}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton2" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px;">
|
||||
<div class="dropdown-menu smol-fp" aria-labelledby="dropdownMenuButton2" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px;">
|
||||
{% if sort != "hot" %}<a class="dropdown-item" href="?sort=hot&t={{t}}&ccmode={{ccmode}}"><i class="fas fa-fire mr-2 "></i>Hot</a>{% endif %}
|
||||
{% if sort != "warm" %}<a class="dropdown-item" href="?sort=warm&t={{t}}&ccmode={{ccmode}}"><i class="fas fa-fire mr-2 "></i>Warm</a>{% endif %}
|
||||
{% if sort != "bump" %}<a class="dropdown-item" href="?sort=bump&t={{t}}&ccmode={{ccmode}}"><i class="fas fa-arrow-up mr-2 "></i>Bump</a>{% endif %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%-
|
||||
set CACHE_VER = {
|
||||
'css/main.css': 393,
|
||||
'css/main.css': 394,
|
||||
|
||||
'css/4chan.css': 61,
|
||||
'css/classic.css': 61,
|
||||
|
|
Loading…
Reference in New Issue