Skip to content

Commit

Permalink
Merge ca5eb51 into 66d97c0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-griffen committed Mar 26, 2024
2 parents 66d97c0 + ca5eb51 commit 0ebea07
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,8 @@ def matches?(request)
end
end

namespace :alaveteli_pro do
root to: 'dashboard#index', :as => :dashboard, :via => :get
namespace :alaveteli_pro, path: 'pro' do
get :dashboard, to: 'dashboard#index'
resources :draft_info_requests, :only => [:create, :update]
resources :info_requests, only: [:new, :create, :index] do
get :preview, on: :new # /info_request/new/preview
Expand Down Expand Up @@ -906,7 +906,7 @@ def matches?(request)
resources :public_bodies, :only => [:index]
end

scope path: :alaveteli_pro do
scope path: :pro do
# So that we can show a batch request using the existing controller from
# the pro context
match '/info_request_batches/:id' => 'info_request_batch#show',
Expand Down
4 changes: 4 additions & 0 deletions config/routes/redirects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,8 @@
get '/alaveteli_pro/info_requests/:url_title',
constraints: { url_title: /(?!new).*/ },
to: redirect('/request/%{url_title}')

get '/alaveteli_pro', to: redirect('/pro/dashboard')

get '/alaveteli_pro/*path', to: redirect('/pro/%{path}')
end
2 changes: 2 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Highlighted Features

* Update `/alaveteli_pro` base path to `/pro` (Alexander Griffen, Graeme
Porteous)
* Change use of `/alaveteli_pro/info_requests/{request}` to instead appear as
`/request/{request}` (Alexander Griffen, Graeme Porteous)
* Remove locale prefixes from URLs (Alexander Griffen, Graeme Porteous)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
it 'redirects to index action' do
get :new
expect(response).to redirect_to(
'/alaveteli_pro/batch_request_authority_searches'
'/pro/batch_request_authority_searches'
)
end
end
Expand Down
14 changes: 14 additions & 0 deletions spec/routing/redirects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,18 @@
get('/alaveteli_pro/info_requests/new')
expect(response).to_not redirect_to('/request/new')
end

it 'redirects from alaveteli_pro urls to pro urls', feature: :alaveteli_pro do
get('/alaveteli_pro')
expect(response).to redirect_to('/pro/dashboard')

get('/alaveteli_pro/pricing')
expect(response).to redirect_to('/pro/pricing')

get('/alaveteli_pro/embargoes')
expect(response).to redirect_to('/pro/embargoes')

get('/alaveteli_pro/embargoes/1')
expect(response).to redirect_to('/pro/embargoes/1')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def assign_variables
assign_variables
render
expect(rendered).
to match(/data-search-url="\/alaveteli_pro\/public_bodies"/)
to match(/data-search-url="\/pro\/public_bodies"/)
end

it "includes a hidden field for the body id" do
Expand Down

0 comments on commit 0ebea07

Please sign in to comment.