From 819ed25e29a2559bcb2a541b3c46cb887e348fc4 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 1 Feb 2024 12:02:40 -0300 Subject: [PATCH] fix: eliminadas botoneras de comentarios y remote_profile y unificadas en componente button_box #15028 --- app/controllers/application_controller.rb | 13 +++++++++++++ app/controllers/moderation_queue_controller.rb | 1 + app/controllers/posts_controller.rb | 1 + app/views/moderation_queue/_button_box.haml | 6 ++++++ .../moderation_queue/_comment_button_box.haml | 14 -------------- .../moderation_queue/_profile_button_box.haml | 4 ++-- app/views/moderation_queue/index.haml | 2 +- app/views/posts/_moderation_queue.haml | 2 +- config/locales/es.yml | 2 +- 9 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 app/views/moderation_queue/_button_box.haml delete mode 100644 app/views/moderation_queue/_comment_button_box.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 903d3642..360a9b2d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,6 +37,19 @@ class ApplicationController < ActionController::Base 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 + @comment_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', '']] + end + def notify_unconfirmed_email return unless current_usuarie return if current_usuarie.confirmed? diff --git a/app/controllers/moderation_queue_controller.rb b/app/controllers/moderation_queue_controller.rb index 4a65f136..04a31389 100644 --- a/app/controllers/moderation_queue_controller.rb +++ b/app/controllers/moderation_queue_controller.rb @@ -9,6 +9,7 @@ class ModerationQueueController < ApplicationController @moderation_queue.each do |activity| activity['attributedTo'] = @remote_profile end + botoneras_moderation_queue end # Perfil remoto de usuarie diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 5be56acc..36d17339 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -83,6 +83,7 @@ class PostsController < ApplicationController breadcrumb post.title.value, site_post_path(site, post, locale: locale), match: :exact breadcrumb 'posts.edit', '' dummy_data + botoneras_moderation_queue end def update diff --git a/app/views/moderation_queue/_button_box.haml b/app/views/moderation_queue/_button_box.haml new file mode 100644 index 00000000..a56b2552 --- /dev/null +++ b/app/views/moderation_queue/_button_box.haml @@ -0,0 +1,6 @@ +-# Componente Botonera de Moderación + +.d-flex.py-2.justify-content-center + - comment_btn_params.each do |btn| + - @class = btn[1] + = render 'moderation_queue/btn_base', href: btn[2], class: @class, text: btn[0] \ No newline at end of file diff --git a/app/views/moderation_queue/_comment_button_box.haml b/app/views/moderation_queue/_comment_button_box.haml deleted file mode 100644 index bd367e09..00000000 --- a/app/views/moderation_queue/_comment_button_box.haml +++ /dev/null @@ -1,14 +0,0 @@ --# Componente Botonera de Moderación - -.d-flex.py-2.justify-content-center - -# parámetros de botones - -# text, class, href - - btn_box_params = [[t('.text_pause'), 'btn-secondary', ''], - [t('.text_reject'), 'btn-primary', ''], - [t('.text_accept'), 'bg-blue white', ''], - [t('.text_reply'), 'btn-outline-primary', ''], - [t('.text_report'), 'btn-outline-danger', '']] - - - btn_box_params.each do |btn| - - @class = btn[1] - = render 'moderation_queue/btn_base', href: btn[2], class: @class, text: btn[0] \ No newline at end of file diff --git a/app/views/moderation_queue/_profile_button_box.haml b/app/views/moderation_queue/_profile_button_box.haml index 9de64e12..d15b6ed0 100644 --- a/app/views/moderation_queue/_profile_button_box.haml +++ b/app/views/moderation_queue/_profile_button_box.haml @@ -3,10 +3,10 @@ .d-flex.py-2.justify-content-center -# parámetros de botones -# text, class, href - - btn_box_params = [[t('.text_deny'), 'btn-outline-info', ''], + - comment_btn_params = [[t('.text_deny'), 'btn-outline-info', ''], [t('.text_allow'), 'btn-success', 'https://sutty.nl/'], [t('.text_report'), 'btn-outline-danger', 'https://sutty.nl/']] - - btn_box_params.each do |btn| + - comment_btn_params.each do |btn| - @class = btn[1] = render 'moderation_queue/btn_base', href: btn[2], class: @class, text: btn[0] diff --git a/app/views/moderation_queue/index.haml b/app/views/moderation_queue/index.haml index a3897417..39ac74a3 100644 --- a/app/views/moderation_queue/index.haml +++ b/app/views/moderation_queue/index.haml @@ -2,4 +2,4 @@ - @moderation_queue.each do |comment| = render 'comment', comment: comment, profile: @remote_profile - = render 'moderation_queue/comment_button_box' \ No newline at end of file + = render 'moderation_queue/button_box', comment_btn_params: @comment_btn_params \ No newline at end of file diff --git a/app/views/posts/_moderation_queue.haml b/app/views/posts/_moderation_queue.haml index b861d67d..e4eb422c 100644 --- a/app/views/posts/_moderation_queue.haml +++ b/app/views/posts/_moderation_queue.haml @@ -4,4 +4,4 @@ - moderation_queue.each do |comment| = render 'moderation_queue/comment', comment: comment, profile: @remote_profile .row.d-flex.justify-content-center - = render 'moderation_queue/comment_button_box' + = render 'moderation_queue/button_box', comment_btn_params: @comment_btn_params diff --git a/config/locales/es.yml b/config/locales/es.yml index d579d55e..7850bcf7 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -12,7 +12,7 @@ es: text_deny: Bloquear que te siga text_allow: Permitir que te siga text_report: Reportar - comment_button_box: + button_box: text_pause: Pausa text_reject: Rechazar text_accept: Aceptar Publicación