Skip to content

Added reports navigation Item in sidebar#265

Merged
pranavrao145 merged 7 commits intomainfrom
reports-sidebar-nav-new
Mar 27, 2026
Merged

Added reports navigation Item in sidebar#265
pranavrao145 merged 7 commits intomainfrom
reports-sidebar-nav-new

Conversation

@AliK070
Copy link
Copy Markdown
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
Copy Markdown
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 thread app/views/reports/index.html.erb Outdated
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.
Comment thread app/views/reports/index.html.erb Outdated
<% 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.
Copilot AI review requested due to automatic review settings March 27, 2026 01:30
Copy link
Copy Markdown
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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.


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

Comment thread config/routes.rb Outdated

# Report routes
resources :reports do
resources :reports, only: %i[index show new create edit update destroy] do
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

resources :reports already generates all 7 RESTful routes by default, so listing only: %i[index show new create edit update destroy] is redundant and adds upkeep if routes change later. Either remove the only: entirely or restrict it to the minimal set of actions you actually intend to expose.

Suggested change
resources :reports, only: %i[index show new create edit update destroy] do
resources :reports do

Copilot uses AI. Check for mistakes.
Comment thread config/routes.rb Outdated

# Report routes
resources :reports do
resources :reports, only: %i[index show new create edit update destroy] do
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

PR description checklist indicates tests were added/updated, but this PR doesn't include any test changes in the diff. If this is intentional, consider updating the checklist; otherwise, add/adjust tests to reflect the UI/i18n changes.

Copilot uses AI. Check for mistakes.
Comment thread config/locales/en/reports.en.yml Outdated
Comment on lines +33 to +36
columns:
end_date: End date
id: ID
start_date: Start date
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

These reports.index.columns.* translations duplicate the already-present activerecord.attributes.report.* entries in the same file. If the table can rely on human_attribute_name (or you reference the activerecord keys), you can remove this duplicated block to keep i18n DRY.

Suggested change
columns:
end_date: End date
id: ID
start_date: Start date

Copilot uses AI. Check for mistakes.
Comment thread config/locales/es/reports.es.yml Outdated
Comment on lines +33 to +36
columns:
end_date: Fecha de fin
id: ID
start_date: Fecha de inicio
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

These reports.index.columns.* translations duplicate the already-present activerecord.attributes.report.* entries in the same file. If the table can rely on human_attribute_name (or you reference the activerecord keys), you can remove this duplicated block to keep i18n DRY.

Suggested change
columns:
end_date: Fecha de fin
id: ID
start_date: Fecha de inicio

Copilot uses AI. Check for mistakes.
Comment thread app/views/reports/index.html.erb
Comment thread config/locales/es/reports.es.yml
Comment thread config/routes.rb
Comment thread config/locales/en/reports.en.yml
@pranavrao145 pranavrao145 merged commit 1d7984f into main Mar 27, 2026
7 checks passed
@pranavrao145 pranavrao145 deleted the reports-sidebar-nav-new branch March 27, 2026 03:22
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.

3 participants