Added/Updated admin dashboard tables
• Added: - New Account filtering - PreviewCard viewing/sorting/filtering deleting (todo) - DeletePreviewCardWorker, Service - Status viewing/sorting/filtering deleting - ChatMessage viewing/sorting/filtering deleting (todo) - Account > Follows view • Updated: - LinkBlock to sort alphabetically - Groups to be under "Moderation" instead of "Admin" in navigation.rb - Status in admin to have group name/link - Reports reset button - Group filtering/sorting - LinkBlock filtering/sorting - Account now has bio and few more data points in dashboard
This commit is contained in:
@@ -2,22 +2,20 @@
|
||||
|
||||
module Admin
|
||||
class ChatMessagesController < BaseController
|
||||
before_action :set_account
|
||||
|
||||
PER_PAGE = 100
|
||||
PER_PAGE = 50
|
||||
|
||||
def index
|
||||
authorize :chat_message, :index?
|
||||
|
||||
@chat_messages = ChatMessage.where(from_account: @account).page(params[:page]).per(PER_PAGE)
|
||||
@chat_messages = filtered_chat_messages.page(params[:page]).per(PER_PAGE)
|
||||
@form = Form::ChatMessageBatch.new
|
||||
end
|
||||
|
||||
def show
|
||||
authorize :chat_message, :index?
|
||||
|
||||
@chat_messages = @account.chat_messages.where(id: params[:id])
|
||||
authorize @chat_messages.first, :show?
|
||||
@chat_message = ChatMessage.where(id: params[:id])
|
||||
authorize @chat_message, :show?
|
||||
|
||||
@form = Form::ChatMessageBatch.new
|
||||
end
|
||||
@@ -37,19 +35,18 @@ module Admin
|
||||
|
||||
private
|
||||
|
||||
def filtered_chat_messages
|
||||
ChatMessageFilter.new(filter_params).results
|
||||
end
|
||||
|
||||
def form_chat_message_batch_params
|
||||
params.require(:form_chat_message_batch).permit(:action, chat_message_ids: [])
|
||||
end
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def current_params
|
||||
page = (params[:page] || 1).to_i
|
||||
|
||||
{
|
||||
media: params[:media],
|
||||
page: page > 1 && page,
|
||||
}.select { |_, value| value.present? }
|
||||
end
|
||||
@@ -59,5 +56,15 @@ module Admin
|
||||
'delete'
|
||||
end
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.permit(
|
||||
:id,
|
||||
:text,
|
||||
:account_id,
|
||||
:created_at_lte,
|
||||
:created_at_gte
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user