mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 16:16:21 +00:00
fix: indicar el filtro activo #15652
This commit is contained in:
parent
8034d20612
commit
ab43c84ab1
5 changed files with 17 additions and 5 deletions
|
@ -2,6 +2,14 @@
|
|||
|
||||
module ModerationQueueHelper
|
||||
def filter_states(**args)
|
||||
params.permit(:state, :actor_state, :activity_pub_state).merge(**args)
|
||||
params.permit(:instance_state, :actor_state, :activity_pub_state).merge(**args)
|
||||
end
|
||||
|
||||
def active?(states, state_name, state)
|
||||
if params[state_name].present?
|
||||
params[state_name] == state.to_s
|
||||
else
|
||||
states.first == state
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- ActivityPub.states.each do |state|
|
||||
= render 'components/dropdown_item',
|
||||
text: t(".submenu_#{state}", count: activity_pubs.unscope(where: :aasm_state).public_send(state).count),
|
||||
path: filter_states(activity_pub_state: state)
|
||||
path: filter_states(activity_pub_state: state),
|
||||
class: ('active' if active?(ActivityPub.states, :activity_pub_state, state))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
-#
|
||||
@param :text [String] Contenido del link
|
||||
@param :path [String,Hash] Link
|
||||
= link_to text, path, class: 'dropdown-item', data: { target: 'dropdown.item' }
|
||||
- local_assigns[:class] = "dropdown-item #{local_assigns[:class]}"
|
||||
= link_to text, path, class: local_assigns[:class], data: { target: 'dropdown.item' }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- InstanceModeration.states.each do |state|
|
||||
= render 'components/dropdown_item',
|
||||
text: t(".submenu_#{state}", count: instance_moderations.unscope(where: :aasm_state).public_send(state).count),
|
||||
path: filter_states(instance_state: state)
|
||||
path: filter_states(instance_state: state),
|
||||
class: ('active' if active?(InstanceModeration.states, :instance_state, state))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- ActorModeration.states.each do |actor_state|
|
||||
= render 'components/dropdown_item',
|
||||
text: t(".submenu_#{actor_state}", count: actor_moderations.unscope(where: :aasm_state).public_send(actor_state).count),
|
||||
path: filter_states(actor_state: actor_state)
|
||||
path: filter_states(actor_state: actor_state),
|
||||
class: ('active' if active?(ActorModeration.states, :actor_state, actor_state))
|
||||
|
|
Loading…
Reference in a new issue