Implement UI for Admin Search of Hashtags (#30880)
This commit is contained in:
@@ -2,7 +2,15 @@
|
||||
|
||||
module Admin
|
||||
class TagsController < BaseController
|
||||
before_action :set_tag
|
||||
before_action :set_tag, except: [:index]
|
||||
|
||||
PER_PAGE = 20
|
||||
|
||||
def index
|
||||
authorize :tag, :index?
|
||||
|
||||
@tags = filtered_tags.page(params[:page]).per(PER_PAGE)
|
||||
end
|
||||
|
||||
def show
|
||||
authorize @tag, :show?
|
||||
@@ -31,5 +39,13 @@ module Admin
|
||||
def tag_params
|
||||
params.require(:tag).permit(:name, :display_name, :trendable, :usable, :listable)
|
||||
end
|
||||
|
||||
def filtered_tags
|
||||
TagFilter.new(filter_params.with_defaults(order: 'newest')).results
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.slice(:page, *TagFilter::KEYS).permit(:page, *TagFilter::KEYS)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user