5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 11:36:23 +00:00

fix: movidas arrays de parametros de botones y filtros a helper moderation_queue_helper.rb #15077
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
jazzari 2024-02-05 12:22:23 -03:00
parent cfae99ca7b
commit 40346df76d
11 changed files with 69 additions and 42 deletions

View file

@ -36,31 +36,7 @@ class ApplicationController < ActionController::Base
activity['attributedTo'] = @remote_profile activity['attributedTo'] = @remote_profile
end end
end end
# parámetros de botones:
# text: [texto del botón]
# class: [clases css]
# href: [href del botón]
def botoneras_moderation_queue
# botones de comentarios
@btn_params = [[t('moderation_queue.button_box.text_pause'), 'btn-secondary', ''],
[t('moderation_queue.button_box.text_reject'), 'btn-primary', ''],
[t('moderation_queue.button_box.text_accept'), 'bg-blue white', ''],
[t('moderation_queue.button_box.text_reply'), 'btn-outline-primary', ''],
[t('moderation_queue.button_box.text_report'), 'btn-danger', '']]
#botones de remote_profile (cuentas)
@profile_btn_params = [[t('moderation_queue.profile_button_box.text_approve'), 'btn-success', ''],
[t('moderation_queue.profile_button_box.text_check'), 'btn-outline-success', ''],
[t('moderation_queue.profile_button_box.text_deny'), 'bg-blue white', ''],
[t('moderation_queue.profile_button_box.text_report'), 'btn-danger', '']]
#botones de instances (instancias)
@instances_btn_params = [[t('moderation_queue.instances_button_box.text_check'), 'btn-outline-success', ''],
[t('moderation_queue.instances_button_box.text_allow'), 'btn-success', ''],
[t('moderation_queue.instances_button_box.text_deny'), 'btn-danger', '']]
end
def notify_unconfirmed_email def notify_unconfirmed_email
return unless current_usuarie return unless current_usuarie
return if current_usuarie.confirmed? return if current_usuarie.confirmed?

View file

@ -9,13 +9,11 @@ class ModerationQueueController < ApplicationController
@moderation_queue.each do |activity| @moderation_queue.each do |activity|
activity['attributedTo'] = @remote_profile activity['attributedTo'] = @remote_profile
end end
botoneras_moderation_queue
end end
# Perfil remoto de usuarie # Perfil remoto de usuarie
def remote_profile def remote_profile
@remote_profile = YAML.safe_load(File.read(Rails.root.join('db', 'seeds', 'remote_profile.yaml'))) @remote_profile = YAML.safe_load(File.read(Rails.root.join('db', 'seeds', 'remote_profile.yaml')))
botoneras_moderation_queue
end end
# todon.nl está usando /api/v2/instance # todon.nl está usando /api/v2/instance

View file

@ -83,7 +83,6 @@ class PostsController < ApplicationController
breadcrumb post.title.value, site_post_path(site, post, locale: locale), match: :exact breadcrumb post.title.value, site_post_path(site, post, locale: locale), match: :exact
breadcrumb 'posts.edit', '' breadcrumb 'posts.edit', ''
dummy_data dummy_data
botoneras_moderation_queue
end end
def update def update

View file

@ -0,0 +1,47 @@
module ModerationQueueHelper
# parámetros de botones:
# text: [texto del botón]
# class: [clases css]
# href: [href del botón]
def botoneras_moderation_queue
# botones de comentarios
@btn_params = [[t('moderation_queue.button_box.text_pause'), 'btn-secondary', ''],
[t('moderation_queue.button_box.text_reject'), 'btn-primary', ''],
[t('moderation_queue.button_box.text_accept'), 'bg-blue white', ''],
[t('moderation_queue.button_box.text_reply'), 'btn-outline-primary', ''],
[t('moderation_queue.button_box.text_report'), 'btn-danger', '']]
#botones de remote_profile (cuentas)
@profile_btn_params = [[t('moderation_queue.profile_button_box.text_approve'), 'btn-success', ''],
[t('moderation_queue.profile_button_box.text_check'), 'btn-outline-success', ''],
[t('moderation_queue.profile_button_box.text_deny'), 'bg-blue white', ''],
[t('moderation_queue.profile_button_box.text_report'), 'btn-danger', '']]
#botones de instances (instancias)
@instances_btn_params = [[t('moderation_queue.instances_button_box.text_check'), 'btn-outline-success', ''],
[t('moderation_queue.instances_button_box.text_allow'), 'btn-success', ''],
[t('moderation_queue.instances_button_box.text_deny'), 'btn-danger', '']]
end
# parámetros de filtros:
# text: [texto del botón]
# href: [href del botón]
def filtros_moderation_queue
@comment_filter_params = {
t('moderation_queue.filter_box.text_checked') =>
[
[t('moderation_queue.filter_box.submenu_pause'), '/sutty.nl'],
[t('moderation_queue.filter_box.submenu_reject'), '#reject'],
[t('moderation_queue.filter_box.submenu_accept'),'#accept']
],
t('moderation_queue.filter_box.text_show') =>
[
[t('moderation_queue.filter_box.submenu_pause'), '#pause'],
[t('moderation_queue.filter_box.submenu_reject'), '#reject'],
[t('moderation_queue.filter_box.submenu_accept'),'#accept'],
[t('moderation_queue.filter_box.submenu_report'), '#report']
]
}
end
end

