5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 19:56:21 +00:00

fix: form es opcional #15329

This commit is contained in:
f 2024-03-08 13:08:24 -03:00
parent 550dba08c5
commit fc77f8e9f4
No known key found for this signature in database
16 changed files with 49 additions and 26 deletions

View file

@ -1,5 +1,6 @@
-# Componente Checkbox -# Componente Checkbox
- local_assigns[:name] ||= id - local_assigns[:name] ||= id
.custom-control.custom-checkbox .custom-control.custom-checkbox
%input.custom-control-input{ form: local_assigns[:form_id], type: 'checkbox', id: id, **local_assigns } %input.custom-control-input{ type: 'checkbox', id: id, **local_assigns.compact }
%label.custom-control-label{ for: id }= yield %label.custom-control-label{ for: id }= yield

View file

@ -1,6 +1,9 @@
-#
@param form [String]
- current_state = params[:activity_pub_state]&.to_sym || ActivityPub.states.first - current_state = params[:activity_pub_state]&.to_sym || ActivityPub.states.first
- ActivityPub.aasm.events.each do |event| - ActivityPub.aasm.events.each do |event|
- next if ActivityPub::IGNORED_EVENTS.include? event.name - next if ActivityPub::IGNORED_EVENTS.include? event.name
- next unless event.transitions_from_state?(current_state) - next unless event.transitions_from_state?(current_state)
= render 'components/dropdown_button', form_id: form_id, text: t(".submenu_#{event.name}"), name: 'activity_pub_action', value: event.name = render 'components/dropdown_button', form: form, text: t(".submenu_#{event.name}"), name: 'activity_pub_action', value: event.name

View file

@ -1,9 +1,12 @@
-#
@params form [String]
- current_state = params[:activity_pub_state]&.to_sym || ActivityPub.states.first - current_state = params[:activity_pub_state]&.to_sym || ActivityPub.states.first
.d-flex.py-2 .d-flex.py-2
- if ActivityPub.transitionable_events(current_state).present? - if ActivityPub.transitionable_events(current_state).present?
= render 'components/dropdown', text: t('.text_checked') do = render 'components/dropdown', text: t('.text_checked') do
= render 'components/comments_checked_submenu', form_id: form_id = render 'components/comments_checked_submenu', form: form
= render 'components/dropdown', text: t('.text_show') do = render 'components/dropdown', text: t('.text_show') do
= render 'components/comments_show_submenu', activity_pubs: activity_pubs = render 'components/comments_show_submenu', activity_pubs: activity_pubs

View file

@ -1,4 +1,4 @@
-# -#
@param name [String] @param name [String]
@param value [String] @param value [String]
%button.dropdown-item{type: 'submit', data: { target: 'dropdown.item' }, name: name, value: value, form: local_assigns[:form_id] }= text %button.dropdown-item{type: 'submit', data: { target: 'dropdown.item' }, name: name, value: value, **local_assigns.compact }

View file

@ -1,2 +1,5 @@
-#
@params form [String]
- InstanceModeration.transitionable_events(current_state).each do |event| - InstanceModeration.transitionable_events(current_state).each do |event|
= render 'components/dropdown_button', text: t(".submenu_#{event}"), name: 'instance_moderation_action', value: event, form_id: form_id = render 'components/dropdown_button', text: t(".submenu_#{event}"), name: 'instance_moderation_action', value: event, form: form

View file

@ -1,9 +1,12 @@
-#
@params form [String]
- current_state = params[:state]&.to_sym || InstanceModeration.states.first - current_state = params[:state]&.to_sym || InstanceModeration.states.first
.d-flex.py-2 .d-flex.py-2
- if InstanceModeration.transitionable_events(current_state).present? - if InstanceModeration.transitionable_events(current_state).present?
= render 'components/dropdown', text: t('.text_checked') do = render 'components/dropdown', text: t('.text_checked') do
= render 'components/instances_checked_submenu', form_id: form_id, current_state: current_state = render 'components/instances_checked_submenu', form: form, current_state: current_state
= render 'components/dropdown', text: t('.text_show') do = render 'components/dropdown', text: t('.text_show') do
= render 'components/instances_show_submenu', instance_moderations: instance_moderations = render 'components/instances_show_submenu', instance_moderations: instance_moderations

View file

