mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 19:26:21 +00:00
feat: poder cambiar el estado a varies actores
This commit is contained in:
parent
3fa19ee8b0
commit
f8b4586633
7 changed files with 43 additions and 23 deletions
|
@ -20,6 +20,24 @@ class ActorModerationsController < ApplicationController
|
||||||
@remote_profile = actor_moderation.actor.content
|
@remote_profile = actor_moderation.actor.content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def action_on_several
|
||||||
|
actor_moderations = site.actor_moderations.where(id: params[:actor_moderation])
|
||||||
|
|
||||||
|
authorize actor_moderations
|
||||||
|
|
||||||
|
action = params[:actor_moderation_action].to_sym
|
||||||
|
method = :"#{action}!"
|
||||||
|
may = :"may_#{action}?"
|
||||||
|
|
||||||
|
return unless ActorModeration.events.include? action
|
||||||
|
|
||||||
|
ActorModeration.transaction do
|
||||||
|
actor_moderations.find_each do |actor_moderation|
|
||||||
|
actor_moderation.public_send(method) if actor_moderation.public_send(may)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def actor_moderation
|
def actor_moderation
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
= render 'components/dropdown_item', text: t('.submenu_pause'), path: '/'
|
- ActorModeration.events.each do |actor_event|
|
||||||
= render 'components/dropdown_item', text: t('.submenu_accept'), path: '/'
|
= render 'components/dropdown_button', text: t(".submenu_#{actor_event}"), name: 'actor_moderation_action', value: actor_event
|
||||||
= render 'components/dropdown_item', text: t('.submenu_reject'), path: '/'
|
|
||||||
= render 'components/dropdown_item', text: t('.submenu_block'), path: '/'
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.row.no-gutters.pt-2
|
.row.no-gutters.pt-2
|
||||||
.col-1
|
.col-1
|
||||||
= render 'components/checkbox', id: profile['id'], name: 'actor[]', value: profile['id'], data: { target: 'select-all.input' }
|
= render 'components/checkbox', id: actor_moderation.id, name: 'actor_moderation[]', value: actor_moderation.id, data: { target: 'select-all.input' }
|
||||||
.col-11
|
.col-11
|
||||||
%h4
|
%h4
|
||||||
= link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation)
|
= link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation)
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
.row.no-gutters.pt-2{ data: { controller: 'select-all' } }
|
%form{ action: site_actor_moderations_action_on_several_path, method: :post }
|
||||||
.col-1.d-flex.align-items-center
|
.row.no-gutters.pt-2{ data: { controller: 'select-all' } }
|
||||||
= render 'components/select_all', id: 'actors'
|
.col-1.d-flex.align-items-center
|
||||||
.col-11
|
= render 'components/select_all', id: 'actors'
|
||||||
-# Filtros
|
.col-11
|
||||||
= render 'components/profiles_filters', actor_moderations: actor_moderations
|
-# Filtros
|
||||||
.col-12
|
= render 'components/profiles_filters', actor_moderations: actor_moderations
|
||||||
- if actor_moderations.count.zero?
|
.col-12
|
||||||
%h4= t('moderation_queue.nothing')
|
- if actor_moderations.count.zero?
|
||||||
- actor_moderations.find_each do |actor_moderation|
|
%h4= t('moderation_queue.nothing')
|
||||||
%hr
|
- actor_moderations.find_each do |actor_moderation|
|
||||||
= render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content
|
- cache [actor_moderation, actor_moderation.actor] do
|
||||||
|
%hr
|
||||||
|
= render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content
|
||||||
|
|
|
@ -81,9 +81,9 @@ en:
|
||||||
text_checked: With selected
|
text_checked: With selected
|
||||||
profiles_checked_submenu:
|
profiles_checked_submenu:
|
||||||
submenu_pause: Pause
|
submenu_pause: Pause
|
||||||
submenu_accept: Accept
|
submenu_allow: Allow
|
||||||
submenu_reject: Reject
|
|
||||||
submenu_block: Block
|
submenu_block: Block
|
||||||
|
submenu_report: Report
|
||||||
profiles_show_submenu:
|
profiles_show_submenu:
|
||||||
submenu_paused: "Paused (%{count})"
|
submenu_paused: "Paused (%{count})"
|
||||||
submenu_allowed: "Allowed (%{count})"
|
submenu_allowed: "Allowed (%{count})"
|
||||||
|
|
|
@ -80,10 +80,10 @@ es:
|
||||||
text_show: Ver
|
text_show: Ver
|
||||||
text_checked: Con los marcados
|
text_checked: Con los marcados
|
||||||
profiles_checked_submenu:
|
profiles_checked_submenu:
|
||||||
submenu_pause: Pausado
|
submenu_pause: Pausar
|
||||||
submenu_accept: Aceptado
|
submenu_allow: Aceptar
|
||||||
submenu_reject: Rechazado
|
submenu_block: Bloquear
|
||||||
submenu_block: Bloqueado
|
submenu_report: Reportar
|
||||||
profiles_show_submenu:
|
profiles_show_submenu:
|
||||||
submenu_paused: "Pausadas (%{count})"
|
submenu_paused: "Pausadas (%{count})"
|
||||||
submenu_allowed: "Permitidas (%{count})"
|
submenu_allowed: "Permitidas (%{count})"
|
||||||
|
|
|
@ -80,6 +80,8 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
patch :actor_moderations_action_on_several, to: 'actor_moderations#action_on_several'
|
||||||
|
|
||||||
# Gestionar artículos según idioma
|
# Gestionar artículos según idioma
|
||||||
nested do
|
nested do
|
||||||
scope '/(:locale)', constraint: /[a-z]{2}(-[A-Z]{2})?/ do
|
scope '/(:locale)', constraint: /[a-z]{2}(-[A-Z]{2})?/ do
|
||||||
|
|
Loading…
Reference in a new issue