#1938 Add order:random as alternative random trigger

This commit is contained in:
Toks
2015-06-09 18:15:50 -04:00
parent 883a4cbf5a
commit 3bc92f1ca7
3 changed files with 5 additions and 3 deletions

View File

@@ -267,7 +267,8 @@
"mpixels", "mpixels_asc",
"portrait", "landscape",
"filesize", "filesize_asc",
"rank"
"rank",
"random"
],
status: [
"any", "deleted", "active", "pending", "flagged", "banned"

View File

@@ -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

View File

@@ -9,7 +9,7 @@
</div>
<% end %>
<% unless params[:random].present? %>
<% unless @random.present? %>
<%= numbered_paginator(post_set.posts) %>
<% end %>
</div>