#1938 Add order:random as alternative random trigger
This commit is contained in:
@@ -267,7 +267,8 @@
|
||||
"mpixels", "mpixels_asc",
|
||||
"portrait", "landscape",
|
||||
"filesize", "filesize_asc",
|
||||
"rank"
|
||||
"rank",
|
||||
"random"
|
||||
],
|
||||
status: [
|
||||
"any", "deleted", "active", "pending", "flagged", "banned"
|
||||
|
||||
@@ -14,7 +14,8 @@ class PostsController < ApplicationController
|
||||
redirect_to post_path(@post)
|
||||
else
|
||||
limit = params[:limit] || (params[:tags] =~ /(?:^|\s)limit:(\d+)(?:$|\s)/ && $1) || CurrentUser.user.per_page
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], limit, params[:raw], params[:random])
|
||||
@random = params[:random] || params[:tags] =~ /(?:^|\s)order:random(?:$|\s)/
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], limit, params[:raw], @random)
|
||||
@posts = @post_set.posts
|
||||
respond_with(@posts) do |format|
|
||||
format.atom
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless params[:random].present? %>
|
||||
<% unless @random.present? %>
|
||||
<%= numbered_paginator(post_set.posts) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user