quintel / etmodel

Professional interface of the Energy Transition model.
https://energytransitionmodel.com/
MIT License
33 stars 14 forks source link

Navigation in My Scenarios is broken #4307

Closed mabijkerk closed 4 days ago

mabijkerk commented 4 months ago

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.

Screenshot 2024-07-24 at 15 31 01

louispt1 commented 4 months ago

Keeping track of progress

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">&hellip;</span> <span class="next"> <a rel="next" href="/saved_scenarios/all?page=2">Next &rsaquo;</a> </span> <span class="last"> <a href="/saved_scenarios/all?page=514">Last &raquo;</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">&laquo; First</a>
 </span> <span class="prev"> <a rel="prev" href="/saved_scenarios/all?page=3">&lsaquo; 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">&hellip;</span> <span class="next"> <a rel="next" href="/saved_scenarios/all?page=3">Next &rsaquo;</a> </span> <span class="last"> <a href="/saved_scenarios/all?page=3">Last &raquo;</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
github-actions[bot] commented 1 month ago

This issue has had no activity for 60 days and will be closed in 7 days. Removing the "Stale" label or posting a comment will prevent it from being closed automatically. You can also add the "Pinned" label to ensure it isn't marked as stale in the future.

noracato commented 4 days ago

Is being picked up in my-etm.