forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
3f3f344ccd
|
@ -208,11 +208,14 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
elif sort == "comments":
|
elif sort == "comments":
|
||||||
posts = posts.order_by(Submission.comment_count.desc())
|
posts = posts.order_by(Submission.comment_count.desc())
|
||||||
|
|
||||||
posts = posts.offset(25 * (page - 1)).limit(26).all()
|
if v: size = v.frontsize
|
||||||
|
else: size = 25
|
||||||
|
|
||||||
next_exists = (len(posts) > 25)
|
posts = posts.offset(size * (page - 1)).limit(size+1).all()
|
||||||
|
|
||||||
posts = posts[:25]
|
next_exists = (len(posts) > size)
|
||||||
|
|
||||||
|
posts = posts[:size]
|
||||||
|
|
||||||
if page == 1: posts = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None).all() + posts
|
if page == 1: posts = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None).all() + posts
|
||||||
|
|
||||||
|
|
|
@ -169,29 +169,34 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
frontsize = request.values.get("frontsize")
|
||||||
|
if frontsize:
|
||||||
|
if frontsize in ["25", "50", "100"]:
|
||||||
|
v.frontsize = int(frontsize)
|
||||||
|
updated = True
|
||||||
|
cache.delete_memoized(frontlist)
|
||||||
|
else: abort(400)
|
||||||
|
|
||||||
defaultsortingcomments = request.values.get("defaultsortingcomments")
|
defaultsortingcomments = request.values.get("defaultsortingcomments")
|
||||||
if defaultsortingcomments:
|
if defaultsortingcomments:
|
||||||
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]:
|
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]:
|
||||||
v.defaultsortingcomments = defaultsortingcomments
|
v.defaultsortingcomments = defaultsortingcomments
|
||||||
updated = True
|
updated = True
|
||||||
else:
|
else: abort(400)
|
||||||
abort(400)
|
|
||||||
|
|
||||||
defaultsorting = request.values.get("defaultsorting")
|
defaultsorting = request.values.get("defaultsorting")
|
||||||
if defaultsorting:
|
if defaultsorting:
|
||||||
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]:
|
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]:
|
||||||
v.defaultsorting = defaultsorting
|
v.defaultsorting = defaultsorting
|
||||||
updated = True
|
updated = True
|
||||||
else:
|
else: abort(400)
|
||||||
abort(400)
|
|
||||||
|
|
||||||
defaulttime = request.values.get("defaulttime")
|
defaulttime = request.values.get("defaulttime")
|
||||||
if defaulttime:
|
if defaulttime:
|
||||||
if defaulttime in ["hour", "day", "week", "month", "year", "all"]:
|
if defaulttime in ["hour", "day", "week", "month", "year", "all"]:
|
||||||
v.defaulttime = defaulttime
|
v.defaulttime = defaulttime
|
||||||
updated = True
|
updated = True
|
||||||
else:
|
else: abort(400)
|
||||||
abort(400)
|
|
||||||
|
|
||||||
theme = request.values.get("theme")
|
theme = request.values.get("theme")
|
||||||
if theme:
|
if theme:
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<p class="mb-md-5">It will not be able to see your password, or change your account settings.</p>
|
<p class="mb-md-5">It will not be able to see your password, or change your account settings.</p>
|
||||||
|
|
||||||
<form action="/oauth/authorize" method="post" class="mt-md-3" id="login">
|
<form action="/authorize" method="post" class="mt-md-3" id="login">
|
||||||
|
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
<input type="hidden" name="scopes" value="{{scopes_txt}}">
|
<input type="hidden" name="scopes" value="{{scopes_txt}}">
|
||||||
|
|
|
@ -11,6 +11,30 @@
|
||||||
|
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
|
|
||||||
|
<h2 class="h5" name="referral">Frontpage Size</h2>
|
||||||
|
|
||||||
|
<div class="settings-section rounded">
|
||||||
|
<div class="d-lg-flex border-bottom">
|
||||||
|
<div class="title w-lg-25">
|
||||||
|
<label for="frontsize">Frontpage Size</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="body w-lg-100">
|
||||||
|
<p>Change how many posts appear on every page.</p>
|
||||||
|
<div class="input-group mb2">
|
||||||
|
<select id='frontsize' class="form-control" form="profile-settings" name="frontsize" onchange="post_toast('/settings/profile?frontsize='+document.getElementById('frontsize').value)">
|
||||||
|
{% for entry in ["25", "50", "100"] %}
|
||||||
|
<option value="{{entry}}"{{' selected' if v.frontsize==entry else ''}}>{{entry}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="h5" name="referral">Default Sorting and Time Filter</h2>
|
<h2 class="h5" name="referral">Default Sorting and Time Filter</h2>
|
||||||
|
|
||||||
<div class="settings-section rounded">
|
<div class="settings-section rounded">
|
||||||
|
|
Loading…
Reference in New Issue