@ -1,2 +1,5 @@
-#
@params form [String]
- ActorModeration.transitionable_events(current_state).each do |actor_event| - ActorModeration.transitionable_events(current_state).each do |actor_event|
= render 'components/dropdown_button', text: t(".submenu_#{actor_event}"), name: 'actor_moderation_action', value: actor_event, form_id: form_id = render 'components/dropdown_button', text: t(".submenu_#{actor_event}"), name: 'actor_moderation_action', value: actor_event, form: form

View file

@ -1,9 +1,12 @@
-#
@params form [String]
- current_state = params[:actor_state]&.to_sym || ActorModeration.states.first - current_state = params[:actor_state]&.to_sym || ActorModeration.states.first
.d-flex.py-2 .d-flex.py-2
- if ActorModeration.transitionable_events(current_state).present? - if ActorModeration.transitionable_events(current_state).present?
= render 'components/dropdown', text: t('.text_checked') do = render 'components/dropdown', text: t('.text_checked') do
= render 'components/profiles_checked_submenu', form_id: form_id, current_state: current_state = render 'components/profiles_checked_submenu', form: form, current_state: current_state
= render 'components/dropdown', text: t('.text_show') do = render 'components/dropdown', text: t('.text_show') do
= render 'components/profiles_show_submenu', actor_moderations: actor_moderations = render 'components/profiles_show_submenu', actor_moderations: actor_moderations

View file

@ -1,4 +1,4 @@
-# -#
@param id [String] @param id [String]
= render 'components/checkbox', id: id, form: local_assigns[:form_id], data: { action: 'select-all#toggle', target: 'select-all.toggle' } do = render 'components/checkbox', id: id, data: { action: 'select-all#toggle', target: 'select-all.toggle', **local_assigns.compact } do
%span.sr-only= t('.label') %span.sr-only= t('.label')

View file

@ -7,7 +7,7 @@
navegador los va a asignar a este formulario. navegador los va a asignar a este formulario.
@param path [String] @param path [String]
@param form_id [String] @param form [String]
= form_tag path, id: form_id, method: :patch do = form_tag path, id: form, method: :patch do
-# nada -# nada

View file

@ -1,6 +1,9 @@
-#
@params form [String]
.row.no-gutters.pt-2 .row.no-gutters.pt-2
.col-1 .col-1
= render 'components/checkbox', id: actor_moderation.id, form_id: form_id, name: 'actor_moderation[]', value: actor_moderation.id, data: { target: 'select-all.input' } = render 'components/checkbox', id: actor_moderation.id, form: form, name: 'actor_moderation[]', value: actor_moderation.id, data: { target: 'select-all.input' }
.col-11 .col-11
%h4 %h4
= link_to text_plain(profile['name']), site_actor_moderation_path(id: actor_moderation) = link_to text_plain(profile['name']), site_actor_moderation_path(id: actor_moderation)

View file

@ -1,17 +1,17 @@
- form_id = 'actor_moderations_action_on_several' - form_id = 'actor_moderations_action_on_several'
= render 'components/select_all_container', path: site_actor_moderations_action_on_several_path, form_id: form_id = render 'components/select_all_container', path: site_actor_moderations_action_on_several_path, form: form_id
.row.no-gutters.pt-2{ data: { controller: 'select-all' } } .row.no-gutters.pt-2{ data: { controller: 'select-all' } }
.col-1.d-flex.align-items-center .col-1.d-flex.align-items-center
= render 'components/select_all', id: 'actors', form_id: form_id = render 'components/select_all', id: 'actors', form: form_id
.col-11 .col-11
-# Filtros -# Filtros
= render 'components/profiles_filters', actor_moderations: actor_moderations, form_id: form_id = render 'components/profiles_filters', actor_moderations: actor_moderations, form: form_id
.col-12 .col-12
- if actor_moderations.count.zero? - if actor_moderations.count.zero?
%h4= t('moderation_queue.nothing') %h4= t('moderation_queue.nothing')
- actor_moderations.find_each do |actor_moderation| - actor_moderations.find_each do |actor_moderation|
- cache [actor_moderation, actor_moderation.actor] do - cache [actor_moderation, actor_moderation.actor] do
%hr %hr
= render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content, form_id: form_id = render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content, form: form_id

View file

