Skip to content

Commit

Permalink
refactoring: Adding corporates routes
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Oct 29, 2024
1 parent 52c9748 commit 30ca21f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/javascript/components/tpi/DropdownSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ const DropdownSelector = ({ sectors, companies, selectedOption, defaultFilter =
);

const handleOptionClick = (option) => {
const url = isFilterBySector ? '/sectors/' : '/companies/';
const url = isFilterBySector ? '/corporates/' : '/companies/';
setIsOpen(false);
if (!(window.location.pathname === '/sectors/' && option.id === 'all-sectors')) {
if (!(window.location.pathname === '/corporates/' && option.id === 'all-sectors')) {
window.open(`${url}${option.slug}`, '_self');
}
};
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/tpi/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
content: [
{
title: 'Corporates (CP & MQ)',
path: tpi_sectors_path,
path: tpi_corporates_url,
},
{
title: 'Corporate bonds issuers',
Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
end
end

get '/corporates', to: 'sectors#index'
get '/corporates/:id', to: 'sectors#show'

resources :companies, only: [:show] do
member do
get :emissions_chart_data
Expand Down

0 comments on commit 30ca21f

Please sign in to comment.