user: only provide #questions as GET

This commit is contained in:
Georg Gadinger 2023-01-21 20:04:55 +01:00 committed by Andreas Nedbal
parent 14f32aa3c0
commit eb7abb33be
3 changed files with 11 additions and 5 deletions

View File

@ -4,8 +4,11 @@
- if @more_data_available - if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start#paginator .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 = button_to t("voc.load"), show_user_questions_path(@user),
= t("voc.load") class: "btn btn-light",
method: :get,
params: { last_id: @questions_last_id },
form: { data: { turbo_stream: true } }
- provide(:title, questions_title(@user)) - provide(:title, questions_title(@user))
- parent_layout 'user/profile' - parent_layout 'user/profile'

View File

@ -4,5 +4,8 @@
= turbo_stream.update "paginator" do = turbo_stream.update "paginator" do
- if @more_data_available - if @more_data_available
= button_to show_user_questions_path(@user, last_id: @questions_last_id), class: "btn btn-light" do = button_to t("voc.load"), show_user_questions_path(@user),
= t("voc.load") class: "btn btn-light",
method: :get,
params: { last_id: @questions_last_id },
form: { data: { turbo_stream: true } }

View File

@ -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/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/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 } 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(/p/:page)", to: "user#show", as: :user_alt, defaults: { page: 1 }
get "/:username/a/:id", to: "answer#show", as: :answer_alt get "/:username/a/:id", to: "answer#show", as: :answer_alt
get "/:username/q/:id", to: "question#show", as: :question_alt get "/:username/q/:id", to: "question#show", as: :question_alt