@ -1,6 +1,7 @@
-# -#
Componente Comentario Componente Comentario
@param form [String]
@param profile [Hash] @param profile [Hash]
@param comment [Hash] @param comment [Hash]
@param activity_pub [ActivityPub] @param activity_pub [ActivityPub]
@ -10,7 +11,7 @@
.row.no-gutters .row.no-gutters
.col-1 .col-1
= render 'components/checkbox', id: activity_pub.id, name: 'activity_pub[]', value: activity_pub.id, data: { target: 'select-all.input' }, form: form_id = render 'components/checkbox', id: activity_pub.id, name: 'activity_pub[]', value: activity_pub.id, data: { target: 'select-all.input' }, form: form
.col-11 .col-11
.d-flex.flex-row.align-items-center.justify-content-between .d-flex.flex-row.align-items-center.justify-content-between
%h4.mb-0 %h4.mb-0

View file

@ -1,17 +1,17 @@
- form_id = 'activity_pub_action_on_several' - form_id = 'activity_pub_action_on_several'
= render 'components/select_all_container', path: site_activity_pubs_action_on_several_path, form_id: form_id = render 'components/select_all_container', path: site_activity_pubs_action_on_several_path, form: form_id
.row.no-gutters.pt-2{ data: { controller: 'select-all' } } .row.no-gutters.pt-2{ data: { controller: 'select-all' } }
.col-1.d-flex.align-items-center .col-1.d-flex.align-items-center
= render 'components/select_all', id: 'select-all-comments', form_id: form_id = render 'components/select_all', id: 'select-all-comments', form: form_id
.col-11 .col-11
-# Filtros -# Filtros
= render 'components/comments_filters', activity_pubs: moderation_queue, form_id: form_id = render 'components/comments_filters', activity_pubs: moderation_queue, form: form_id
.col-12 .col-12
- if moderation_queue.count.zero? - if moderation_queue.count.zero?
%h4= t('moderation_queue.nothing') %h4= t('moderation_queue.nothing')
- moderation_queue.each do |activity_pub| - moderation_queue.each do |activity_pub|
-# cache [activity_pub, activity_pub.object, activity_pub.actor] do -# cache [activity_pub, activity_pub.object, activity_pub.actor] do
%hr %hr
= render 'moderation_queue/comment', comment: activity_pub.object.content, profile: activity_pub.actor.content, activity_pub: activity_pub, form_id: form_id = render 'moderation_queue/comment', comment: activity_pub.object.content, profile: activity_pub.actor.content, activity_pub: activity_pub, form: form_id

View file

@ -3,7 +3,7 @@
.row.no-gutters.pt-2 .row.no-gutters.pt-2
.col-1 .col-1
= render 'components/checkbox', id: instance.hostname, form_id: form_id, name: 'instance_moderation[]', value: instance_moderation.id, data: { target: 'select-all.input' } = render 'components/checkbox', id: instance.hostname, form: form, name: 'instance_moderation[]', value: instance_moderation.id, data: { target: 'select-all.input' }
.col-11 .col-11
%h4 %h4
%a{ href: instance.uri }= sanitize(instance.content['title']) || instance.hostname %a{ href: instance.uri }= sanitize(instance.content['title']) || instance.hostname

View file

@ -1,13 +1,13 @@
- form_id = 'instance_moderation_action_on_several' - form_id = 'instance_moderation_action_on_several'
%section %section
= render 'components/select_all_container', path: site_instance_moderations_action_on_several_path, form_id: form_id = render 'components/select_all_container', path: site_instance_moderations_action_on_several_path, form: form_id
.row.no-gutters.pt-2{ data: { controller: 'select-all' } } .row.no-gutters.pt-2{ data: { controller: 'select-all' } }
.col-1.d-flex.align-items-center .col-1.d-flex.align-items-center
= render 'components/select_all', id: 'instances', form_id: form_id = render 'components/select_all', id: 'instances', form: form_id
.col-11 .col-11
-# Filtros -# Filtros
= render 'components/instances_filters', instance_moderations: instance_moderations, form_id: form_id = render 'components/instances_filters', instance_moderations: instance_moderations, form: form_id
.col-12 .col-12
- if instance_moderations.count.zero? - if instance_moderations.count.zero?
@ -16,7 +16,7 @@
- instance_moderations.each do |instance_moderation| - instance_moderations.each do |instance_moderation|
- cache [instance_moderation.aasm_state, instance_moderation.instance] do - cache [instance_moderation.aasm_state, instance_moderation.instance] do
%hr %hr
= render 'moderation_queue/instance', instance_moderation: instance_moderation, instance: instance_moderation.instance, form_id: form_id = render 'moderation_queue/instance', instance_moderation: instance_moderation, instance: instance_moderation.instance, form: form_id
%hr %hr
%div %div