From f23a3ef1929ada7d0303fa15411de69221817212 Mon Sep 17 00:00:00 2001 From: barbara oliveira Date: Wed, 15 Jan 2025 17:31:22 +0100 Subject: [PATCH] add pagination to title in the component: Debates --- .../app/controllers/decidim/debates/debates_controller.rb | 4 ++++ .../app/views/decidim/debates/debates/index.html.erb | 5 ++++- decidim-debates/config/locales/en.yml | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/decidim-debates/app/controllers/decidim/debates/debates_controller.rb b/decidim-debates/app/controllers/decidim/debates/debates_controller.rb index 8a159ece39e04..154ba3230a678 100644 --- a/decidim-debates/app/controllers/decidim/debates/debates_controller.rb +++ b/decidim-debates/app/controllers/decidim/debates/debates_controller.rb @@ -16,6 +16,10 @@ class DebatesController < Decidim::Debates::ApplicationController helper_method :debates, :debate, :form_presenter, :paginated_debates, :close_debate_form, :tab_panel_items before_action :authenticate_user!, only: [:new, :create] + def index; + @debates = paginated_debates + end + def new enforce_permission_to :create, :debate diff --git a/decidim-debates/app/views/decidim/debates/debates/index.html.erb b/decidim-debates/app/views/decidim/debates/debates/index.html.erb index 4557e9431f0a4..6f0c381afd9ad 100644 --- a/decidim-debates/app/views/decidim/debates/debates/index.html.erb +++ b/decidim-debates/app/views/decidim/debates/debates/index.html.erb @@ -1,6 +1,9 @@ <% add_decidim_meta_tags( description: translated_attribute(current_participatory_space.short_description), - title: component_name, + title: t("decidim.components.pagination.page_title", + component_name: component_name, + current_page: @debates.current_page, + total_pages: @debates.total_pages ), url: debates_url, resource: current_component) %> diff --git a/decidim-debates/config/locales/en.yml b/decidim-debates/config/locales/en.yml index f9a1f90344895..7e24058250a85 100644 --- a/decidim-debates/config/locales/en.yml +++ b/decidim-debates/config/locales/en.yml @@ -53,6 +53,8 @@ en: creation_enabled: Participants can create debates endorsements_blocked: Endorsements blocked endorsements_enabled: Endorsements enabled + pagination: + page_title: "%{component_name} - Page %{current_page} of %{total_pages}" debates: actions: close: Close