forked from MarseyWorld/MarseyWorld
sdffsd
parent
aa043d05e3
commit
750224eb7c
|
@ -208,11 +208,14 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
elif sort == "comments":
|
||||
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
|
||||
|
||||
|
|
|
@ -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")
|
||||
if defaultsortingcomments:
|
||||
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]:
|
||||
v.defaultsortingcomments = defaultsortingcomments
|
||||
updated = True
|
||||
else:
|
||||
abort(400)
|
||||
else: abort(400)
|
||||
|
||||
defaultsorting = request.values.get("defaultsorting")
|
||||
if defaultsorting:
|
||||
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]:
|
||||
v.defaultsorting = defaultsorting
|
||||
updated = True
|
||||
else:
|
||||
abort(400)
|
||||
else: abort(400)
|
||||
|
||||
defaulttime = request.values.get("defaulttime")
|
||||
if defaulttime:
|
||||
if defaulttime in ["hour", "day", "week", "month", "year", "all"]:
|
||||
v.defaulttime = defaulttime
|
||||
updated = True
|
||||
else:
|
||||
abort(400)
|
||||
else: abort(400)
|
||||
|
||||
theme = request.values.get("theme")
|
||||
if theme:
|
||||
|
|
|
@ -11,6 +11,30 @@
|
|||
|
||||
<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>
|
||||
|
||||
<div class="settings-section rounded">
|
||||
|
|
Loading…
Reference in New Issue