Skip to content

Added reports navigation Item in sidebar#265

Open
AliK070 wants to merge 2 commits intomainfrom
reports-sidebar-nav-new
Open

Added reports navigation Item in sidebar#265
AliK070 wants to merge 2 commits intomainfrom
reports-sidebar-nav-new

Conversation

@AliK070
Copy link
Contributor

@AliK070 AliK070 commented Mar 24, 2026

TL;DR

Added icon and navigation for the reports view page.


What is this PR trying to achieve?

To add navigation for viewing the reports page.


How did you achieve it?

Added the Reports sidebar navigation item (using the reports-fill icon) and adds the i18n keys so the label appears correctly in supported locales.


Checklist

  • Changes have been top-hatted locally
  • Tests have been added or updated
  • Documentation has been updated (if applicable)
  • Linked related issues

Copilot AI review requested due to automatic review settings March 24, 2026 16:48
@AliK070 AliK070 self-assigned this Mar 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Reports entry to the admin sidebar and introduces an index page for listing/deleting reports, with supporting routes, translations, icons, and controller/tests.

Changes:

  • Added reports#index UI (table + actions) and wired up reports#index / reports#destroy routes and controller actions.
  • Added sidebar navigation item for Reports, plus EN/ES i18n keys for sidebar + index/destroy copy.
  • Added controller test coverage for index/destroy behavior and authorization redirects.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/controllers/reports_controller_test.rb Extends auth coverage for index/destroy and adds basic index + destroy behavior tests.
config/routes.rb Exposes reports#index and reports#destroy.
config/locales/es/reports.es.yml Adds ES strings for index + destroy + Report attribute labels.
config/locales/es/components.es.yml Adds ES sidebar label for “Reports”.
config/locales/en/reports.en.yml Adds EN strings for index + destroy + Report attribute labels.
config/locales/en/components.en.yml Adds EN sidebar label for “Reports”.
app/views/reports/index.html.erb New index page rendering reports table and action buttons.
app/controllers/reports_controller.rb Adds index and destroy actions.
app/components/sidebar_component.rb Adds Reports item in admin sidebar section.
app/assets/images/icons/reports-fill.svg New icon asset used by sidebar item.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +6
<%= render ActionButtonComponent.new(to: new_report_path, icon: "add", colour: :primary, size: :large, turbo_stream: true) do %>
<%= t(".actions.create") %>
<% end %>
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActionButtonComponent is rendering this link with data-turbo-stream, but ReportsController#new doesn’t declare a turbo_stream response and there’s no app/views/reports/new.turbo_stream.erb. This will cause a MissingTemplate (or an unexpected turbo_stream format) when the button is clicked. Either remove turbo_stream: true here, or add respond_to + a new.turbo_stream.erb template (as done in Projects/Regions/Users).

Copilot uses AI. Check for mistakes.
<% table.column :actions, header: t("shared.index_table_component.actions"), col_size: "90px" do |report| %>
<div class="flex items-center gap-2">
<%= render ActionButtonComponent.new(to: report_path(report), icon: "view") %>
<%= render ActionButtonComponent.new(to: edit_report_path(report), icon: "edit", colour: :info, turbo_stream: true) %>
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This edit action button is sent as a Turbo Stream request (turbo_stream: true), but ReportsController#edit currently doesn’t respond_to :turbo_stream and there’s no edit.turbo_stream.erb template under app/views/reports/. This can raise MissingTemplate when navigating to edit from the index.

Suggested change
<%= render ActionButtonComponent.new(to: edit_report_path(report), icon: "edit", colour: :info, turbo_stream: true) %>
<%= render ActionButtonComponent.new(to: edit_report_path(report), icon: "edit", colour: :info) %>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants