diff --git a/app/views/user/questions.html.haml b/app/views/user/questions.html.haml index 7f237504..ba589f59 100644 --- a/app/views/user/questions.html.haml +++ b/app/views/user/questions.html.haml @@ -4,8 +4,11 @@ - if @more_data_available .d-flex.justify-content-center.justify-content-sm-start#paginator - = button_to show_user_questions_path(@user, last_id: @questions_last_id), class: "btn btn-light" do - = t("voc.load") + = button_to t("voc.load"), show_user_questions_path(@user), + class: "btn btn-light", + method: :get, + params: { last_id: @questions_last_id }, + form: { data: { turbo_stream: true } } - provide(:title, questions_title(@user)) - parent_layout 'user/profile' diff --git a/app/views/user/questions.turbo_stream.haml b/app/views/user/questions.turbo_stream.haml index 75175a5a..a48fafe9 100644 --- a/app/views/user/questions.turbo_stream.haml +++ b/app/views/user/questions.turbo_stream.haml @@ -4,5 +4,8 @@ = turbo_stream.update "paginator" do - if @more_data_available - = button_to show_user_questions_path(@user, last_id: @questions_last_id), class: "btn btn-light" do - = t("voc.load") + = button_to t("voc.load"), show_user_questions_path(@user), + class: "btn btn-light", + method: :get, + params: { last_id: @questions_last_id }, + form: { data: { turbo_stream: true } } diff --git a/config/routes.rb b/config/routes.rb index 5a72b22d..102a67eb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -158,7 +158,7 @@ Rails.application.routes.draw do get "/@:username/followers(/p/:page)", to: "user#followers", as: :show_user_followers, defaults: { page: 1 } get "/@:username/followings(/p/:page)", to: "user#followings", as: :show_user_followings, defaults: { page: 1 } get "/@:username/friends(/p/:page)", to: redirect("/@%{username}/followings/p/%{page}"), defaults: { page: 1 } - match "/@:username/questions(/p/:page)", to: "user#questions", via: [:get, :post], as: :show_user_questions, defaults: { page: 1 } + get "/@:username/questions(/p/:page)", to: "user#questions", as: :show_user_questions, defaults: { page: 1 } get "/:username(/p/:page)", to: "user#show", as: :user_alt, defaults: { page: 1 } get "/:username/a/:id", to: "answer#show", as: :answer_alt get "/:username/q/:id", to: "question#show", as: :question_alt