Open mabijkerk opened 1 month ago
TLDR: I can't identify the issue exactly so far. By all accounts and the kaminari docs it should be working as is...
From the first page the pagination links populate correctly. Url: http://localhost:3001/saved_scenarios/all
Generated Links: <nav class="pagination" role="navigation" aria-label="pager">
<span class="page current"> 1 </span>
<span class="page">
<a rel="next" href="/saved_scenarios/all?page=2">2</a>
</span> <span class="page">
<a href="/saved_scenarios/all?page=3">3</a> </span>
<span class="page"> <a href="/saved_scenarios/all?page=4">4</a> </span>
<span class="page"> <a href="/saved_scenarios/all?page=5">5</a> </span>
<span class="page gap">…</span> <span class="next"> <a rel="next" href="/saved_scenarios/all?page=2">Next ›</a> </span> <span class="last"> <a href="/saved_scenarios/all?page=514">Last »</a> </span> </nav>
But then from any other page where there is a 'current page' parameter, the links all just link to the current page: Url: http://localhost:3001/saved_scenarios/all?page=3
Generated Links: <nav class="pagination" role="navigation" aria-label="pager">
<span class="first">
<a href="/saved_scenarios/all">« First</a>
</span> <span class="prev"> <a rel="prev" href="/saved_scenarios/all?page=3">‹ Prev</a> </span>
<span class="page"> <a href="/saved_scenarios/all">1</a>
</span> <span class="page"> <a rel="prev" href="/saved_scenarios/all?page=3">2</a>
</span> <span class="page current"> 3 </span> <span class="page">
<a rel="next" href="/saved_scenarios/all?page=3">4</a> </span>
<span class="page"> <a href="/saved_scenarios/all?page=3">5</a> </span>
<span class="page"> <a href="/saved_scenarios/all?page=3">6</a> </span>
<span class="page"> <a href="/saved_scenarios/all?page=3">7</a> </span>
<span class="page gap">…</span> <span class="next"> <a rel="next" href="/saved_scenarios/all?page=3">Next ›</a> </span> <span class="last"> <a href="/saved_scenarios/all?page=3">Last »</a> </span> </nav>
The 'current page' is updating correctly as the :page param, so I don't really know what kaminari's problem is.
I also tried updating the kaminari gem to 1.2.2 - this didn't break any spec but also didn't make any difference.
I also tried adding a route: get 'all(/page/:page)', action: :all, as: :all_saved_scenarios
which didn't make any difference unfortunately.
resources :saved_scenarios, except: %i[new] do
resource :feature, only: %i[show create update destroy], controller: 'featured_scenarios'
resources :users, controller: 'saved_scenario_users' do
member do
get :confirm_destroy
end
end
member do
get :load
put :discard
put :undiscard
put :publish
put :unpublish
put :restore
get :confirm_restore
end
collection do
get :discarded
get :all
end
get 'all(/page/:page)', action: :all, as: :all_saved_scenarios
get '/history' => 'saved_scenario_history#index'
put '/history/:scenario_id' => 'saved_scenario_history#update', as: :update_saved_scenario_history
get '/report/:report_name' => 'saved_scenario_reports#show'
end
In the navigation pane of My Scenarios, I can switch to the second page. However, once I'm there, the navigation buttons do not give any response. I'm working in Google Chrome.