View file

@ -1,6 +0,0 @@
-# Componente Caja de Filtros
.d-flex.py-2.justify-content-center
= render 'moderation_queue/filter_base', text: t('.text_checked')
= render 'moderation_queue/filter_base', text: t('.text_show')
= render 'moderation_queue/filter_base', text: t('.text_order')

View file

@ -1,4 +1,6 @@
= render 'moderation_queue/comment_filter_box' - filtros_moderation_queue
- botoneras_moderation_queue
= render 'moderation_queue/filter_box', filter_params: @comment_filter_params
- @moderation_queue.each do |comment| - @moderation_queue.each do |comment|
= render 'comment', comment: comment, profile: @remote_profile = render 'comment', comment: comment, profile: @remote_profile

View file

@ -1,8 +1,7 @@
-# Componente Filtro -# Componente Filtro
.dropdown.mx-4 .dropdown.mx-4
%button#dropdownMenuButton.btn.btn-outline-secondary.dropdown-toggle{:type => "button", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"} %button#dropdownMenuButton.btn.btn-outline-secondary.dropdown-toggle{:type => "button", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"}
%span #{text} %span= text
.dropdown-menu{"aria-labelledby" => "dropdownMenuButton"} .dropdown-menu{"aria-labelledby" => "dropdownMenuButton"}
%a.dropdown-item{ href: '#' } Action - menu.each do |subm|
%a.dropdown-item{ href: '#' } Another action %a.dropdown-item{ href: subm[1] } subm[0]
%a.dropdown-item{ href: '#' } Something else here

View file

@ -0,0 +1,6 @@
-# Componente Caja de Filtros
.d-flex.py-2.justify-content-center
- filter_params.each do |filter, submenu|
= render 'moderation_queue/filter_base', text: filter, menu: submenu

View file

@ -1,6 +1,7 @@
-# Componente Remote_Profile -# Componente Remote_Profile
.flex.py-2.mx-2.text-center .flex.py-2.mx-2.text-center
- botoneras_moderation_queue
%h4.mb-2= t('.profile_name') + ': ' + remote_profile['name'] %h4.mb-2= t('.profile_name') + ': ' + remote_profile['name']
%h5= t('.profile_id') + ': ' + remote_profile['id'] %h5= t('.profile_id') + ': ' + remote_profile['id']
%h5= t('.profile_published') + ': ' + remote_profile['published'].to_datetime.strftime('%m/%d/%Y') %h5= t('.profile_published') + ': ' + remote_profile['published'].to_datetime.strftime('%m/%d/%Y')

View file

@ -1,6 +1,8 @@
.flex .flex
%h3.text-center.py-2 Comentarios %h3.text-center.py-2 Comentarios
= render 'moderation_queue/comment_filter_box' - botoneras_moderation_queue
- filtros_moderation_queue
= render 'moderation_queue/filter_box', filter_params: @comment_filter_params
- moderation_queue.each do |comment| - moderation_queue.each do |comment|
= render 'moderation_queue/comment', comment: comment, profile: @remote_profile = render 'moderation_queue/comment', comment: comment, profile: @remote_profile
.row.d-flex.justify-content-center .row.d-flex.justify-content-center

View file

@ -24,10 +24,13 @@ es:
text_accept: Aceptar Publicación text_accept: Aceptar Publicación
text_reply: Responder text_reply: Responder
text_report: Reportar text_report: Reportar
comment_filter_box: filter_box:
text_order: Ordenar por
text_show: Ver text_show: Ver
text_checked: Con los marcados text_checked: Con los marcados
submenu_pause: Pausado
submenu_reject: Rechazado
submenu_accept: Aceptado
submenu_report: Reportado
instances_button_box: instances_button_box:
text_check: Moderar caso por caso text_check: Moderar caso por caso
text_allow: Permitir todo text_allow: Permitir todo